Arc Forumnew | comments | leaders | submitlogin
1 point by rincewind 5846 days ago | link | parent

let [... _ ...] mean (fn _ (... _ ...))

example usage:

  (reduce [-  (/ _.1 (* 2 _.0))] mylist)


1 point by absz 5845 days ago | link

Unfortunately, this is then deoptimized for the most common one-argument case, where you have to write [... _.0 ...]. We could have [...] expand to (fn __ (let _ (car _) ...)), so that you would have

  (reduce [- (/ __.1 (* 2 __.0))] mylist)
but still have

  (map [+ _ (* _ _)] myotherlist)
. I still prefer the _1, _2, ... syntax, though---unsurprisingly, as I contributed that implementation (though not the idea) :)

-----

1 point by shader 5845 days ago | link

Actually, I do think the _1, _2 .. syntax makes the most sense, if you aren't wanting to name parameters. Though maybe (as was mentioned above) in some cases, the first three should be a b c, or x y z? I don't know how you would set that up to work well with what already exists though.

-----