Jump to content

SimpLISPity


Mat
 Share

Recommended Posts

Having started this project with no previous understanding of LISP, I apologize now to any LISP experts who think what I've done is a crime. The only thing I know that I've missed out is Lists. To the best of my knowledge the rest of the standard functions are all there.

It is also pretty accurate, as for any sums with at least one element longer than 14 digits it uses this BigNum udf, which is surprisingly fast! Despite this, there are some limitations, the function factorial only goes up to 78!, which is more than enough anyway, but it will return null for anything over that.

http://code.google.com/p/m-a-t/downloads/detail?name=SimpLISPity.zip

A happy Halloween to you all!

Mat

Edited by Mat
Link to comment
Share on other sites

Nice work Mat! Looks very well made.

Things.

  • I must be stupid, but how do you create a function? (defun hello() 10) gave me an error about incorrect number of parameters or some other bull.
  • You can't insert newlines, makes code very hard to read.
  • History windows doesn't scroll down. Major annoyance,
  • Many of the menu buttons doesn't work.
  • The blinking '|' disappears from the editor at random times. Annoying.
Ps.

You do know that Lisp is short for List Processor, maybe getting list to work? :)

Ds.

I hate lisp :)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

thanks :)

Things:

1) You need to use "defun hello () (10)", as it works using the brackets. Not that that works either when you try to call the function...

2) Oh yer... I forgot I added the BS_DEFBUTTON style...

3) Um... Not sure how to fix... It uses an IE object, I'll have to see If I can call an IEAction when updating.

4) Non of the "file" items work (except exit), and I have not done the tools yet, or help. I am working on it, but since they are not particularly vital I just left them out.

5) ... its an input control ... maybe the IE obj is stealing it...

PS) yer... um... I am trying different methods now but I have a funny feeling it involves a rewrite of how I interpret. so that'll be in the next version too :)

DS) Too bad... But you like python don't you? and from my incredibly limited understanding they are vaguely related. The reason I started this is because it said in a book I was reading that it was the most beautiful language. It does look very logical, and interpreters are surprising easy to write, but then the exceptions arrive like "defun" and "cond", and my workarounds for those are rather amusing I find.

There is another problem with resizing and the IE object, which I think I know how to solve.

what extension would a LISP file use? ".lisp" I presume...

Mat

Edited by Mat
Link to comment
Share on other sites

1) You need to use "defun hello () (10)", as it works using the brackets. Not that that works either when you try to call the function...

Hmm, so how would I write a function hat just returns 10?

DS) Too bad... But you like python don't you? and from my incredibly limited understanding they are vaguely related. The reason I started this is because it said in a book I was reading that it was the most beautiful language. It does look very logical, and interpreters are surprising easy to write, but then the exceptions arrive like "defun" and "cond", and my workarounds for those are rather amusing I find.

I love Python. Python can be used as a functional language but it's the object oriented aspect of python I use and love.

However people who like functional languages are very religous about it, saying stuff like beautiful and "everything can be done with it". While both stands true in some cases, I think it becomes unreadable and overly complex (also, functional languages are inefficient by nature). However I like solving problems in Lisp as a brain teaser as I tend to think more when solving stuff in it. Also, some stuff like factorials and Fibonacci sequences are indeed nice in Lisp.

what extension would a LISP file use? ".lisp" I presume...

Yup :)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

use (let hello 10) to create a variable I think is what you want... I need to work on what happens when a bracket contains only one thing.

I am working on the other problems now. Lists are still on the drawing board, however, I think i'm going to be using arrays somewhere anyhow.

Mat

edit: "((let hello 10)(print hello))" works. "(hello)" won't.

Edit2: Above problem is now fixed, it was me being very aggressive in the prep function

$sString = StringRegExpReplace ($sString, "\((\S*?)\)", "\1")

comment out that line (676) for a temporary fix. It will be solved properly in the next version, which will be released when the rest of the menu functions are done and the problem with the caret is solved.

Mat

Edited by Mat
Link to comment
Share on other sites

Oh no... not that again...

Thanks authenticity, I am going to start using MustDeclareVars whenever possible (My new years resolution :) ) as well, as I repeatedly get told that the code has errors...

Lots of Irritating Superfluous Parenthesis is a lot more descriptive, and very accurate. Its not irritating when your writing the interpreter though :) it makes life very easy indeed. I am trying to write a normal arithmetic parser. And I have fell back on adding brackets in everywhere and then working it out. Thats a good idea... How about a maths to LISP converter?

Mat

Link to comment
Share on other sites

  • 2 weeks later...

Updated, with a lot of improvements to the resizing + GUI (It was very buggy), and lists have been added.

at the moment, the following functions work with lists: "List", "cons", "append" and "mapcar". I am now writing a helpfile for this, and that'll be here next version.

I have also written all the code for the menu items, including a simple "Tidy" menu. Help menu will be available alongside the helpfile next version.

http://code.google.com/p/m-a-t/downloads/detail?name=SimpLISPity.zip

Mat

Edit: oh... and the history view is still being a pain.

Edited by Mat
Link to comment
Share on other sites

  • 5 months later...

Nice. Been seeking something like this for a looong time. I've started implementing LISP interpreters in C, C++ and AutoIT, But my most complete version (the prototype) was done in QBasic. Works great too, except until you get to a certain recursive depth then the language itself fails :) . That's when I decided I had to do it in another language AND abandoned QBasic entirely :idea: .

Link to comment
Share on other sites

Nice. Been seeking something like this for a looong time. I've started implementing LISP interpreters in C, C++ and AutoIT, But my most complete version (the prototype) was done in QBasic. Works great too, except until you get to a certain recursive depth then the language itself fails :) . That's when I decided I had to do it in another language AND abandoned QBasic entirely :idea: .

:( been a long time since ive used it myself, but I might start again. I used it mainly to see if I could solve some of the problems on: http://projecteuler.net/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...