Re: Reasons to choose CLISP over other free implementations



Pascal Costanza <pc@xxxxxxxxx> writes:

Nicolas Neuss wrote:

(?2 is a macro choosing the second argument, LRET returns the last
local variable)

Hm, these look like very useful macros to me! Nice.

Pascal

Thanks:-)

Since we have so many newbies, here is the complete code:

(defmacro ?1 (&rest args)
"A macro extracting the first of its arguments."
(first args))
(defmacro ?2 (&rest args)
"A macro extracting the second of its arguments."
(second args))
(defmacro ?3 (&rest args)
"A macro extracting the third of its arguments."
(third args))


(defmacro lret (bindings &body body)
"A @macro{let}-construct which returns its last binding."
`(let
,bindings ,@body
,(let ((x (car (last bindings))))
(if (atom x)
x
(car x)))))

(defmacro lret* (bindings &body body)
"A @macro{let*}-construct which returns its last binding."
`(let*
,bindings ,@body
,(let ((x (car (last bindings))))
(if (atom x)
x
(car x)))))

Nicolas
.



Relevant Pages

  • Re: make-instance wrapper
    ... Cortez wrote: ... A macro is a function that gets code and creates code. ... (defmacro new (class &rest args) ...
    (comp.lang.lisp)
  • Re: defmacro
    ... (defmacro doloop (vars &body body) ... To write a macro, ...
    (comp.lang.lisp)
  • Re: off-topic: open challenge to Christian Lynbeck
    ... By modifying Brian Mastenbrook's version, ... effective because each call to planetpv only accesses one column ... macro to do what I want; to make it work, I also wrapped the most of ... (defmacro defconstant (&rest args) ...
    (comp.programming)
  • Re: off-topic: open challenge to Christian Lynbeck
    ... By modifying Brian Mastenbrook's version, ... effective because each call to planetpv only accesses one column ... macro to do what I want; to make it work, I also wrapped the most of ... (defmacro defconstant (&rest args) ...
    (comp.lang.lisp)
  • Re: off-topic: open challenge to Christian Lynbeck
    ... By modifying Brian Mastenbrook's version, ... effective because each call to planetpv only accesses one column ... macro to do what I want; to make it work, I also wrapped the most of ... (defmacro defconstant (&rest args) ...
    (comp.lang.fortran)