5 ms·
"Write programs that write programs" can someone elaborate on this?
by prezjordan 14y ago
"Write programs that write programs" can someone elaborate on this?
- leoh 14y agoLisp is very good at parsing language (i.e. all data, like computer programs, are read into lists and LISP is built around this functionality; this is one reason why it is very popular among AI researchers). Combine that with things like 'eval' statements and you can easily parse and execute an arbitrary computer language with LISP. Very, very cool stuff. EDIT: Here's a good explanation of why LISP is good at this sort of thing: http://jlongster.com/2012/02/18/its-not-about-macros-its-about-read.html http://jlongster.com/2012/02/18/its-not-about-macros-its-abo...
- ihodes 14y agoThis may refer to macros, which are essentially programs which write code to other programs before the code is compiled.
- tikhonj 14y agoThey probably mean something like macros and embedding DSLs. What they probably don't mean is any sort of non-trivial automatic programming--writing programs that, for example, search through possible ways to solve some particular programming problem in assembly. Which, amusingly, is the one thing I've been using lisp for lately, working on program synthesis. Of course, I would probably be a poor addition to this page because I would much rather use Haskell or OCaml. And because I'm using Racket rather than Common Lisp, which looks to be the theme of the page.
- pnathan 14y agoSome time ago I put together quarter-baked genetic algorithm tool in Common Lisp. It dynamically generated functions in an attempt to create a modelling function for a sequence of (x,y) pairs. Good functions would be recombined with other good functions to attempt to get better. It worked fairly well for the trivial stuff I was doing. Unfortunately, due to getting interrupted and put down for months, it's a mess. I should fix it up tomorrow since I'll have some free time. :-)
- prezjordan 14y agoDefinitely interested in seeing the source code for this
- pnathan 14y agohttps://bitbucket.org/pnathan/z-system/overview https://bitbucket.org/pnathan/z-system/overview
- evincarofautumn 14y agoThink of a programming language. It has some built-in data types, and it has so-called literals for each of those. The parser reads in some text and produces a value of some kind. In Lisp, the program itself is really one large "code literal", which happens to be run by the language environment. But there are plenty of other things you can do with programs besides just running them, and generating them is one of those things. Lisp merely provides handy facilities for performing these manipulations.
- ww520 14y agoCode generators.