Re: Why is Clojure slow? (fibonacci)

2017-08-13 Thread Kevin Baldor
You could also memoize.

Sent from my iPad

> On Aug 13, 2017, at 7:27 AM, James Reeves  wrote:
> 
> With type hints your implementation should run faster:
> 
> (defn fib ^long [^long n]
>   (if (< n 2)
> n
> (+ (fib (- n 2)) (fib (- n 1)
> 
> What does your Java code look like? Is it also recursive?
> 
> 
>> On 13 August 2017 at 10:54, Daniel Gerlach  
>> wrote:
>> Hey,
>> 
>> out of curiosity i did some benchmarking on my Macbook Pro 13 i5 2,7 GHz.
>> 
>> I chose a simple naive fibonacci implementation as a candidate 
>> (i know that is not a good comparison value for real-world cases)
>> 
>> The implementation looks like this:
>>  
>> (defn fib [n]
>>   (if (< n 2)
>> n
>> (+ (fib (- n 2)) (fib (- n 1)
>> 
>> 
>> 
>> The results are a little bit surprising.
>> 
>> The average time for fib(32) in Clojure was ~ 500ms
>> The same algorithm in Java takes ~ 15 ms to finish.
>> That means Clojure it's ~30x slower than Java for this special case.
>> 
>> I also "warmed up" the JVM in both cases. For Clojure i used "criterium".
>> 
>> 
>> Can somebody explain? Do i do something wrong? Are there any optimizations 
>> possible, e.g. type hints etc. ? 
>> Does Clojure has problems with recursive functions?
>> 
>> 
>> Greetings
>> 
>> Daniel Gerlach
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> James Reeves
> booleanknot.com
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Leiningen template for pure Clojure/ClojureScript project ?

2017-07-25 Thread Kevin Baldor
I haven't used Clojurescript, so I can't address that part of your
question. For the Clojure part, you can execute the contents of a file with

java -cp clojure.jar clojure.main file.clj


On Tue, Jul 25, 2017 at 9:09 AM, Khalid Jebbari 
wrote:

> Hello, does anyone know a Leiningen template that scaffolds the minimum
> required to play with the CLJ(S) compiler, without any Leiningen/Boot stuff
> ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Modern opengl bindings in clojure

2017-07-14 Thread Kevin Baldor
I see that it's uploaded to clojars so it might be a bit late to ask, but
what is the convention on naming libraries like this?

I'm used to seeing something like clj-gl for libraries that provide a
Clojure wrapper around an existing library.

Regardless, this is awesome and I hope to play with it soon.

On Fri, Jul 14, 2017 at 3:59 PM,  wrote:

> This library is a work in progress, but is in a usable state and there is
> unlikely to be any breaking changes to the api:
>
> https://github.com/bcbradle/gl
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure <--> LISP

2017-07-10 Thread Kevin Baldor
And for good and ill, being hosted means that some of the semantics are
affected by the host language. There is a discussion of differences between
Clojure and Clojurescript here
https://www.clojurescript.org/about/differences and I'm sure there's a
similar set for differences between Clojure on the JVM vs CLR.

On Mon, Jul 10, 2017 at 4:22 PM, Răzvan Rotaru 
wrote:

> Hi,
>
> Here's how I would summarize it:
> - Common Lisp = big standard, very old, unlikely to change in the future,
> complex and powerful object system, several implementations, almost all
> mature and efficient, has some quirks with historical roots
> - Scheme = small standard, also very old, changing but slowly (there's a
> committee), many implementations, but only a few mature and efficient,
> different philosophy, different macro system, no object system
> - Clojure = strives to be a modern Common Lisp, in the sense that it
> prefers practicality over theoretical purity, has no standard (just a main
> implementation for the JVM, and others that follow closely but are not 100%
> compatible and don't intend to be), designed to be hosted and fit well with
> the host runtime, focuses on concurrency and has quite a unique approach to
> it, no object system (but has some OO features)
>
> Cheers,
> roti
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: error in nrepl

2017-06-23 Thread Kevin Baldor
It's much easier on Linux, I wish that I had taken notes when I set up my
Mac. But after a few false starts, it's working well for me. My mac is at
home, so I'll have to wait until I get there to see if I can figure out
what version I'm running and from where I downloaded it. There's a pretty
good chance that it's just the latest from *http://emacsformacosx.com
<http://emacsformacosx.com> *with the .emacs directory from
https://github.com/flyingmachine/emacs-for-clojure/archive/book1.zip.

On Fri, Jun 23, 2017 at 5:14 PM, <lawrence.krub...@gmail.com> wrote:

>
> Thank you. Maybe I can find some time to upgrade my whole Emacs setup next
> weekend. It is a bit out of date.
>
> I'm curious if folks think it is easier to work with Emacs on a Linux
> machine, or on a Mac?
>
>
>
> On Friday, June 23, 2017 at 5:39:42 PM UTC-4, Kevin Baldor wrote:
>>
>> Have you tried following the instructions at
>> http://www.braveclojure.com/basic-emacs/ ?
>>
>> It's a bit heavy-handed (replacing your entire .emacs directory), but it
>> might give you a starting point to figure out how to integrate it into your
>> emacs setup.
>>
>> On Fri, Jun 23, 2017 at 4:36 PM, <lawrence...@gmail.com> wrote:
>>
>>>
>>> Yes, sadly, I've never gotten Cider to work with Emacs. I keep thinking
>>> someday I'll take a weekend and work through all the errors and get it
>>> working, but I never seem to find the time. So I keep working with an old
>>> version of nrepl. But I take it, from your answer, you think this error
>>> would vanish if I upgraded to Cider?
>>>
>>>
>>>
>>>
>>> On Friday, June 23, 2017 at 5:15:09 PM UTC-4, James Reeves wrote:
>>>>
>>>> nrepl-jack-in? Do you mean cider-jack-in? AFAIK nrepl-jack-in is from a
>>>> very old version of Cider.
>>>>
>>>> On 23 June 2017 at 21:29, <lawrence...@gmail.com> wrote:
>>>>
>>>>> I'm using Emacs on my Mac. I ran "nrepl-jack-in" to load up the repl.
>>>>> I'm iterating over a dataset from mysql. My code is very simple, I'm just
>>>>> trying to count the words:
>>>>>
>>>>> (reduce
>>>>>
>>>>> (fn [map-of-word-count next-name]
>>>>> (let [
>>>>> words (clojure.string/split next-name #"\s")
>>>>> map-of-names-words-with-count (frequencies words)
>>>>> ]
>>>>> (println map-of-names-words-with-count)
>>>>> (merge-with + map-of-word-count map-of-names-words-with-count)
>>>>> )
>>>>> )
>>>>> {}
>>>>> names)
>>>>>
>>>>> I keep getting this message:
>>>>>
>>>>>
>>>>> error in process filter: nrepl-bdecode-buffer: Cannot decode object: 1
>>>>> error in process filter: Cannot decode object: 1
>>>>> Error running timer `jit-lock-stealth-fontify': (error "Variable
>>>>> binding depth exceeds max-specpdl-size")
>>>>> timer-relative-time: Variable binding depth exceeds max-specpdl-size
>>>>>
>>>>>
>>>>> Does anyone know what this means?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Clojure" group.
>>>>> To post to this group, send email to clo...@googlegroups.com
>>>>> Note that posts from new members are moderated - please be patient
>>>>> with your first post.
>>>>> To unsubscribe from this group, send email to
>>>>> clojure+u...@googlegroups.com
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/clojure?hl=en
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Clojure" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to clojure+u...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> James Reeves
>>>> booleanknot.com
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note 

Re: error in nrepl

2017-06-23 Thread Kevin Baldor
Have you tried following the instructions at
http://www.braveclojure.com/basic-emacs/ ?

It's a bit heavy-handed (replacing your entire .emacs directory), but it
might give you a starting point to figure out how to integrate it into your
emacs setup.

On Fri, Jun 23, 2017 at 4:36 PM,  wrote:

>
> Yes, sadly, I've never gotten Cider to work with Emacs. I keep thinking
> someday I'll take a weekend and work through all the errors and get it
> working, but I never seem to find the time. So I keep working with an old
> version of nrepl. But I take it, from your answer, you think this error
> would vanish if I upgraded to Cider?
>
>
>
>
> On Friday, June 23, 2017 at 5:15:09 PM UTC-4, James Reeves wrote:
>>
>> nrepl-jack-in? Do you mean cider-jack-in? AFAIK nrepl-jack-in is from a
>> very old version of Cider.
>>
>> On 23 June 2017 at 21:29,  wrote:
>>
>>> I'm using Emacs on my Mac. I ran "nrepl-jack-in" to load up the repl.
>>> I'm iterating over a dataset from mysql. My code is very simple, I'm just
>>> trying to count the words:
>>>
>>> (reduce
>>>
>>> (fn [map-of-word-count next-name]
>>> (let [
>>> words (clojure.string/split next-name #"\s")
>>> map-of-names-words-with-count (frequencies words)
>>> ]
>>> (println map-of-names-words-with-count)
>>> (merge-with + map-of-word-count map-of-names-words-with-count)
>>> )
>>> )
>>> {}
>>> names)
>>>
>>> I keep getting this message:
>>>
>>>
>>> error in process filter: nrepl-bdecode-buffer: Cannot decode object: 1
>>> error in process filter: Cannot decode object: 1
>>> Error running timer `jit-lock-stealth-fontify': (error "Variable binding
>>> depth exceeds max-specpdl-size")
>>> timer-relative-time: Variable binding depth exceeds max-specpdl-size
>>>
>>>
>>> Does anyone know what this means?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> James Reeves
>> booleanknot.com
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spec without global registry?

2017-06-12 Thread Kevin Baldor
I'm interested in the answer to whether it is just an accident of
implementation or if there is some compelling reason for the global
registry.

I'm still new to Clojure and it would be good to hear the tradeoffs and
design process that led to the current implementation.


On Mon, Jun 12, 2017 at 12:37 PM, Mark  wrote:

> I'm a bit surprised by this.  It seems that the use of the global registry
> limits spec to development use cases.  Is that intentional?  Maybe I'm
> worried over nothing
>
>
> On Saturday, June 10, 2017 at 11:04:17 AM UTC-7, Alex Miller wrote:
>>
>> We don't have any plans at the moment to support anything but the global
>> registry.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What makes Clojure Clojure?

2017-03-05 Thread Kevin Baldor
I feel like it should be obvious, but what are the acronyms (initialisms?) clj 
and cljc?

I'm assuming that cljs is ClojureScript.

Sent from my iPhone

> On Mar 4, 2017, at 6:46 PM, John Newman  wrote:
> 
> Yeah, only Rich can really answer that question, right? :) But for me, 
> Clojure is increasingly becoming cljc. When a library advertises 
> compatibility in both clj and cljs, it just looks shinier to me. Feels like a 
> trend for Clojure libraries in general. And if agents and STM were on cljs, 
> I'd probably reach of those tools more often on both platforms. 
> 
> On that note, if some Clojure concurrency magician would implement a 
> lightweight threading library in cljc, which worked on both single-threaded 
> cljs (offloading to webworkers where available) and JVM/CLR, allowing for STM 
> on cljc... Hell, I'd throw down on a bounty for that. It would really bring 
> cljs and clj into closer parity. And it would make cljs even more appetizing 
> to js programmers. And it would reunite cljs with one of clj's original 
> selling points - how immutability and persistent structures allow for 
> unparalleled (lol) concurrency solutions.
> 
> I almost got a rudimentary pmap thing working in cljs on core.async with 
> webworkers by using a binding-hack macro I found online somewhere. I couldn't 
> find great docs out there though on how to implement a lightweight threading 
> library.
> 
> On Sat, Mar 4, 2017 at 6:51 PM Didier  wrote:
>> The Specter post about if it should be made into core or not got me 
>> wondering what makes Clojure Clojure.
>> 
>> I'm trying to wrap my head around what is the most minimal set of things 
>> that uniquely make up Clojure.
>> 
>> Right now, in that set I've got:
>> The Clojure syntax and its semantics
>> The Clojure special forms and their semantics
>> The Clojure core libraries and their semantics
>> So if I implemented a compiler that worked with the above set, it would be a 
>> valid Clojure compiler.
>> 
>> Now, ClojureScript appears to me like it is not Clojure, but a dialect of 
>> it. I say that because it breaks some of the syntax semantics of Clojure, 
>> like not allowing macros in the same namespace as functions. It also breaks 
>> some of the core semantics, like def creating standard JS vars and not 
>> Clojure Vars. In this respect, a language like hy-lang is also a Clojure 
>> dialect, granted it shares even less of the Clojure set.
>> 
>> Is ClojureCLR a dialect of Clojure, or is it a true Clojure implementation?
>> 
>> One last thing that is interesting about Clojure versus other languages is 
>> that it does not provide standard IO. These two things make it so that it is 
>> kind of dependent on its host to complete its offering as a programming 
>> language, which means any Clojure compiler will need to provide a mechanism 
>> for IO. Those would always differ from Clojures to Clojures, so I don't 
>> think that's part of what makes Clojure Clojure.
>> 
>> What are others thoughts on this?
>> 
>> P.S.: There's no point to this thread, its mostly curiosity.
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You