dcooper8@alien.topBtoLisp•Feeling like I've never quite broken through with Common Lisp.English
1·
1 year agoTry dolist, dotimes, and do, before resorting to loop.
I’ve been coding in CL for 33 years, still learning every day, and maintain this codebase:
https://gitlab.common-lisp.net/gendl/gendl
I doubt you’ll find any use of loop in there.
Regarding “linked list” structures and performance — if you feel your application has bottlenecks due to use of list, try confirming that by learning and using your implementation’s profiling tools, then replace with arrays, hash tables, etc where applicable.
Lazily evaluated structures are available in libraries and can be built for CL where needed (e.g. the sequences in above gendl library).
Well, for whatever reason, I’d never really learned loop, then I read Paul Graham’s ANSI Common Lisp where he says “for [reasons] the use of loop cannot be recommended,” and henceforth have used that as an excuse for myself never to learn it up to this day.
“What is so good about lisp” – well first of all I’m not sure exactly what or whom you’re replying to here - I don’t see where my original comment mentioned anything about Lisp being “so good” or whatever kind of straw man you are attempting to assemble here. But since you’ve asked: if you were to press me to justify my choice of Common Lisp for gendl, I would say I first came for the legacy codebases. I happened to know of legacy industrial codebases (still relying on a Gendl-like system from the 1980s) where i felt we could add value. Switching them to an entirely different underlying language infrastructure would not, in my estimation, have added value (at least not within my capabilities). So that’s what brought me in. But then i stayed with CL for:
Ths above items are justifications, but I think what really keeps me working in CL is more the subjective feeling of the whole environment — the interactive redefinition and test cycle, image-based development where you can fire up an image with everything loaded and “ready to go,” built-in debuggers, profilers, macroexpanders, introspectors, editor servers so you can slime into your running server to test, profile, debug, and hotpatch in-place. Stuff like that.