Common Lispers, rejoice.  I've added a new "examples/sweet-run-demo-clisp" file 
to demonstrate how to use "sweet-run" so you can use sweet-expressions in 
Common Lisp, using only the components we have so far.

Because it uses unsweeten, which is a Scheme reader, you have to stick to the 
syntax that is in common between the two lisps.  That's not a fundamental limit 
of our approach, it's just a limitation of the current implementation.  Still, 
it works nicely for what it is.

Below is the Common Lisp demo.

--- David A. Wheeler

=====================================

#!/usr/bin/env sweet-run
;#!/usr/bin/env clisp

; NOTICE! The "unsweet" script expects Scheme-format lisp, but we
; are executing this in Common Lisp instead.  Thus, you need to stick
; to the syntax that is in common between the two lisps.

; This example is from "Lisp Script" by Gene Michael Stover
; http://cybertiggyr.com/gene/lscript/lscript.html
; Original version:
;   (defun fib (n)
;     (if (or (zerop n) (= 1 n))
;         1
;       (+ (fib (1- n)) (fib (- n 2)))))
;   (fib 10)


defun fib (n)
  if {zerop(n) or {1 = n}}
    1
    {fib{n - 1} + fib{n - 2}}

write-line "Clisp running!"

print fib(10)


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to