copy-list and other improvements

Started by Kumar, February 03, 2003, 06:33:53 PM

Previous topic - Next topic

Kumar

Hi I'm new to the forum, so bear with me....  

I think this a wonderful lisp interpreter. True to the original lisp spirits.

 

I miss the useful copy-list function, especially since there are quite a few 'destructive' functions, for instance sort, that often must rely on previous copying of original list. I know you can write it down simply in terms of slice or select.

(define (copy-list L)

  (slice L 0 (length L)))



But it would be nice to have it hard-coded.



Another first-look improvement would be to be able to type multiline expressions at the main tk window, (error 'missing parentheses' in mine).  More so since there is no integrated editor. Would that be so hard ?



Thanks and congratulations.

Lutz

#1
everything in newLISP is passed as a copy so:



(set 'x '(1 2 3 4))

(set 'y x)



x and y are now 2 different lists. This is a fundamental difference to other LISPs and one of the reasons, that memory in newLISP can be managed without traditional garbage collection. Everything in newLISP is only referenced once and passed by value-copy into user defined lambda functions. This is also the reason that macros work differently in newLISP.



For multiline statements:

Just open an edit window with the 'def' button or  the 'edit' option in the menu, then type in your multiline expression and click on the second evaluation buttons (with the red * on it). The first evaluate button evaluates but doesn't print the result, the second also prints (which is what you want most of the time)



Lutz

Kumar

#2
So thats all !  simple

So I may assume theres no need for setf either. Everything can be either 'set' or 'replaced'.



In the edit window, it would be phantastic to be able to evaluate a single expression, by 'dragging' it (the same you do with cut&paste), or placing the cursor just after it...  but I suppose that's hard to get ?



Now, how could I have a look at the mySQL interface from my Windos-box ?

SQL from Lisp, and forget about C++ ... I think that would be a sure winner !   My guess, you have to win a 'niche' in which you are at least slightly superior, and then push hard through it. And newLisp is superior in simplicity and availability. Speed is quite good, and the speed bottle neck in database programming might be the SQL engine, not the outer envelope / interface. At least, for some applications.



Quiz:  Whats a commmon-lisp programmer ?

<Someone who every other week checks out how 'setf' behaves. >

Kumar

#3
Also in abstraction level, newLisp is a crack. So, fitted to a fast database engine, with good pattern-matching and language manipulating functions, its got to be... Data mining ? No, data exploding !  

end do.

Lutz

#4
thank you so much for the good review of newLISP, it's good to hear all this from somebody who seems to be quite familiar with CL.



About evaluating parts of an expression in the edit window:



just paint the subexpression with the mouse, than click the right mousebutton for a menu, select the last option 'eval and print'. This will also work in the main console window. If you double click the mouse you can select from parenthesis to parenthesis in one swoop without dragging.





Lutz