Arc Forumnew | comments | leaders | submitlogin
3 points by drcode 6151 days ago | link | parent

I would suspect the answer is that it is more common to have a single variable but multiple statements, as opposed to the reverse... simply a matter of code brevity. I prefer the current behavior, but agree your version is better for FP code... but I don't really think arc is really optimized around the purely functional style, compared to other languages.


3 points by cooldude127 6151 days ago | link

i would have to disagree about how common the single variable thing is. at least in my own code, i have many more withs than i have let's with multiple statements. but then, i try to do functional programming whenever i can.

and also, arc is at least a little geared toward functional style. in my other comment i brought up that one of the things pg liked about his if version is that the explicit 'do' makes non-functional code more obvious.

-----

1 point by kennytilton 6151 days ago | link

But the more functional the programmer the less likely they are to need temporary variables, so the count 1 should be more frequent! <g> In my CL experience it comes up often enough that I have a policy where the let will be at the toplevel in a function: I use &aux (to repeat, a CL hack):

  (def my-fun (x y z &aux (temp (other-fun x y)))
     ...etc...)
Why? Yes I have a twenty-inch flat panel but I am still an almost obsessive indentation miser, and it just kills me to add a level of parens and indentation just to get one lousy temp variable. :)

-----