5 ms·
> I think common lisp is basically a better rust for a lot of the things rust is being used for.. More like a superior python with an awkward syntax and some c
by vegai_ 5y ago
> I think common lisp is basically a better rust for a lot of the things rust is being used for..
More like a superior python with an awkward syntax and some crazy legacy (loop macro being the worst offender perhaps).
Just the other day, my ipython interpreter killed itself after having an uptime of 8 hours. No reason, just got tired of living. In such occasions, I hope I would've spent more time assimilating my brain to some common lisp craziness so I wouldn't have to deal with shit like that.
- reikonomusha 5y agoLOOP gets weird flack from some purist mindset. There's no issue with it in practice.
- vegai_ 5y agoYeah, the other, possibly worse, problem is that experienced common lisp programmers think that LOOP is ok ;)
- maydup-nem 5y agopurist? no, it's a very practical mindset. if you are into lisp, you should already appreciate the power of parenthesis. i literally have to spend time parsing the barren (longish) loop macros to understand wth is going on and what keyword is suppossed to stick to where. in other, totally unrelated news, forget about customizability and embrace the ever-crappy indentation (especially with aggressive-indent) and the awful non-sexp-based editing. what looks like purism is in fact guided by simple pain avoidance. no, fren, iterate all the way. it is regular common lisp code and doesn't make you context switch due to some _obviously_ misguided DSL design. i don't understand why some lispers are so adamantly supportive of LOOP. what's more, some of them _despise_ iterate (because reasons). i just don't get it. PS As a bonus, iterate has an actually usable manual [1]. For LOOP, i have to go to gigamonkeys and whatnot. [1] https://iterate.common-lisp.dev/doc/index.html#Top https://iterate.common-lisp.dev/doc/index.html#Top
- taeric 5y agoTo each their own. I'm a huge fan of LOOP. Is very easy to read, feeling much more natural to how I think about those sections of code.
- maydup-nem 5y agoYes, I was a fan of LOOP too, until I found iterate. I mean, we are discussing the two things comparatively here, aren't we? So, how is loop better than iterate? Iterate has nearly the same semanitcs as LOOP. It's basically LOOP on s-exprs, with some handy idioms sprinkled in. But often times the match is 1-1. So, how is the absence of sexprs making anything easiers to read or write? It makes it harder for me in both cases.
- taeric 5y agoI'll try iterate. For me it is just that loop is already very easy to read. Moving all things to s exprs doesn't seem like it would be that big of a deal. And I should say that the construct that I find easiest is the "then" clause. (Loop repeat 8 For a = 0 then b For b = 1 then c For c = 1 then (+ a b) Collect a) That just reads very easily to me. (Typed on phone...)
- maydup-nem 5y agoFirst of all, if you are going to try it out, I recommend using this macro: (defmacro itr (&rest rest) `(iterate:iterate ,@rest)) because it keeps all the clauses on the same indentation level. Now, to the translation: iterate has previous clause. https://iterate.common-lisp.dev/doc/Previous-Values-of-Driver-Variables.html https://iterate.common-lisp.dev/doc/Previous-Values-of-Drive... which may help translate the loop form you provided into this: (itr (repeat 8) (for a previous b initially 0) (for b previous c initially 1) (for c = (+ a b)) (collect a)) However, if you wanted that exact syntax, you could try: (defmacro-clause (FOR var = init-value THEN form) `(progn (with ,var = ,init-value) (after-each (setf ,var ,form)))) to get a direct translation: (itr (repeat 8) (for a = 0 then b) (for b = 1 then c) (for c = 1 then (+ a b)) (collect a)) > Moving all things to s exprs doesn't seem like it would be that big of a deal. One of the biggest things you will "miss" from LOOP is the do keyword. The control structures is just regular lisp code. Also, I found generators to be pretty handy (not often, but I am glad I had them when it was called for). I mean, it's not exactly groundbreaking, but it does make a difference especially that a looping construct is probably the heaviest-used macro. You can certainly get away with LOOP, but I see iterate as more or less how LOOP should've been done. I also recommend reading this short discussion in the manual https://iterate.common-lisp.dev/doc/Don_0027t-Loop-Iterate.html#Don_0027t-Loop-Iterate https://iterate.common-lisp.dev/doc/Don_0027t-Loop-Iterate.h...
- da39a3ee 5y agoWhy does this crazy macro exist for one part of the language but not others? It feels obviously out of place and gives you the feeling that you're using a legacy language with historical oddities rather than a coherently designed system.
- taeric 5y agoMe thinks you just haven't looked at more parts. FORMAT, in particular, is just as dense.
- maydup-nem 5y agoIs there an alternative to FORMAT?
- taeric 5y agoI mean. Not really, though I have seen folks make a herculean effort with print and friends.
- outworlder 5y ago> an awkward syntax And yet C likes get praise with their {[(;*&^| stuff...