LispMe > Common Lisp

work in progress

(testé dans SBCL)


;; lispme.lisp
;; lispme to commonlisp
;; interprete a la louche le dialect LispMe dans common-lisp
;; to make more usefull my little palmOS machines
;; fv 2008

;(defpackage :lispme)

;(in-package "LISPME")

(defmacro define (args body)
(let ((name (car args))
(argh (cdr args)))
(if (fboundp name)
(if (equalp "COMMON-LISP" (package-name (symbol-package name)))
(format t "lispme.lisp: ignore la fonction ~S (existe deja)~&" name)
`(defun ,name ,argh ,body))
`(defun ,name ,argh ,body))))

#|
(define (toto argh) (print argh))
(toto "Hello world !")
(define (elt seq i) (nth i seq))
|#

(defmacro set! (name body)
`(setf ,name ,body))

(defun list-ref (alist n)
(nth n alist))

(defun set-cdr! (liste arg)
(setf (cdr liste) arg))

(defun null? (arg)
(null arg))

(defun eq? (a b)
(eql a b))

(defun display (arg &optional (stream nil))
(when (not stream) (setf stream t))
(format stream "~S " arg))

(defun begin (&rest args)
(progn args))

(defun even? (int)
(evenp int))

(defun odd? (int)
(oddp int))