Click to See Complete Forum and Search --> : What do y'all think if Common LISP (and/or Scheme)


jemfinch
12-05-2000, 05:57 AM
I've been looking into it. Currently, Python is my favorite and preferred language. From what I see, I don't see it losing that seat to LISP or Scheme, but I may not have seen enough. What does everyone else think of these two languages?

Jeremy

YaRness
12-05-2000, 09:32 AM
is lisp the one where everything is a list, and the end of programs look like ))))))))))))))))))), or is that prolog?

either way, lisp is designed for a fairly specific type of programming (if i could just remember which damn language it is), i dunnno about scheme, but i thought python was supposed to be yet another scripting language.

------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
------------------

BrianDrozd
12-05-2000, 09:45 AM
LISP and Scheme are basically the same language. (Scheme has more predefined functions, I beleive, but one could write them for LISP easily enough.) They are frequently used in Artificial Intelligence programming, as it is somewhat easier to write, for example, a natural language parser in LISP than C. LISP/Scheme are not scripting languages. Instead, you give LISP/Scheme a starting state and a set of rules it can follow to make transformation in the state and then give it a goal state. LISP then applys the rules to the start state until it reaches the goal state.

kmj
12-05-2000, 10:44 AM
yeah. what they said http://www.linuxnewbie.org/ubb/smile.gif

It's fun to play with, but unless you're really doing some kind of AI, it isn't going to be your first choice.

tminos
12-05-2000, 11:50 AM
Lisp is supposed to be a great language for AI (aside from its horrible name). I haven't done much with it, but I do know that Emacs was written in Lisp... (a text editor with an AI?) Lisp does use lots (and I mean (lots)) of those (()) parenthases thingies (did I speel that? (right))

Strike
12-05-2000, 01:26 PM
Ha, I was going to say just about the same thing YaRness said about the parentheses being really annoying. It's great for some purposes (purely functional language applications), but I haven't learned it well enough to use it for things like that. It's a very different language paradigm.

Just for fun though, here's a Scheme program that I wrote last year to solve "The Queens Problem" (on a nxn chess board, you have n queens - list all possible combinations of positions so that none of the queens is attacking any other queen):

(define legal?
(lambda (try legal-pl)
(letrec
((good?
(lambda (new-pl up down)
(cond
((null? new-pl) #t)
(else (let ((next-pos (car new-pl)))
(and
(not (= next-pos try))
(not (= next-pos up))
(not (= next-pos down))
(good? (cdr new-pl)
(add1 up)
(sub1 down)))))))))
(good? legal-pl (add1 try) (sub1 try)))))

(define solution?
(lambda (legal-pl boardsize)
(= (length legal-pl) boardsize)))

(define build-solution
(lambda (legal-pl boardsize)
(cond
((solution? legal-pl boardsize) legal-pl)
(else (forward boardsize legal-pl boardsize)))))
(define forward
(lambda (try legal-pl boardsize)
(cond
((zero? try) (backtrack legal-pl boardsize))
((legal? try legal-pl) (build-solution (cons try legal-pl) boardsize))
(else (forward (sub1 try) legal-pl boardsize)))))

(define backtrack
(lambda (legal-pl boardsize)
(cond
((null? legal-pl) '())
(else (forward (sub1 (car legal-pl)) (cdr legal-pl) boardsize)))))

(define build-all-solutions
(lambda (boardsize)
(letrec
((loop (lambda (sol)
(cond
((null? sol) '())
(else (cons sol (loop (backtrack sol boardsize))))))))
(loop (build-solution '() boardsize)))))

(define queens
(lambda (n)
(build-all-solutions n)))

Load that puppy into your Scheme interpreter and then just run [b](queens n)[/n] (where n is as defined in the problem.

toolie
12-05-2000, 02:15 PM
LISP == Lots of Insipid Silly Parenthesis.

LISP is kinda cool, but only in limited areas. We use it in one of our simulations here for the AI part.

klamath
12-05-2000, 07:19 PM
Another similar question - Of all the LISP variants (Lisp, eLisp, Scheme, Guile (?), etc), which is the best to learn?

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Better Bulletin Board (http://bbb.sourceforge.net)

jemfinch
12-06-2000, 02:13 AM
Ok, there are a few factual errors I'd like to correct (from my knowledge; if I'm wrong and don't know it, tell me.)


is lisp the one where everything is a list, and the end of programs look like ))))))))))))))))))), or is that prolog?


Yeah, that's LISP. Prolog is much more different (normal) looking.


either way, lisp is designed for a fairly specific type of programming (if i could just remember which damn language it is), i dunnno about scheme, but i thought python was supposed to be yet another scripting language.


LISP, actually, from what I read, seems to be very good at AI, but still useful for other tasks. Prolog, which you may have been thinking of, seems to be useful only for logic programming/AI.

Scheme is a smaller Common LISP (ie, the Common LISP specification is 1300 pages long; the Scheme spec is only 50 pages). It's still very similar in

Yeah, that's LISP. Prolog is much more different (normal) looking.


LISP and Scheme are basically the same language. (Scheme has more predefined functions, I beleive, but one could write them for LISP easily enough.)


Actually, just switch that and you're right http://www.linuxnewbie.org/ubb/smile.gif LISP has far more predefined functions/macros than Scheme.


Instead, you give LISP/Scheme a starting state and a set of rules it can follow to make transformation in the state and then give it a goal state. LISP then applys the rules to the start state until it reaches the goal state.


I've not seen this in anything I've read...can you expound on it, or point me somewhere that can?


Another similar question - Of all the LISP variants (Lisp, eLisp, Scheme, Guile (?), etc), which is the best to learn?


I've found the most information on the internet about Common LISP and Scheme. I would suggest one of those two; those who know both have said that Common LISP is more useful. The problem, of course, is that Common LISP is much larger. Compare the size of the CL spec vs. the Scheme spec.

Guile is an implementation of Scheme, much like JPython is an implementation of Python, or gcc is an implementation of a C compiler.

elisp is useful mostly if you're using emacs, and not useful for much else (since emacs is the interpreter)

Strike: Where did you learn scheme? I'm looking for more resources.

Jeremy

Strike
12-06-2000, 03:20 AM
jemfinch - believe it or not, it's a requirement of CS majors here http://www.linuxnewbie.org/ubb/eek.gif We had to take a "Principles of Functional Languages" course, and that was the chosen language. Here is a course page (http://WWW.CS.Trinity.Edu/~meggen/Classes/2322/) (get it while it's still up). This isn't the instructor I had, though this one (that I am linking above) is probably my favorite CS professor so far -- great lectures, great content. When I get home for the holidays, if I remember (or this topic is still near the top) I will post the name of the book we used (that problem above is mostly solved in the book and is what I based my solution on).

jemfinch
12-06-2000, 04:13 AM
/me is probably going to buy this book:
http://www.amazon.com/exec/obidos/ISBN=0262011530/martyhallsrecomm/002-3286742-3755209

Jeremy

Strike
12-06-2000, 11:01 AM
Ah, that reminded me of the name of the book we used - "Scheme and the Art of Programming" by Springer and Friedman. But, Amazon says it's out of print.