texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] set-before! and set-after! or cons! and rcons!


From: david
Subject: Re: [Texmacs-dev] set-before! and set-after! or cons! and rcons!
Date: Wed, 5 Feb 2003 16:41:19 +0100
User-agent: Mutt/1.4i

On Wed, Feb 05, 2003 at 04:05:51PM +0100, Joris van der Hoeven wrote:
> I tried to search "cons!" on the web, but the ! is stripped automatically...

Indeed...

> In any case, I guess that cons! should return the same result as cons.

That makes sense, in the same way as append! and reverse!. But those
functions with side effect are generally meant to provide better
performance when the parameter can be altered.

In that sense, cons! does not make much sense, but rcons! does have an
obvious implementation:

(define (rcons! l x) (set-cdr! (last-pair l) (list x)))

But that is not what set-after! does...


> Otherwise, we might have to use the names set-cons! and set-rcons!.

Even though they looks too much like set-car! and set-cdr! I prefer
those names to cons! and rcons!. That follows the same naming
convention as append-map or and-let*, and as cons and rcons are
constructors (and not accessors like car and cdr) I see no other
obvious interpretation for those names.

Let us rename 'set-before!' as 'set-cons!' and 'set-after!' as
'set-rcons!'.




reply via email to

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