Re: [ANN] ClojuTRE 2015 conference in Tampere, Finland

2015-09-17 Thread jarppe
Videos now available:  
https://www.youtube.com/playlist?list=PLetHPRQvX4a_tA9hGP935-OyLOYaRKpnj

-- 
-jarppe

On Monday, June 22, 2015 at 3:24:23 PM UTC+3, Mikko Heikkilä wrote:
>
> Dear fellow Clojurians,
>
> ClojuTRE 2015 will take place Friday, September 11th 2015, in Tampere, 
> Finland.
>
> ClojuTRE is a free Clojure conference organised by Metosin. The event has 
> single track, late start, short talks and an awesome after party for 
> networking, discussions and beer. We welcome both newbies and seasoned 
> Clojurists. Current known facts can be found at http://clojutre.org 
>
> Registration via Eventbrite is open at https://clojutre-2015
> .eventbrite.com/
>
> Call for Speakers is also open and can be found at 
> http://goo.gl/forms/hY1PXtUnm4
>
> Last year was a blast, this one will be even moreso! Hope to see you in 
> ClojuTRE 2015!
>
> On behalf of the ClojuTRE team & Metosin,
>
> # Mikko
>
>

-- 
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.


Using function that returns unique keys in map literals causes an

2012-09-12 Thread jarppe
I have a function that returns unique ID every time it is called. If I try 
to create a new map with two entries, both having a unique
key generated by that function, I get IllegalArgumentException Duplicate 
key exception. For example:

user=> *(def id (atom 0))*
user=> *(defn generate-id [] (swap! id inc))*
user=> 
user=> *{(generate-id) "foo" (generate-id) "bar"}*
IllegalArgumentException Duplicate key: (generate-id) 
 clojure.lang.PersistentArrayMap.createWithCheck 
(PersistentArrayMap.java:70)


How ever, it works just fine if I do it like this:

user=> *(let [id1 (generate-id) id2 (generate-id)]  {id1 "foo" id2 "bar"})*
{3 "foo", 4 "bar"}


Is this a bug, or am I doing something wrong here?

I'm using Clojure 1.4.

-- 
-jarppe

-- 
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

Map literal with keys generated by function cause "Duplicate key" exception

2012-09-12 Thread jarppe
I have a function that generatwed unique ID's, something like this:

  (def k (atom 0))
  (defn generate-id [] (swap! k inc))

 and I try to use it like this:

   {(generate-id) "foo"
(generate-id) "bar"}

How ever, I get

   IllegalArgumentException Duplicate key: (generate-id)  
clojure.lang.PersistentArrayMap.createWithCheck (PersistentArrayMap.java:70)

This works as expected.

  (let [id1 (generate-id)
id2 (generate-id)]
{id1 "foo" id2 "bar})

Should I be able to call generate-id in map literal?

-- 
-jarppe

-- 
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

Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
Hi,

I have this macro (complete file https://www.refheap.com/paste/7633):

*(*defmacro defgreeter [greeter-name]

  *(*let [greeter *(*make-greeter*)*]

`*(*do

   *(*defn ~greeter-name [user-name#]

 *(*~greeter user-name#*)**)**)**)**)*


It works as expected when make-greeter is defined like this:

*(*defn make-greeter []

  *(*fn [user-name]

*(*str "Hello, " user-name*)**)**)*


I can use it like this:

*(*defgreeter hello*)*

*(*hello "jarppe"*)*

How ever, if I change make-greeter to this I get IllegalArgumentException:

*(*defn make-greeter []

  *(*let [message "hello"]

*(*fn [user-name]

  *(*str message ", " user-name*)**)**)**)*


Interestingly, this does not work either:

*(*defn make-greeter []

  *(*constantly "what erver"*)**)*

What am I missing?

-- 
-jarppe

-- 
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

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-16 Thread jarppe
I think you are right, when ever the function returns a closure I get the 
exception. I think it should work with closures anyhow.

-- 
-jarppe


On Sunday, December 16, 2012 7:49:30 PM UTC+2, juan.facorro wrote:
>
> I think it has to do with the closure in the *fn *used when generating 
> the form in the macro. 
>
>>
>>

-- 
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

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread jarppe


On Sunday, December 16, 2012 9:57:26 PM UTC+2, Jonathan Fischer Friberg 
wrote:
>
> I don't know why it doesn't work. However, changing defgreeter to the 
> following seems work.
>
> (defmacro defgreeter [greeter-name]
>   (let [greeter (make-greeter)]
> `(def ~greeter-name ~greeter)))
>  
>
Might be a clue. :)
>
>
Strange. That is definitely a clue, but for what? :)

-- 
-jarppe

-- 
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