unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why is `pop' not named `npop'?
@ 2024-01-16  4:28 mbork
  2024-01-16  5:07 ` Po Lu
  2024-01-16  6:25 ` Philip Kaludercic
  0 siblings, 2 replies; 5+ messages in thread
From: mbork @ 2024-01-16  4:28 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

the `pop' macro is destructive.  Why isn't it called `npop' then?  My
wild guess is that the `n-' prefix is only used for functions, not
macros, but is that really true?

Best,

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is `pop' not named `npop'?
  2024-01-16  4:28 Why is `pop' not named `npop'? mbork
@ 2024-01-16  5:07 ` Po Lu
  2024-01-16  6:25 ` Philip Kaludercic
  1 sibling, 0 replies; 5+ messages in thread
From: Po Lu @ 2024-01-16  5:07 UTC (permalink / raw)
  To: mbork; +Cc: Help Gnu Emacs mailing list

mbork@mbork.pl writes:

> Hi all,
>
> the `pop' macro is destructive.  Why isn't it called `npop' then?  My
> wild guess is that the `n-' prefix is only used for functions, not
> macros, but is that really true?
>
> Best,

If I were to guess, because `pop' does not modify the list itself, only
the value of the GV.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is `pop' not named `npop'?
  2024-01-16  4:28 Why is `pop' not named `npop'? mbork
  2024-01-16  5:07 ` Po Lu
@ 2024-01-16  6:25 ` Philip Kaludercic
  2024-01-17  1:54   ` Emanuel Berg
  1 sibling, 1 reply; 5+ messages in thread
From: Philip Kaludercic @ 2024-01-16  6:25 UTC (permalink / raw)
  To: mbork; +Cc: Help Gnu Emacs mailing list

mbork@mbork.pl writes:

> Hi all,
>
> the `pop' macro is destructive.  Why isn't it called `npop' then?  My
> wild guess is that the `n-' prefix is only used for functions, not
> macros, but is that really true?

Not every name is consistent, but there is also no need for a
non-destructive pop since we already have car.

> Best,



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is `pop' not named `npop'?
  2024-01-16  6:25 ` Philip Kaludercic
@ 2024-01-17  1:54   ` Emanuel Berg
  2024-01-17 11:13     ` Yuri Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2024-01-17  1:54 UTC (permalink / raw)
  To: help-gnu-emacs

Philip Kaludercic wrote:

>> the `pop' macro is destructive. Why isn't it called `npop'
>> then? [...]
>
> Not every name is consistent

They sure ain't.

And "n" can also be for "not", e.g. `nlistp'.

So not pop, what would that be? Rock?

> but there is also no need for a non-destructive pop since we
> already have car.

But shouldn't `pop' be called "ncar" then?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is `pop' not named `npop'?
  2024-01-17  1:54   ` Emanuel Berg
@ 2024-01-17 11:13     ` Yuri Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Yuri Khan @ 2024-01-17 11:13 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 17 Jan 2024 at 17:53, Emanuel Berg <incal@dataswamp.org> wrote:

> >> the `pop' macro is destructive. Why isn't it called `npop'
> >> then? [...]

> > but there is also no need for a non-destructive pop since we
> > already have car.
>
> But shouldn't `pop' be called "ncar" then?

The ‘n’ in ‘nreverse’ and other destructive functions is said to mean
‘non-consing’, that is, they won’t allocate new cons cells but rather
modify what is already there to achieve the desired structure. The
focus is not on destructiveness, it is on the lack of pressure on the
allocator.

‘car’ is already as non-consing as it gets.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-17 11:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16  4:28 Why is `pop' not named `npop'? mbork
2024-01-16  5:07 ` Po Lu
2024-01-16  6:25 ` Philip Kaludercic
2024-01-17  1:54   ` Emanuel Berg
2024-01-17 11:13     ` Yuri Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).