Re: Combining Complement and Not

2012-11-06 Thread Stathis Sideris
The difference between not and complement is that not takes a *value* and produces a new *value* which is true if the original was false (and vice versa) while complement takes a *function* and produces a new *function *which returns true in the cases where the original function would return

Re: unseq

2012-11-06 Thread the80srobot
If I understand this right, you're looking for something like Lua's unpack function. AFAIK you will not be able to do this in Clojure using functions, because Clojure functions can only return one argument. The only way to achieve this behavior would by by transforming your calls using reader

Re: unseq

2012-11-06 Thread Bronsa
What about using destructuring? (defn F [[a b c d]] (+ a b c d)) 2012/11/6 the80srobot a...@ingenious.cz If I understand this right, you're looking for something like Lua's unpack function. AFAIK you will not be able to do this in Clojure using functions, because Clojure functions can only

Re: Free Clojure Course

2012-11-06 Thread JvJ
Seems like nifty shenanigans but how much does this course cover? On Sunday, 28 October 2012 06:54:02 UTC-4, Ryan Kelker wrote: There's a free 19 part series on basic Clojure @ http://www.udemy.com/clojure-code -- You received this message because you are subscribed to the Google

Re: Free Clojure Course

2012-11-06 Thread JvJ
Seems like nifty shenanigans but how much does this course cover? It would be nice to see a course that covered some of the more advanced features of the language, like multimethods, concurrent programming, interop, etc. On Sunday, 28 October 2012 06:54:02 UTC-4, Ryan Kelker wrote: There's

Re: Cdr car

2012-11-06 Thread JvJ
After seeing this thread I looked into car and cdr, and there's one thing I really liked about them: the various compositions. There's quite a number of functions like caar, cadr, cadadr, etc. It's lengthy to do that in clojure with just first and rest. On Tuesday, 16 October 2012 18:40:24

Re: Cdr car

2012-11-06 Thread Sean Corfield
On Tue, Nov 6, 2012 at 9:34 AM, JvJ kfjwhee...@gmail.com wrote: There's quite a number of functions like caar, cadr, cadadr, etc. It's lengthy to do that in clojure with just first and rest. Clojure does have ffirst, fnext, nfirst, nnext tho' - and I'd question why you'd need to string several

Adding a comma to end of clojure sequence

2012-11-06 Thread octopusgrabbus
Is it possible to add an unquoted comma at the end of a Clojure sequence, while using clojure.data.csv's write-csv? (defn write-csv-file Writes a csv file using a key and an s-o-s [out-sos out-file] (if (= dbg 1) (println (first out-sos), \n, out-file)) (spit out-file :append

Re: Adding a comma to end of clojure sequence

2012-11-06 Thread octopusgrabbus
This is solved. I am adding a blank field, which gets me my trailing comma. On Tuesday, November 6, 2012 2:40:19 PM UTC-5, octopusgrabbus wrote: Is it possible to add an unquoted comma at the end of a Clojure sequence, while using clojure.data.csv's write-csv? (defn write-csv-file Writes

Re: Combining Complement and Not

