Re: unseq

2012-11-08 Thread Herwig Hochleitner
Ah, only now I see what you were even trying to do. Let me explain why I think not having unpack is a good idea: In clojure syntax, (G (F x)) is, under all circumstances - even if F is a macro -, G called with a _single_ argument, which is the result of (F x) Even if we had smth like unpack, i.e.

Re: unseq

2012-11-08 Thread cej38
Adam, Good job. You answered the question I asked. Thank you. Everyone else, Yes, I told you I could usually come up with ways around what I was asking for, but there could be problems with what you have suggested. I haven't had time to do more detailed testing, so there might be more use

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

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 m

Re: unseq

2012-11-05 Thread Alex Nixon
It's not possible because (in this example) F will throw an ArityException if invoked with anything other than four arguments. 'apply' is special in that it invokes the function via 'applyTo' (which takes a single s

Re: unseq

2012-11-05 Thread Stathis Sideris
Given the setup that you provided, using apply is a perfectly valid answer. What are the complicating factors that prevent you form using it? Could you give us an example that's closer to your use case? On Monday, 5 November 2012 13:35:41 UTC, cej38 wrote: > > No, you don't. I want a command th

Re: unseq

2012-11-05 Thread cej38
No, you don't. I want a command that works INSIDE of f not ON f. The function that I gave earlier was something overly simple. On Monday, November 5, 2012 12:46:24 AM UTC-5, Jerry Peng wrote: > > If I understand your problem correctly, you could use `apply`. > > user=> (defn f [w x y z] (+ w

unseq

2012-11-04 Thread cej38
Say you are given a vector A=[a1 a2 a3 a4] by some function/library/Java call/whatever. You want to use A in some function F that expects the values a1 a2 a3 a4 but not in the form of A; for example (defn F [w x y z] (+ w x y z)). Is there some function G that you can use on A such that (F (G A