home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
L2C-19.ZIP
/
DEMO.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1993-06-25
|
1KB
|
55 lines
(defun Qsort (lst / x l e g)
(if lst
(progn
(setq x (nth (/ (length lst) 2) lst)
l nil e nil g nil)
(while (not (null lst))
(cond ((= (car lst) x) (setq e (cons x e)))
((< (car lst) x) (setq l (cons (car lst) l)))
(t (setq g (cons (car lst) g)))
)
(setq lst (cdr lst))
)
(setq l (Qsort l)
g (Qsort g))
(append l e g)
)
nil
)
)
(defun c:stat ()
(mem)
)
(defun c:gc ()
(gc)
)
(defun c:interpreter ( / cmd num)
(princ "\nVoid input returns you to an AutoLISP.")
(initget 128)
(setq num 1)
(setq cmd (getpoint (strcat "\nCommand #" (itoa num) ": ")))
(while (and (equal (type cmd) 'STR)(not (equal cmd "")))
(print (eval (read cmd)))
(initget 128)
(setq num (1+ num)
cmd (getpoint (strcat "\nCommand #" (itoa num) ": ")))
)
(princ)
)
(defun S::l2cstartup ()
(princ "\nLisp2Cads *demo* file")
(princ "\nNew commands:")
(princ "\n INTERPRETER evaluates Lisp expressions")
(princ "\n GC invokes garbage collector")
(princ "\n STAT displays memory usage statistics")
(princ "\nNew function:")
(princ "\n (QSORT list) sorts list of elements in ascending order")
(princ "\n\nThis is S::L2CSTARTUP function, automatically invoked when")
(princ "\nan application is XLOADed.")
(princ "\nHave a nice day!")
)