2012-11-06 Thread Charles Comstock
I understand that, hence the example being to check if the value was a function, since returning false from not'ing a function didn't make sense to me. The change I was inquiring about applied to your example would be; (filter (fnot even?) [1 2 3 4 5 6 7]) = (1 3 5 7) (filter fnot [true false

Re: Cdr car

2012-11-06 Thread Michael Gardner
On Nov 6, 2012, at 11:48 , Sean Corfield seancorfi...@gmail.com wrote: On Tue, Nov 6, 2012 at 9:34 AM, JvJ kfjwhee...@gmail.com wrote: There's quite a number of functions like caar, cadr, cadadr, etc. It's lengthy to do that in clojure with just first and rest. Clojure does have ffirst,

How to call javascript's call/apply to set context/scope with this from clojurescript?

2012-11-06 Thread Frank Siebenlist
In Javascript you seem to be able to set the context for this to any fn-object by specifying your desired context's this in the call/apply call. (never knew about this option - feels like an aweful hack to define invocation-scope but some libraries use it… see

Re: How to call javascript's call/apply to set context/scope with this from clojurescript?

2012-11-06 Thread David Nolen
You could do: (.call f context ...) On Tue, Nov 6, 2012 at 5:33 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: In Javascript you seem to be able to set the context for this to any fn-object by specifying your desired context's this in the call/apply call. (never knew about this

Re: How to call javascript's call/apply to set context/scope with this from clojurescript?

2012-11-06 Thread Frank Siebenlist
Too easy ;-) Thanks, FrankS. On Nov 6, 2012, at 2:38 PM, David Nolen dnolen.li...@gmail.com wrote: You could do: (.call f context ...) On Tue, Nov 6, 2012 at 5:33 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: In Javascript you seem to be able to set the context for this

Re: Combining Complement and Not

2012-11-06 Thread James MacAulay
I'd say the simplest answer is just that functions *are* values, they are never logical-false, and (not) is based on logical falseness. Giving (not) a special case for functions would make it less composable by trying to make it do more. -James On Tuesday, 6 November 2012 14:55:53 UTC-5,

Anonymous Macros

2012-11-06 Thread Sean Neilan
Is there any way to write an anonymous macro in Clojure? This post: http://stackoverflow.com/questions/4074961/anonymous-macros-in-clojure says it's possible with some hacks and in version 1.3 Clojure will have some kind of support for this. Thank you for your time. -Sean -- You received this

Re: Anonymous Macros

2012-11-06 Thread Sun Ning
I'm afraid not. Macro should be bound on a var. The clojure compile checks an attribute (isMacro) on a var to determine if it's a macro or function. And Since a macro has no value, you cannot write it with some literals. On Wed 07 Nov 2012 08:16:42 AM CST, Sean Neilan wrote: Is there any way

Re: Anonymous Macros

2012-11-06 Thread jaime
May I know in what circumstances would an anonymous macro be applied? - I just don't think there's a way to define anonymous macro but maybe we can make a workaround by manipulating the macro syntax... 在 2012年11月7日星期三UTC+8上午8时17分37秒,Sean Neilan写道: Is there any way to write an anonymous macro

Re: Anonymous Macros

2012-11-06 Thread Sean Neilan
I was hoping to write a macro inside of a let statement. The macro would be returned from the let and keep closures to whatever was defined in the let. Also, if possible, define multiple global macros inside of a let statement so it's as if the let is returning multiple values. On Tue, Nov 6,

Re: Anonymous Macros

2012-11-06 Thread Sean Neilan
I was hoping to write a macro inside of a let statement. The macro would be returned from the let and keep closures to whatever was defined in the let. Also, if possible, define multiple global macros inside of a let statement so it's as if the let is returning multiple values. On Tue, Nov 6,

Re: Anonymous Macros

2012-11-06 Thread jaime
Well, logically the difference between a function and macro is just that the parameters will be evaluated in a function call but will not in a macro call. I suppose you can use anonymous function to achieve what you may want in a LET statement. And as SunNing said, Clojure will use meta tag

Re: Anonymous Macros

2012-11-06 Thread Baishampayan Ghose
Take a look at tools.macro/macrolet. https://github.com/clojure/tools.macro/ Regards, BG Sent from phone. Please excuse brevity. On 6 Nov 2012 19:10, Sean Neilan s...@seanneilan.com wrote: I was hoping to write a macro inside of a let statement. The macro would be returned from the let and

Re: Anonymous Macros

2012-11-06 Thread Alex Baranosky
Yep. `macro-let` is what you're looking for. On Tue, Nov 6, 2012 at 10:41 PM, Baishampayan Ghose b.gh...@gmail.comwrote: Take a look at tools.macro/macrolet. https://github.com/clojure/tools.macro/ Regards, BG Sent from phone. Please excuse brevity. On 6 Nov 2012 19:10, Sean Neilan