laarcnew | comments | discord | tags | ask | show | place | submitlogin
List comprehensions in Arc (
3 points by akkartik to arc dev 662 days ago | 2 comments

4 points by rain1 662 days ago

I use the bare scheme language quite a lot and loops are done with recursion or named let (which is syntactic sugar for a local recursive function). I definitely see that a powerful loop system is needed at times.

It's not really clear to me what the ultimate loop system should be like though, there is a huge design space here. It seems that the new flat `collect` loop macro is being defined in terms of `accum` which has a staggered style. Programming with bare let loops ends up being very staggered so I can see `collect` as a definite improvement.

There is a good bit of didactic teaching about how to implement recursive functions in this post which should be of value to beginners.

Seeing the final code is very interesting because I'm not familiar with arc and it's actually really terse. I didn't know about the . thing, I guess f.x is short for (f x). Strikes a good balance between power and straight forward simple implementation.


3 points by akkartik 662 days ago

By 'staggered' are you referring to how the code tends to indent towards the right? Yeah, that's definitely a cognitive tax.


Welcome | Guidelines | Bookmarklet | Feature Requests | Source | Contact | Twitter | Lists

RSS (stories) | RSS (comments)