emacs-devel
[Top][All Lists]
Advanced

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

Re: Distinguishing `consp` and `functionp`


From: Stefan Kangas
Subject: Re: Distinguishing `consp` and `functionp`
Date: Sun, 28 Jan 2024 12:55:06 -0800

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Currently on `master` it typically does not look like what you show
> above but like:
>
>     (closure ENV (x y) (message "%S" x) (+ x y))
> or
>     (closure ENV (x y) DOCSTRING (interactive IFORM) (message "%S" x) (+ x y))
>
> For `prin1` with my PoC it currently looks like:
>
>     #[(x y) ((message "%S" x) (+ x y)) ENV]
> or
>     #[(x y) ((message "%S" x) (+ x y)) ENV nil DOCSTRING IFORM]
>
> and I'd rather not try to be too clever about it (it should be fairly
> rare to use `prin1` on such things).  For `cl-print` we (and users) can
> choose, and I currently print it as

FWIW, I like one aspect of the print format in SBCL,

    * (setq x (lambda () 1 2 3))
    #<FUNCTION (LAMBDA ()) {70055901BB}>

namely that it explicitly says "function" rather than something like #f,
which is more cryptic (and looks a bit too much like #f in Scheme, but
that's just me perhaps).  It'd be a bit more verbose, of course.

> [ or #f(λ (x y) (message "%S" x) (+ x y)) 🙂 ]

I'm obviously in favor of including a smiley in the print format, but
only if the function makes you feel 🤗



reply via email to

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