Hacker News new | past | comments | ask | show | jobs | submit login

> In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

> (defalias 'plus #'+)

> (defalias 'quotient #'/)

> (defalias 'times #'*)*

> (defalias 'difference #'-)*

Looks like we also need a defmacro for def that is used much further in the article:

> > (def rac (lambda (lyst) (car (reverse lyst))))

I mean the above example fails in Emacs:

  ELISP> (def rac (lambda (lyst) (car (reverse lyst))))
  *** Eval error ***  Symbol’s function definition is void: def
If we want the above example to work, we need to define def like this:

  ELISP> (defmacro def (name lambda-def) `(defalias ',name ,lambda-def))
  def
Now the previous example, as presented in the article, works fine:

  ELISP> (def rac (lambda (lyst) (car (reverse lyst))))
  rac
  ELISP> (rac '(your brains)) 
  brains



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: