loudthings
Feb 9 2005, 02:48 AM
| | I would like this topic to be a place where information about these two languages can be shared. LISP is a conceptual beautiful list based language. It is the language used to teach structure and interpretation of computer programs at UC Berkeley and is the language used to write the infamous chess-playing Deep Blue. |
Reply
loudthings
Feb 9 2005, 02:53 AM
I have implemented the basic Scheme primitive procedures as well as some of the most useful higher-order procedures in JavaScript. They are as follows: /* Scheme implementation in JavaScript */ function cons(e1, e2) { return function(msg) { if (msg == 0) return e1; else return e2; } } function car(aPair) { return aPair(0); } function cdr(aPair) { return aPair(1); } function list() { var theList = cons(arguments[arguments.length - 1], null); var c = 2; while (c <= arguments.length) { theList = cons(arguments[arguments.length - c], theList); ++c; } return theList; } function length(lst) { var c = 0; while (lst != null) { lst = cdr(lst); ++c; } return c; } function item(pos, lst) { var c = pos; while (c != 0) { lst = cdr(lst); --c; } return car(lst); } function append(lst1, lst2) { var c = length(lst1) - 1; while (c >= 0) { lst2 = cons(item(c, lst1), lst2); --c; } return lst2; } function map(func, lst) { var c = length(lst) - 1; theList = cons(func(item(c, lst)), null); --c; while (c >= 0) { theList = cons(func(item(c, lst)), theList); --c; } return theList; } function filter(pred, lst) { var c = length(lst) - 1; theList = null; while (c >= 0) { if (pred(item(c, lst)) != false) theList = cons(item(c, lst), theList); --c; } return theList; } function accumulate(func, initial, lst) { if (lst == null) return initial; else return func(car(lst), accumulate(func, initial, cdr(lst))); } function position(e, lst) { if (e == car(lst)) return 0; else return 1 + position(e, cdr(lst)); } function isAtom(x) { return typeof x == "string" || typeof x == "number" || typeof x == "boolean"; } function not(x) { if (x == false) return true; else return false; } function isPair(x) { return not(isAtom(x)); } function flatten(lst) { if (lst == null) return null; else { if (isPair(car(lst))) return append(flatten(car(lst)), flatten(cdr(lst))); else return cons(car(lst), flatten(cdr(lst))); } } I have tested all the procedures, though not thoroughly, and they appear to work. This allows Scheme to be easily used for interesting web programs. Please feel free to add to these, report bugs, and post fixes. Contact me at tberg@berkeley.edu
Reply
loudthings
Feb 9 2005, 03:22 AM
I am writing, using the scheme implementation in JavaScript that I posted earlier, a program that is a performance artwork. It is based on the digital artwork Galapagoes. Yet instead of evolving images, it evolves poems using user preference as natural selection. And instead of being in a galary somewhere it will be posted on the web so that many users can access it. It works be generating six poems by randomly picking words from a word bank. These initial poems are pretty much incoherent. Then the user picks the two of these poems that he or she likes best (likely the most coherent of these six). then the program takes a sort of numerical dna that encode the positions of the words in the two poems in the word bank. These two dna sequences are combined and slightly mutated, in effect creating an offspring of the two that has traits of each. The reproduction process is sufficiently random and variably that many offspring can be produced that are all different, but all have traits of the parent poems. The two poems are reproduced six times to create six new poems, the next generation. Then the user picks two from this generation, and the process continues. As this goes on, with many different user's input, each picking up with the last generation created by the last user, a sort of evolution occurs in the poems. They get more and more coherent and more and more interesting. User input in preference is the element of natural selection in the evolution. I hope to have the work up on a website soon. Im still working on the php to be able to record the last generation, so a new user can pick up the process where the last left off. I will post the URL of the website as soon as it is running.
Reply
miCRoSCoPiC^eaRthLinG
Feb 9 2005, 02:42 PM
Hey nice post  Do you have the original Scheme or Lisp code or both ? If so, can you please post them here ?? Thanks
Reply
loudthings
Feb 13 2005, 12:47 AM
QUOTE(microscopic^earthling @ Feb 9 2005, 07:42 AM) Hey nice post  Do you have the original Scheme or Lisp code or both ? If so, can you please post them here ?? Thanks thanks, man. which original code do you mean? for the implementation of the languages? i have a metalinguistic implementation of a scheme interpretter (i. e. written in scheme). or do you mean for my project? i will post both! let me go get them.
Reply
miCRoSCoPiC^eaRthLinG
Feb 19 2005, 04:57 PM
QUOTE(loudthings @ Feb 13 2005, 07:47 AM) thanks, man. which original code do you mean? for the implementation of the languages? i have a metalinguistic implementation of a scheme interpretter (i. e. written in scheme). or do you mean for my project? i will post both! let me go get them. Kinda...I meant the scheme/lisp versions of this code... I'm trying to pick up a little of lisp mysqlf - and I know a fair bit of javascript - so if I you could possibly post the lisp code in here - I'll be able to compare the syntax and make life a little easier for myself  Thanks all the same...
Reply
overture
Feb 19 2005, 05:17 PM
cool Loudthings. I am gonna be learning lisp in the future due to my college work. We have a new unit called Expert Systems (Artificial Intelligence) and were are supposed to be programming our own little AI program when we learn enough. It all seems very interesting to me.
Reply
KazDoran
Jun 26 2006, 12:55 PM
After finishing my AI project, and having used Scheme as the language in another AI-related project, here's my thoughts: Both Scheme and LISP are very powerful languages, as they allow for simple manipulation of data by hiding most of type verification. Both languages earn a thumbs-up for allowing easy definition of abstract data-types. LISP has the advantage to allow some degree of OO programming through it's implementation of classes. It also allows to define structures in their own manner, creating the constructor and accessors automatically, which is definitely a plus. The "everything is a list" point of view of both these languages can be at any time very useful, or very annoying, but it's nothing going against these languages. Scheme, at a first glance, looks like a simplified version of LISP, by using the "define" form for (nearly) every declaration, as opposed to LISP, which uses a different form for different data types: "defun", "defvar", "defconst", etc... LISP has the advantage (to some, a disadvantage) of allowing the same name to be used for several data types. You can define a function called "x" and then assign a value to x, and still use the function. As for debugging, I found Scheme simpler to debug than LISP using the default options (I used Dr. Scheme to code in Scheme and Allegro, connected to Emacs through Slime, to code in LISP). Scheme gives away a very graphical debug info, with arrows pointing to where a function was called, or conflicts between names and/or arguments, as LISP only splattered about the steps in plain text mode, most often showing info about the internal procedures it uses to run our higher level code. My two cents on this!
Reply
mitchellmckain
Aug 8 2006, 11:10 PM
I recently wrote an introduction to Emacs lisp for the tutorial section. I use emacs lisp all the time for quick calculations and to analyze charts of data which I download from the internet. My relativity and space simulator relspace accepts many data formats but I often found it necessary to calculate estimates for missing data on all kinds astronomical objects so they could be included in my program. Nothing beats emacs for a quick and easy way of accomplishing this if you just have a little knowledge of how to program in lisp.
Reply
Similar Topics
Keywords : scheme, lisp, dicussion, languages
- What Language Is That?
A guide to the most common web languages. (16)
If Programming Languages Were Cars...
(4) This is a very funny article about computer languages being like cars:
http://www.cs.caltech.edu/~mvanier/hacking/rants/cars.html ....
Unfair Evaluation Scheme
(3) After days & nights of hard work, I gave our semester ending Module Test #3. The syllabus comprised
of two books of C# .NET which covered Console & GUI based application development. I must say that I
was very well prepared, expecting to get the perfect 100 that has always eluded me in the past. All
our exams are online based where the questions comprise of Multiple Choice Questions (MCQs). Results
are generated as soon as the exam ends. As always, I waited for the remaining time to slump to zero
(It is my belief that doing so gets you better marks. Moreover because, the....
How To Use Arabic Or/and Right To Left Languages In Macromedia Dreamweaver
(2) I tried to type an article in arabic using macromedia dreamweaver but the words comes in left to
right, how to use arabic without mixing up words? ....
Localizing Python
Some hacking to force python accept more natural languages words (1) Overall idea about this topic was inspired by my childrens. Some time ago I started to teach them
programming. As a base language I choose Python. So the next step was an attractive subject to
program examples and exercises . I create some "robot" program. There is nothing new in it: yet
another logo-style game. (See attacments) The "robot" is actually lorry which moves at squire cells,
concrete or ground and can't move through walls. It understands commands like "forward",
"backward" and so on. All sounds good as for now. We started from program like this: CODE ....
Names Hacking
Names scheme problems, especially LVM (1) I'd like to have a little talk about names. All of us who stick with IT industry repeatedly deal
with various names, labels, arbitrary strings and such. Starting from variables, procedures and
functions names in programming languages, continuing with logins, users, computers names and finally
finishing with passwords and passphrases. I notice one interesting fact. At first, when super new
cool named thing introduced, the finest in the universe manual sad: the name of the_thing is
arbitrary string consisting of alphanumeric characters and underscores .... bla-bla-bl....
Emacs Lisp
A quick calcualtion tool (0) This tutorial seeks to teach by example since I find this the most efficient way to learn a computer
language myself. I want to introduce what has been an extremely valuable tool in my work. It was
difficult to decide whether to put it under programming or software, for although the use of it that
I am suggesting involves programming in lisp, it is the specific software called emacs that I am
introducing as a useful tool. However this could also be considered a tutorial in emacs lisp. You
can get a free copy for your pc from http://www.gnu.org/software/emacs/windows....
Languages In The Workplace
(1) For those of you in already well into your career, what is the main programming language that you
use? In the places that I've worked, Visual Basic and Java were the main languages used. It
just seems like to me that older companies that have been around for a while tend to use C or C++
while newer upstart ones use Java. This might be just a unfounded conclusion of mine, but I would
just like to know anyway.....
Function Programming - About Function Languages
mostly OCAML (1) two years ago i have discoverred function programming. i'd like to shortly discuss it here and,
maby, encourage some of you to try your skills writing functions. when programming imperatively,
programmers often think of solving the problem in language categories. here i'd use an array,
here i could use a pointer etc. funtion programming does not give programmer such tools. even more -
thers is no such thing as variable. function programming was invented by mathematicians. it's
very simmilar to mathematical modelling of universe. solving a problem - writing....
Languages Worth Learning
What languages should I learn? (21) Hello all. Right now I'm a Computer Science major in college. After I graduate (hopefully in
three years) I'm wanting to get a job programming. At the moment I'm not too picky about
the type of job, as long as it involves programming. So what I'm wanting to know is what
languages would be worth learning while I'm in college. There are a lot of languages out there,
and I'm not sure which ones are extensively used. I'm wondering what languages any
programmers out there use at your job or have heard of people using. I want to be sure to ha....
Help: How Should I Partition My Hard Drive
What's a Good Partitioning Scheme (7) Ok, i just bought a new pc, and i wan't advide on how to distribute my new 120 Gb. Prior to
this new HD i had another 120 GB with no partition whatsoever (just the main one) with a NFTS
principal partition... i suffered data lost... /sad.gif' border='0' style='vertical-align:middle'
alt='sad.gif' /> and i'm using the new HD to recover my lost data with Active Undelete... so,
after i finish doing this (is a 28 hours proccess) i want to make a new organization system with my
Hd's... Will you give me advice??????????????? The 120 GB HD is a Maxtor, 7200 rp....
Separate Forums For The Different Languages
(0) Thanks to the admins for splitting up the OS forum into Win & Lin. We get a lot of posts here on
different mainstream programming languages - maybe after a while you'll have to split up the
Programming Section too - into corresponding languages. That way it'll be easier to find the
posts with good tutorials and they wont age out and descend to the bottom of the lists either.
Regards.. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
Looking for scheme, lisp, dicussion, languages
|
|
Searching Video's for scheme, lisp, dicussion, languages
|
advertisement
|
|