Re: Using @ alone

2015-05-21 Thread Sam Ritchie
Whoops, sorry all. Only the first message in the thread loaded. Sam Ritchie (@sritchie) RaceHub Co-Founder 703.863.8561 www.racehubhq.com Twitter // Facebook > On May 21, 2015, at 8:33 AM, Sam Ritchie wr

Re: Using @ alone

2015-05-21 Thread Sam Ritchie
That’s probably with a macro body, where it takes on a slightly different meaning. `(+ ~@[1 2 3]) In that form, ~@ strips off the sequence following it. The form macroexpands to (clojure.core/+ 1 2 3) I believe ~@ only works inside a backticked form. Sam Ritchie (@sritchie) RaceHub Co-Founder

Re: Using @ alone

2015-05-21 Thread Colin Yates
Yes, exactly. In my previous email I incorrectly said '() was a set. On 21 May 2015 01:07, "Pierre Thibault" wrote: > No: > > (type '()) > clojure.lang.PersistentList$EmptyList > > It a list just like it should be. > > Le mercredi 20 mai 2015 20:02:22 UTC-4, Colin Yates a écrit : >> >> That's OK,

Re: Using @ alone

2015-05-20 Thread Pierre Thibault
Hi Adam, I want to play to learn Clojure. It is not so much with a purpose in mind. Yes, apply works well. Le mercredi 20 mai 2015 23:14:43 UTC-4, Adam Morgan a écrit : > > Hi Pierre, > > If I understand you correctly, you are attempting to crack open a > sequence, as ~@ would do in a macro.

Re: Using @ alone

2015-05-20 Thread Adam Morgan
Hi Pierre, If I understand you correctly, you are attempting to crack open a sequence, as ~@ would do in a macro. You are probably looking for apply. For example: (apply + '(1 2 3)) 6 On Wednesday, May 20, 2015 at 6:07:13 PM UTC-6, Pierre Thibault wrote: > > No: > > (type '()) > clojure.lan

Re: Using @ alone

2015-05-20 Thread Pierre Thibault
No: (type '()) clojure.lang.PersistentList$EmptyList It a list just like it should be. Le mercredi 20 mai 2015 20:02:22 UTC-4, Colin Yates a écrit : > > That's OK, I am also confused between '() which is a literal list and #{} > which is a literal set :). > On 21 May 2015 00:55, "Pierre Thibaul

Re: Using @ alone

2015-05-20 Thread Colin Yates
That's OK, I am also confused between '() which is a literal list and #{} which is a literal set :). On 21 May 2015 00:55, "Pierre Thibault" wrote: > OK, > > I don't know how to write macros yet. I was confused. > > Thank you. > > Le mercredi 20 mai 2015 18:48:03 UTC-4, Colin Yates a écrit : >> >

Re: Using @ alone

2015-05-20 Thread Pierre Thibault
OK, I don't know how to write macros yet. I was confused. Thank you. Le mercredi 20 mai 2015 18:48:03 UTC-4, Colin Yates a écrit : > > @ (and deref) are used to dereference constructs which support multiple > values over time; atoms, futures and promises etc. ~@ is a different thing > entirely

Re: Using @ alone

2015-05-20 Thread Colin Yates
@ (and deref) are used to dereference constructs which support multiple values over time; atoms, futures and promises etc. ~@ is a different thing entirely and is used to desplice lists in a macro. In your example, you aren't in a macro and '() is defining a set, I.e. it isn't a temperal construct

Re: Using @ alone

2015-05-20 Thread Pierre Thibault
OK, ~@ is one operator, I thought it was two different operators. Thank you. Le mercredi 20 mai 2015 18:38:50 UTC-4, Laurens Van Houtven a écrit : > > Hi Pierre, > > > On May 20, 2015, at 3:35 PM, Pierre Thibault > wrote: > > Is possible to use the operator '@' alone? In the Joy Of Clojure book

Re: Using @ alone

2015-05-20 Thread Pierre Thibault
For example: (def foo '(1 2 3)) (+ @foo) Does not work. I am expecting 6. Le mercredi 20 mai 2015 18:37:05 UTC-4, Colin Yates a écrit : > > @my-atom is the same as (deref my-atom), is that what you mean? > On 20 May 2015 23:35, "Pierre Thibault" > wrote: > >> Is possible to use the operator '@'

Re: Using @ alone

2015-05-20 Thread Laurens Van Houtven
Hi Pierre, > On May 20, 2015, at 3:35 PM, Pierre Thibault > wrote: > > Is possible to use the operator '@' alone? In the Joy Of Clojure book it is > presented as '~@'. I would like an example. There are multiple contexts in which @ could be used. One is syntactic sugar for the deref functio

Re: Using @ alone

2015-05-20 Thread Colin Yates
@my-atom is the same as (deref my-atom), is that what you mean? On 20 May 2015 23:35, "Pierre Thibault" wrote: > Is possible to use the operator '@' alone? In the Joy Of Clojure book it > is presented as '~@'. I would like an example. > > -- > You received this message because you are subscribed