Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all, in combination with LISP I found quite a few times comments like "LISP is good for AI, as functions can be built up at dynamically because the program itself is a list". However, I'm not sure about such statements; AFAIK, these would either require the use of (eval ...) or (non-hygienic) macros in Scheme, would they not? And I think those two are seen as bad practice, right? So what do you think about such statements, are they true for Scheme, didn't I get the point, are they "outdated" or simply nonesense? Or are there any other reasons why LISP/Scheme is exceptionally well suited for AI? Thanks, Daniel -- Done: Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal Underway: Ran-Gno-Neu-Fem To go: Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou
Post Follow-up to this messageDaniel Kraft <d@domob.eu> writes: > Hi all, > > in combination with LISP I found quite a few times comments like "LISP > is good for AI, as functions can be built up at dynamically because > the program itself is a list". > > However, I'm not sure about such statements; AFAIK, these would either > require the use of (eval ...) or (non-hygienic) macros in Scheme, > would they not? And I think those two are seen as bad practice, > right? I think the author is referring to macros --- code that writes transforms code, often referred to as a "program that writes a program." > So what do you think about such statements, are they true for Scheme, > didn't I get the point, are they "outdated" or simply nonesense? Or > are there any other reasons why LISP/Scheme is exceptionally well > suited for AI? One reason for the persistence of this idea is that Lisp was originally developed by John McCarthy and used in AI Research, connected with the misconception that Lisp is used for nothing else. (a) You'd be surprised to know some of the things that Lisp is used for, (b) Paul Graham says that Lisp turns itself into a programming language that's good for whatever you want it to do, and (c) companies and projects that do use Lisp do not widely publicize it in certain cases. I'm using Scheme to write a population simulation program that will simulate stochastic and time-dependent population parameters; every day I feel like Graham's statement is coming true more and more. Simulations are usually written in C, Mathematica or Matlab, or more recently Python. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109
Post Follow-up to this message>> However, I'm not sure about such statements; AFAIK, these would either > > I think the author is referring to macros --- code that writes > transforms code, often referred to as a "program that writes a program." Ah, might be (while my first understanding was more towards the eval-idea). > > One reason for the persistence of this idea is that Lisp was originally > developed by John McCarthy and used in AI Research, connected with the > misconception that Lisp is used for nothing else. (a) You'd be surprised to > know some of the things that Lisp is used for, (b) Paul Graham says that > Lisp turns itself into a programming language that's good for whatever > you want it to do, and (c) companies and projects that do use Lisp do > not widely publicize it in certain cases. > > I'm using Scheme to write a population simulation program that will > simulate stochastic and time-dependent population parameters; every day > I feel like Graham's statement is coming true more and more. > Simulations are usually written in C, Mathematica or Matlab, or more > recently Python. Well, yes, I used Scheme mainly for small "toy" programs so far (otherwise mostly C++), but I really like the language, both because of the general design and because functional programming is refreshingly different from what I did before. Daniel -- Done: Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal Underway: Ran-Gno-Neu-Fem To go: Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou
Post Follow-up to this messageDaniel Kraft wrote: > in combination with LISP I found quite a few times comments like "LISP > is good for AI, as functions can be built up at dynamically because the > program itself is a list". It would be more accurate to say "Scheme is good for AI, as procedures can be created dynamically because lambda expressions evaluate to procedures, not to lists." The comments that identify lists with functions are a legacy of dynamic scoping, which created the funarg problems that plagued most dialects of Lisp until the debut of Scheme in 1975. That is not to say there is no role for eval, or for the representation of eval'ed expressions as lists, but modern higher-order languages create procedures dynamically without using lists or eval. Some people's preference for lists and symbols over pattern languages and identifiers in macro systems may be related to the historical glorification of lists and eval for their role in simulating dynamic creation of procedures in dynamically scoped Lisps, but any such relationship would represent nothing more than the usual popularity of sloppy thinking. Will
Post Follow-up to this messageThis thread broaches on your thoughts about how folks generate code in Scheme: http://groups.google.com/group/plt-...48149e9330e5809
Post Follow-up to this messageWilliam D Clinger <cesura17@yahoo.com> writes: > Daniel Kraft wrote: [...] > Some people's preference for lists and symbols over > pattern languages and identifiers in macro systems > may be related to the historical glorification of > lists and eval for their role in simulating dynamic > creation of procedures in dynamically scoped Lisps, > but any such relationship would represent nothing > more than the usual popularity of sloppy thinking. So, do macro definitions return lists? (those lists being lisp forms) Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109
Post Follow-up to this messageJoel J Adamson asked: > So, do macro definitions return lists? (those lists being lisp forms) In portable RnRS code (where n is one of 2, 3, 4, 5, or 6), whether macro definitions return lists is not observable. The argument to eval is usually a list, but that list is then run through a macro expander and the result of that expansion is executed without giving user code any opportunity to examine that intermediate result. Will
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.