The last update I posted was last month. Which is sad...very very sad. It looks like Paul Graham's ARC Lisp is a reality although a web form isn't very impressive. I think DLisp.py can be used for web stuff, I have to check with Decker on that. But cREDLisp is still being re-worked to match jREDLisp. And jREDLisp needs some of the more basic functions needed.
But for a web app all you really need is standard I/O. I already have that with the basic print function (which needs a more complicated format counter-part, which I'm going to write in REDLisp I think).
Therefore, I'm going to write up an HTMLGen library today and then I'm going to start running jREDLisp and DLisp.py with FastCGI. Hopefully I can get cREDLisp back to a usable state by Sunday so the real fun with modules can begin.
Note: I have removed the dependency of cREDLisp on the CrissCross library. It isn't worth using the whole CrissCross framework when all I really need are a few functions for the modules like the file I/O stuff and sockets. So the new plan is to just rip out the code I need.
Thursday, February 15, 2007
Friday, January 05, 2007
Update on jREDLisp
I have the parser in 98% working condition (small problem with string parsing). I just need to add the parse-to-integer, parse-to-decimal and parse-to-rational calls when creating the eval list and that's it. I've also got Compiled Functions working and I'll be adding functions and macros as soon as I can.
Also, development of the C++ interpreter will continue but it will be re-organized and made to resemble the Java version. I'm going to try and get class definitions finalized with Decker and write the macros for that.
And persistent variables in functions...there may be two function-creation functions: persist and function. Function will work as before but the local environment is cleaned out after execution. Persist will inherit the old behaviour of function and keep the local environment. For example, instead of creating a counter function with function you would create it with persist.
I think the most important change will be style. All indents will be 4 spaces. Or 2 spaces if that's your personal preference (I know Emacs C style uses 2 spaces). But it'll be very consistent in the documentation.
Example of documentation changes
Some code in On Lisp:
And with 4 spaces only indentation (still Common Lisp code):
And finally, 2 spaces only:
Also, development of the C++ interpreter will continue but it will be re-organized and made to resemble the Java version. I'm going to try and get class definitions finalized with Decker and write the macros for that.
And persistent variables in functions...there may be two function-creation functions: persist and function. Function will work as before but the local environment is cleaned out after execution. Persist will inherit the old behaviour of function and keep the local environment. For example, instead of creating a counter function with function you would create it with persist.
I think the most important change will be style. All indents will be 4 spaces. Or 2 spaces if that's your personal preference (I know Emacs C style uses 2 spaces). But it'll be very consistent in the documentation.
Example of documentation changes
Some code in On Lisp:
(defun our-length (lst)
(labels ((rec (lst acc)
(if (null lst)
acc
(rec (cdr lst) (1+ acc)))))
(rec lst 0)))
And with 4 spaces only indentation (still Common Lisp code):
(defun our-length (lst)
(labels ((rec (lst acc)
(if (null lst)
acc
(rec (cdr lst) (1+ acc)))))
(rec lst 0)))
And finally, 2 spaces only:
(defun our-length (lst)
(labels ((rec (lst acc)
(if (null lst)
acc
(rec (cdr lst) (1+ acc)))))
(rec lst 0)))
Tuesday, December 26, 2006
REDLisp...in Java?!
Jared emailed me roughly seven hours ago and suggested we switch the REDLisp interpreter to use Java instead. C++ is slowing us down (no garbage collection and pointers ugh!) so why not switch to Java? Also it means that anyone that has Java installed (99% of all computer users probably) can use REDLisp straight away without recompiling for their platform.
Anyway, this means that the GUI module will use AWT/Swing and that the Audio module will use the Java Sound stuff. I'm not sure how I'll handle 3d stuff (maybe I'll write my own REDLisp compiler that compiles to C++ to use SDL/OpenGL/DirectX) but I could hook it into Java 3d API though I'm concerned about how slow that may run.
Merry Christmas, Happy New Year!
Anyway, this means that the GUI module will use AWT/Swing and that the Audio module will use the Java Sound stuff. I'm not sure how I'll handle 3d stuff (maybe I'll write my own REDLisp compiler that compiles to C++ to use SDL/OpenGL/DirectX) but I could hook it into Java 3d API though I'm concerned about how slow that may run.
Merry Christmas, Happy New Year!
Friday, December 08, 2006
*sigh* Recursion
I just ran a test of REDLisp in prime generation. It works! But it takes forever to generate more than 50 primes. 50 primes took roughly a little under 50 seconds and 1000 was taking way too long. In short, recursion kind of sucks and REDLisp needs quite a bit of work if I'm going to get it consuming less memory. In comparison, as soon as I ran the Python script, the primes were generated. Unfortunately, Python has a maximum recursion depth that's reached when I try to generate more than 146 primes. REDLisp of course doesn't have that kind of limit (because it's using C++) but it's very inefficient (also because it's using C++).
The code used is:
The load function is partially behaving with multiple lines and I'm in the process of fixing that (tokenizer problem I think). Anyway, that's why the code appears messy, here's the cleaned up version:
I'm a bit pissed that it isn't running faster, but it's my own fault for not watching where I'm using a lot of memory. I'm going to pull valgrind out and start optimizing the interpreter in the next week or two. And back to work on functions and while loops.
The code used is:
('is-prime (function (guess primes) (if primes (if (eq (mod guess (first primes)) 0) nil (is-prime guess (rest primes))) T)))
('n-primes (function (n guess primes) (if (> n 0) (if (is-prime guess primes) (n-primes (- n 1) (+ guess 1) (cons guess primes)) (n-primes n (+ guess 1) primes)) primes)))
(quit (frmt (n-primes 50 3 (list 2))))
The load function is partially behaving with multiple lines and I'm in the process of fixing that (tokenizer problem I think). Anyway, that's why the code appears messy, here's the cleaned up version:
('is-prime (function (guess primes)
(if primes
(if (eq (mod guess (first primes)) 0) nil
(is-prime guess (rest primes)))
T)))
('n-primes (function (n guess primes)
(if (> n 0)
(if (is-prime guess primes)
(n-primes (- n 1) (+ guess 1) (cons guess primes))
(n-primes n (+ guess 1) primes))
primes)))
(quit (frmt (n-primes 50 3 (list 2))))
I'm a bit pissed that it isn't running faster, but it's my own fault for not watching where I'm using a lot of memory. I'm going to pull valgrind out and start optimizing the interpreter in the next week or two. And back to work on functions and while loops.
Friday, December 01, 2006
Questions about Arc
Back in October, Oct 18 to be precise, I sent an email to Paul Graham asking two questions. I haven't received any reply yet and it's already December. Maybe it's a sign that I should have read more about Arc Lisp or something, but I'm going to bet that Paul Graham is just really busy with Y-Combinator things. Anyway, this is what I sent:
I've been thinking about having things like exceptions, but I've never really found a use for them. They're pretty much the same as using an if statement to check for errors. C++ has exceptions and not once have I had to use them, just like the templates in C++. The same is true in Java: I only use them when I'm forced to. In Python, I try and avoid functions that use exceptions. So my answer would be: hell no, unless someone has some really good reasons for adding them (i.e. increases the power of the language or something).
I asked about classes because I know how I want REDLisp classes to look like:
I like it because it's simple. The code in Java would look like this:
And finally, in Common Lisp, it would like a little like this:
Ridiculous. I had to refer to the Common Lisp HyperSpec for every single line. I can tell why people shy away from using classes and methods in Common Lisp: they're a pain. The worst part of the HyperSpec is there are no examples for creating classes. Well, there is one (Section 7.1.4) and another (Section 7.1.7). Gee thanks HyperSpec! Peter Seibel's Practical Common Lisp doesn't help much either. I find it hard to believe that I can comprehend the usage of classes in Java, Python and C++ and structs in C (though I've hardly used them) but I can't even begin to understand Common Lisp's classes.
Sorry for the rant, but it really annoys me when people call CLOS (Common Lisp Object System) really powerful, but almost no one uses it. Sorry but I don't buy it. It's a complicated mess of a system. Once you have to call something a system, it's time to re-think it.
I just have two questions:I'm going to answer those questions, but about REDLisp. Maybe that'll get Paul to respond ;)
Does Arc Lisp contain C++/Java exceptions or Common Lisp conditionals and why/why not?
and, Do you have some sample code for creating classes?
Thanks,
Rudolf
I've been thinking about having things like exceptions, but I've never really found a use for them. They're pretty much the same as using an if statement to check for errors. C++ has exceptions and not once have I had to use them, just like the templates in C++. The same is true in Java: I only use them when I'm forced to. In Python, I try and avoid functions that use exceptions. So my answer would be: hell no, unless someone has some really good reasons for adding them (i.e. increases the power of the language or something).
I asked about classes because I know how I want REDLisp classes to look like:
(class Something ()
"Some documentation"
(x 3)
(say (fn (msg) (print msg ":" x "\n")))I like it because it's simple. The code in Java would look like this:
public class Something
{
public int x = 3;
public void say (String msg)
{
System.out.println (msg + ":" + x);
}
}And finally, in Common Lisp, it would like a little like this:
(defclass something ()
((x :initarg :x :initform 3))
(:documentation "Some documentation"))
(defgeneric say (something))
(defmethod say ((something msg))
(print t "~S:~S~%" msg (slot-value something 'x)))
Ridiculous. I had to refer to the Common Lisp HyperSpec for every single line. I can tell why people shy away from using classes and methods in Common Lisp: they're a pain. The worst part of the HyperSpec is there are no examples for creating classes. Well, there is one (Section 7.1.4) and another (Section 7.1.7). Gee thanks HyperSpec! Peter Seibel's Practical Common Lisp doesn't help much either. I find it hard to believe that I can comprehend the usage of classes in Java, Python and C++ and structs in C (though I've hardly used them) but I can't even begin to understand Common Lisp's classes.
Sorry for the rant, but it really annoys me when people call CLOS (Common Lisp Object System) really powerful, but almost no one uses it. Sorry but I don't buy it. It's a complicated mess of a system. Once you have to call something a system, it's time to re-think it.
Thursday, November 30, 2006
Updates
My hard-drive was dying so I switched over to the PowerPC and installed ArchLinux on it. It's working fine, but that kills my OS X testing environment. And thanks to the end of the semester coming up at college, I've been busy with tests and assignments. But, I just compiled REDLisp for the first time in a week and I'm working on fixing the dRational bugs.
I've also been toying with the DLisp code, creating a simplified compiler. DLisp is the Python interpreter for REDLisp and since it's all Jared's work it's called Decker Lisp.
And, the function slice has been re-named cut. I'm going to look into implementing implicit cutting/slicing like Python's [1:3] notation for lists and strings.
I've also been toying with the DLisp code, creating a simplified compiler. DLisp is the Python interpreter for REDLisp and since it's all Jared's work it's called Decker Lisp.
And, the function slice has been re-named cut. I'm going to look into implementing implicit cutting/slicing like Python's [1:3] notation for lists and strings.
Tuesday, November 14, 2006
Release release!
I added the if function on the weekend and I'm working on fixing functions. I also fixed or and removed some debug messages. Basically, I haven't done enough to announce another release on Freshmeat. But, I will say this, the plan for the 0.50i has changed and I'll be working on getting REDLisp working on Windows for 0.60. I'm also working on fixing the OS X compile.
So the new plan is to have a 0.51 release with a compile on OS X, a while loop and all modules (GTK, Sockets, File I/O, Math, and Audio) compiling on OS X and Linux. I'll also try and get functions to be a bit more usable.
And with the 0.51 release, I'm going to stop using letters in versions. Anyway, back to some college classwork.
So the new plan is to have a 0.51 release with a compile on OS X, a while loop and all modules (GTK, Sockets, File I/O, Math, and Audio) compiling on OS X and Linux. I'll also try and get functions to be a bit more usable.
And with the 0.51 release, I'm going to stop using letters in versions. Anyway, back to some college classwork.
Subscribe to:
Posts (Atom)
