CrashTECH wrote:
Gadget wrote:
CrashTECH wrote:
You and that Lisp of yours... I swear...
Haha... =)
You should check out Practical Common Lisp -- there is a free version online. It contains some pretty cool projects, plus you'll develop a deeper appreciation for some of the evolutionary changes in programming languages.
I used Lisp in my AI class, and I'd rather not revisit those dark times... lol
That's actually one of the biggest stumbling blocks to Lisp advocacy. Lisp shouldn't be synonymous with AI -- It should be synonymous with a language that is well equipped for solving difficult problems.
Unless things have changed, Berkeley has their undergrads spend one class learning C, one class learning Java and one class learning Lisp. In the C course, they learn concepts largely related to C, OOP during the Java class, and language abstraction during the Lisp course. To really appreciate a language, you need to spend at least a month using it (unless it happens to be a toy language like Logo). The problem is that everyone seems to get a half-arse one week introduction to Lisp during their AI class (my AI teacher was a horrible Lisp instructor), when they should really be learning AI. No one ever develops an appreciation for the power and expressiveness of Lisp. I wish SICP was required viewing for all US households with a computer system!
For example... how many lines of code would it take to write a C# interpretor in C#? Here is a functional, albeit barebones, Lisp interpretor written in Lisp.
Code:
CL-USER> (dotimes (i 3) ;I just had it loop three times bc I'm working in my Lisp environment at the moment... easier to delete. =)
(princ "> ")
(format t "~a~%" (eval (read))))
> (+ 1 2 3 4)
10
> (setf arr (make-array '(4 4)))
#2A((NIL NIL NIL NIL) (NIL NIL NIL NIL) (NIL NIL NIL NIL) (NIL NIL NIL NIL))
> (remove-if-not #'evenp '(1 2 3 4 5 6))
(2 4 6)
NIL
CL-USER>
How easy is it to add new language features to either C# or Java? For example, let's say that you've fallen in love with Perl's until loop. Could you add it to C#? Not really... unless you are willing to do the dirty work of creating your own parser and compiler, right? In lisp, this is fairly trivial...
Code:
;;until loop -- taken from the CL wikipedia article, but I think it may
;;also appear in On Lisp
(defmacro until (test &body body)
`(do ()
(,test)
,@body))
;example usage...
(until (learns 'CrashTech 'Lisp)
(print "hello?!"))
Just kidding about that last example... =)