emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: What's missing in ELisp that makes people want to u


From: Drew Adams
Subject: RE: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?
Date: Sun, 12 Nov 2023 22:43:06 +0000

> I expect it to have a substantial manual

I already pointed you to "The Iterate Manual":

https://iterate.common-lisp.dev/iterate-manual.pdf

Judge for yourself whether you consider it "substantial".

Appendix A of the manual was also published as a paper, "Don't Loop, Iterate".  
From Appendix A's intro:

"But all’s not joy in Consville. For—I beg your pardon, but—there really is no 
good way to _iterate_ in Lisp. Now, some are happy to map their way about, 
whether for real with `mapcar' and friends, or with the make-believe of Series; 
others are so satisfied with `do' it’s a wonder they’re not C hackers. Still 
others have gotten by with `loop', but are getting tired of looking up the 
syntax in the manual over and over again. And in the elegant schemes of some, 
only tail recursion and lambdas figure. But that still leaves a sizeable 
majority of folk—well, me, at least—who would simply like to _iterate_, thank 
you, but in a way that provides nice abstractions, is extensible, and looks 
like honest-to-God Lisp.

In what follows I describe a macro package, called `iterate', that provides the 
power and convenient abstractions of `loop' but in a more syntactically 
palatable way. `iter' also has many features that `loop' lacks, like generators 
and better support for nested loops. `iterate' generates inline code, so it’s 
more efficient than using the higher-order function approach. And `iterate' is 
also extensible—it’s easy to add new clauses to its vocabulary in order to 
express new patterns of iteration in a convenient way.

A Common Lisp programmer who wonders what’s lacking with present-day iteration 
features would do well to consider `setf'. Of course, `setf' doesn’t iterate, 
but it has some other nice properties. It’s easy to use, for one thing. It’s 
extensible—you can define new `setf' methods very easily, so that `setf' will 
work with new forms. `setf' is also efficient, turning into code that’s as good 
as anyone could write by hand. Arguably, `setf' provides a nice abstraction: it 
allows you to view value-returning forms, like `(car ...)' or `(get ...)' as 
locations that can be stored into. Finally and most obviously, `setf' _looks_ 
like Lisp; it’s got a syntax right out of `setq'.

`iterate' attempts to provide all of these properties..."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]