Arc Forumnew | comments | leaders | submitlogin
4 points by vsingh 5892 days ago | link | parent

Your solution is not sufficiently general.

For example, it should keep working if the 'a' in (+ . a) is replaced with its actual value. In that case, we get:

    (+ . '(1 2 3))
which is the same thing as saying

    (+ . (quote (1 2 3))
which is equivalent to

    (+ quote (1 2 3))
which obviously doesn't do the same thing as

    (apply + '(1 2 3))
which is what you wanted.


1 point by bogomipz 5883 days ago | link

That means (+ . (1 2 3)) does what you want, doesn't it?

Granted, to do the equivalent of (+ @(foo)) you would have to do;

  (let temp (foo)
       (+ . temp))
Which is not very nice at all, so I'm not arguing against @. On the contrary.

Edit: I used to think that . and @ would only differ in the sense that cons and splice have different list building semantics, but now I believe that they should also differ in the timing of the operation;

  (+ . (foo))  -> (+ foo)
  (+ . '(foo)) -> (+ quote foo)
  (+ @(foo))   -> what we want, given that foo returns a list
  (+ @'(foo))  -> (+ 'foo)

-----