[HN Gopher] Star: an iteration construct for Common Lisp
       ___________________________________________________________________
        
       Star: an iteration construct for Common Lisp
        
       Author : Tomte
       Score  : 32 points
       Date   : 2024-05-15 12:03 UTC (1 days ago)
        
 (HTM) web link (www.tfeb.org)
 (TXT) w3m dump (www.tfeb.org)
        
       | 13415 wrote:
       | Looks similar to the Racket for macros. I like it.
        
       | mtreis86 wrote:
       | Which compiler was used for the benchmarks?
        
       | nescioquid wrote:
       | I shared the urge to avoid loop until I read Pascal Costanza's
       | Highly Opinionated Guide to Lisp[1]
       | 
       | >> Seemingly, the intended way to use the LOOP facility is to
       | just "guess" a way to express an iteration and see if it works.
       | If it doesn't you can either look up the specifics ...
       | 
       | Since then, I do just guess at the syntax and it strangely does
       | what I want most of the time.
       | 
       | It seems that a library like this has a lot to prove because a)
       | it doesn't provide a new capability, b) it adds a project
       | dependency, and c) creates yet another way to do a standard task.
       | If you really don't like the loop macro, you probably don't need
       | much persuading, but I would have liked to have seen more
       | discussion on the these trade-offs.
       | 
       | [1] http://www.p-cos.net/lisp/guide-v1.html
        
         | azeirah wrote:
         | Huh, this is such an unusual design goal in programming
         | languages "just try something and it'll probably work"
         | 
         | Only css is done this way... but not even intentionally
        
           | Jtsummers wrote:
           | That's not the design goal, it's more a "haha but kind a
           | true" thing.
           | 
           | https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node235.html
           | 
           | The grammar for what's accepted by Loop is well specified,
           | but the results also read very clearly. Once you learn a few
           | of them, you start to understand how the rest would be
           | written and can guess, but the design is not that you would
           | guess.
        
       | EdwardCoffin wrote:
       | A couple of years ago I finally started to understand the Waters
       | series facility [1], which was offered as an alternative to Loop.
       | It's a bit finicky, and the error messages are often mystifying,
       | but I have come to quite like it for some more complicated
       | looping situations. The thing that finally made it accessible to
       | me was a blog post by Joe Marshall, _Series tips and tricks_ [2]
       | 
       | Ironically enough, once my use of it advanced enough, I found
       | myself writing _producing_ forms which are just a restricted form
       | of Loop invocation - Series turns out to compile down to Loop. It
       | 's just that I (and others, apparently) find Series expressions
       | more pleasant to deal with than Loop expressions.
       | 
       | [1]
       | https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node347.html#...
       | 
       | [2] http://funcall.blogspot.com/2022/07/series-tips-and-
       | tricks.h...
        
       | drbig wrote:
       | ``` It also has no inherent knowledge about how to iterate over
       | any particular structure: it doesn't know how to iterate over
       | lists, or ranges of numbers. Rather it knows that iterating has
       | to answer two questions:                   is there more?
       | what is the next thing?
       | 
       | In addition it knows how to ask another question:
       | is there any information I can use to make asking the first two
       | questions faster?
       | 
       | ```
       | 
       | This approach sounds so good. Focus on what is needed to solve
       | the main task. Don't do less, but please don't do more. And... Do
       | Not Assume.
        
       | swah wrote:
       | I tried to clean the dirt on top of the S with my finger..
        
       ___________________________________________________________________
       (page generated 2024-05-16 23:00 UTC)