mk wrote:
> Is there a way to create something like alias in lisp.
You could define either functions or macros.
> the goal is to use my own language for anything in lisp.
Use functions, or if you want your arguments to not be evaluated, macros.
--
My ideal for the future is to develop a filesystem remote interface
(a la Plan 9) and then have it implemented across the Internet as
the standard rather than HTML. That would be ultimate cool.
Ken Thompson
On Tue, 06 Sep 2005 13:25:12 +0200, Ulrich Hobelmann wrote:
> mk wrote:
>> Is there a way to create something like alias in lisp.
>
> You could define either functions or macros.
>
>> the goal is to use my own language for anything in lisp.
>
> Use functions, or if you want your arguments to not be evaluated, macros.
Why introduce the extra overhead?
(setf (macro-function 'дефун) (macro-function 'defun))
or
(setf (symbol-function 'blub) (symbol-function 'format))
NOTE: this won't work for things like 'let (which can
be neither macro nor function).
Cheers Ralf Mattes
(defmacro alias (name al)
`(defmacro ,al (&rest rest)
`(,',name ,@rest)))
should work. It makes
(alias defun дефун)
expand into
(defmacro дефун (&rest rest)
(defun ,@rest))
Not only do you not need quotes, it also works for (let...)!
··········@gmail.com writes:
> (defmacro alias (name al)
> `(defmacro ,al (&rest rest)
> `(,',name ,@rest)))
>
> should work. It makes
There is a problem here: if you make an alias for a function in such
way, you cannot use it as argument for funcall, apply and others.
--
Best regards
Nickolay Savchenko
"R. Mattes" <··@mh-freiburg.de> writes:
> On Tue, 06 Sep 2005 13:25:12 +0200, Ulrich Hobelmann wrote:
>
> > mk wrote:
> >> Is there a way to create something like alias in lisp.
> >
> > You could define either functions or macros.
> >
> >> the goal is to use my own language for anything in lisp.
> >
> > Use functions, or if you want your arguments to not be evaluated, macros.
>
> Why introduce the extra overhead?
Because it's nice to do the right thing when the aliased
function/macro is redefined. This is closer to right:
(defmacro alias (alias name)
(if (macro-function name)
`(defmacro ,alias (&rest args)
(cons ',name args))
`(progn
(defun ,alias (&rest args)
(apply ',name args))
(define-compiler-macro ,alias (&rest args)
(cons ',name args)))))
--
/|_ .-----------------------.
,' .\ / | Free Mumia Abu-Jamal! |
,--' _,' | Abolish the racist |
/ / | death penalty! |
( -. | `-----------------------'
| ) |
(`-. '--.)
`. )----'