Questions, comments, errors

Started by Fanda, August 19, 2005, 09:54:11 PM

Previous topic - Next topic

Fanda

Hello!



1) function (exit) isn't listed in Functions in groups (left part of the window of the manual)



2) new functions of new versions of newLISP are protected and they will eventually break the old code. Is it acceptable? Is there any way around this?

(Example: If I define my function (shuffle) and the new version comes with this function - it will say that I cannot use it and it will break my old code.)



3) Little error: Design Patterns - 6. Creating, accessing and modifying lists - Accessing lists

; implicit indexing with vector

(set 'L '(a b (c d (e f) g) h i))

(set 'vec '(2 2 1))

(L vec)   => (e f)     ===> returns only f



4) Question for Lutz: I am coming from Tcl/Tk and I noticed quite a few similarities between Tcl and newLISP. So, is it intentional?

(contexts/namespaces, load, source, {} for not evaluating inside, ...)



5) Question for Lutz: As far as I know, there isn't any "History of newLISP". Is it possible to write something about history of newLISP and a little bit about yourself?



Thank you, Fanda

HPW

#1
Quote2) new functions of new versions of newLISP are protected and they will eventually break the old code. Is it acceptable? Is there any way around this?

(Example: If I define my function (shuffle) and the new version comes with this function - it will say that I cannot use it and it will break my old code.)


I think there is no way around this. I have had this also in the past and have renamed my command to something other. Lutz must have the freedom to develop the core. Maybe you could use a developer-prefix. But when you are a fan of short commands there remains this risk.



Mostly: No risk no fun! ;-)



PS: And there was a way to unprotect a core-function and then overload it. But I would avoid such a hack. Look under 'dump' in the docu.
Hans-Peter

Lutz

#2
Thanks for the manual corrections Fanda. Together with the fix for the new 'difference' I will try to make a new developers release this weekend.



About Tc;/Tk and newLISP: Some similarities are intentional, like using {,} as string delimiters others like 'load' or 'source' are not. I think the Snobol language also used {,} and 'load' can also be found in many places to load code.



Using contexts/namespaces is a frequently found feature in scripting languages as well, and other languages also use namespaces for OO template oriented programming.



When you design a language you try to stay 'in the culture' and do things a way they can easily be understood by newcomers to the language. Sometimes you have to break with a tradition to implement certain feature and then the decision is sometimes not easy.



About history of newLISP: I will put something together one of these days.



Lutz

newdep

#3
About history of newLISP <--- would be great ;-)
-- (define? (Cornflakes))

Fanda

#4
add 2)

I was also confused by the behaviour of this code:
(context 'TEST)
(define (add x y) (+ x y))
(context 'MAIN)

because it errors out even when the function (add) is being defined in the context TEST



Next code is OK, because it is specified explicitly:
(context 'TEST)
(define (TEST:add x y) (+ x y))
(context 'MAIN)

So, is there a way for the newLISP to clearly say in what context I am defining the function?



Thank you, Fanda

Lutz

#5
All built in functions in newLISP are global, that is why you have to overwrite it.



If you want to redefine '+' globally as 'add' do:



> (constant (global '+) add)
add <DA8C>
> (+ 1.2 0.1)
1.3
>


Lutz



ps: this is also explained in the manua