[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doing away with "for"



Since Paul was asking for features to remove from es, I wrote him and
suggested doing away with "for", since the job of "for" can be done by
a function I like to call "each" (Paul calls it "apply" and Scheme
calls it for-each):

; fn each fun args { while {!~ $#args 0} {$fun $args(1); args=$args(2 ...)}}
; each @ x {echo $x} a b c    
a
b
c
;
To this suggestion, Paul sez:

Paul> the for syntax is so convenient, i don't want to give it up.  i
Paul> agree with you that it's not necessary.  if you want to suggest
Paul> it to the list, feel free.  my strong preference is to keep for
Paul> in the language because it's useful, but if there is much strong
Paul> opinion the other way, i guess i could be convinced.

Well, I am not convinced.  The difference between using "for" and
using "each" is only a couple keystrokes, and it shouldn't be hard to
get used to the syntax.  I'll gladly give it up; there is so much
other stuff I would like to see added instead, like basic arithmetic!

- Harald