Arc Forumnew | comments | leaders | submitlogin
2 points by vsingh 6153 days ago | link | parent

Didn't Paul call Loop one of the worst mistakes in Common Lisp? I doubt the man is going to change his mind on this one.

Loop may minimize parentheses (i.e. nesting), but then again, so does BASIC. I'd say the main reason it isn't "Arcy" is that it fails the simplicity-of-implementation test.



2 points by kennytilton 6153 days ago | link

I think you misunderstand. The "weird" to which I refer is precisely pg's anti-(cl)-loopism. He should love loop not just for the brevity, but also because it is a triumph of DSL. ie, CL loop is a DSL for iteration, and I know because I use it for everything. But! pg seems closer to being a schemer at heart so maybe he prefers recursion for things I handle by iteration.

ps. Are you saying BASIC eliminates parentheses the same way LOOP does? :)

-----

1 point by vsingh 6153 days ago | link

It's hard for me to see Loop as a triumph of DSL. I see it more as a failure of Common Lisp to provide simple flexible iteration constructs.

Arc already seems to provide simple operators for many of the cases in which Loop is commonly used. For example: 'accum', 'for', and 'repeat'. It doesn't seem like we need Loop.

Re BASIC: In a way, yes. Both BASIC and Loop use keywords to replace the indication of structure by parentheses. For example, we could eliminate a pair of brackets in 'with' by doing this:

    (with x 2 y 3 z 4 endvars
        (+ x y z))
but that wouldn't be very Lispy.

-----

2 points by kennytilton 6153 days ago | link

Well I resisted Loop for almost ten years then broke down and learned it when PCL came out cuz it had a good chapter on it, so having made the transition I can assure you it is a powerful little iteration language, not just a simple iterator of which CL has many so it is not clear what you do not like about those. I'll ignore your continued insistence that BASIC has anything to do with this discussion. :)

Btw, loop offers a little-known second syntax that is Lispy, one just never sees examples in the wild.

-----

2 points by vsingh 6153 days ago | link

If you have found through long experience that Loop truly offers something unique that can't be offered as well (or as intelligibly) by a combination of simpler operators, then I'll have to take your opinion seriously.

I've made a thread to collect exemplary examples of Loop in action (http://arclanguage.org/item?id=2938) and it'd be great if you could contribute your favorites, e.g. from Cells or other code you've written.

Personally, I don't have the same experience as you. I've found Loop to be useful as a replacement for iteration constructs that should have been in CL to begin with, e.g. dovector, when I'm too lazy to code the requisite macro. I haven't ever had to use Loop in its full complexity.

-----

4 points by kennytilton 6152 days ago | link

Sorry, it just sounds from what you have posted so far that you do not know CL's loop, by which I mean make an effort to use all of its capabilities such that you would know what's there so well that you had it at your fingertips. I am having the same problem with CL idiots denouncing Arc who probably have not even installed it.

You want me to code (dotimes (x 10) (foo))?! No way!

  (loop repeat 10 do (foo)). 
And that is not even a good example!!

  (let (x)
     (dolist (y whatever (nreverse x))
        (let ((py (pfft y)))
           (when py
               (push (yo-mama (cons y py)) x)))
Egad! How about:

   (loop for y in whatever
         for py = (pfft y)
         when py collect (yo-mama (cons y py)))
Is the first version starting to look like a disassembly? Bingo!!! :)

btw, the thing that got me to break down and give loop a chance was learning that the expansion was highly optimized code, meaning (for example) it would not first map across whatever and then delete the nils.

but these examples still do not get to the point of LOOP being a DSL. That property emerges only in the next level of application, as even the loop form expands to ten lines. But once you have loop under your belt (I kill myself) you do not even want to code a simple dotimes, that bogus unused count variable just pisses you off no end, never mind all the extra (wait for it) parentheses!

pg, phone home, all is forgiven! :)

-----

2 points by vsingh 6152 days ago | link

That looks interesting. I've submitted that example to my thread.

-----