emacs-devel
[Top][All Lists]
Advanced

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

Re: cond*


From: Richard Stallman
Subject: Re: cond*
Date: Fri, 02 Feb 2024 22:36:15 -0500

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > (let ((list-of-three '(1 2)))
  >   (cond* ((match* `(,x ,y ,z) list-of-three))
  >          ((< 2 (+ x y z))
  >           'success))) ; => (wrong-type-argument number-or-marker-p nil)

That is not exactly a bug, but it is an unclarity in the design.

The match* condition fails, but since it is a non-exit clause, that
failure doesn't affect anything -- it goes ahead an executes the next
clause.  Arguably it is doing exactly what your code said.

But it raises the question of what a non-exit match* clause should do
when it does not match.  What do you think it should do?

The idea that occurs to me is this: bind all those variables,
initializing by matching those that can match, and initializing the
rest to nil.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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