Bug in fn parameters

Started by Jeff, July 07, 2007, 06:23:13 AM

Previous topic - Next topic

Jeff

Many characters are automatically split from symbols in parameter lists.  For example,


(foo bar ,baz :bat)

expands its parameter list to:


(bar , baz : bat)

(5 parameters, rather than three)



This is bad behavior.  It happens even in a macro.  Perhaps commas could be excepted, as they are convention in newLisp, but probably it's a bug in the code, rather than an intended behavior.



Edit: this occurs in both stable 9.1 and 9.1.7 on osx 10.4.
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

jrh

#1
Section 1 of the newLISP Function Reference portion of the manual disallows the comma as the start of a variable name.  Both commas and colons are prohibited from being inside a variable name as they are used to mark the end of a symbol.



The manual seems to imply that the colon is a legal start character though.

Lutz

#2
this is intended and documented here:



http://newlisp.org/downloads/newlisp_manual.html#commas">http://newlisp.org/downloads/newlisp_manual.html#commas



Same for the colon ':' . You could use this to define special operators. E.g. I have used this definition for the colon to make a shorter to type hash functionality:


(constant (global ':) context)

(: 'Foo "x" 123)
(: Foo "x") => 123


also puts a lot of smileys in your code ;-)



Lutz

Lutz

#3
QuoteThe manual seems to imply that the colon is a legal start character though


see also here:



http://newlisp.org/downloads/newlisp_manual.html#symbol_names">http://newlisp.org/downloads/newlisp_ma ... mbol_names">http://newlisp.org/downloads/newlisp_manual.html#symbol_names



Lutz

Jeff

#4
So there is no good way to emulate the common lisp backtick/comma use to create function templates apart from using lengthy expand expressions?
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

Lutz

#5
No, but perhaps you can find a way to built templates with letex and expand? Perhaps they come out lengthier but (for my taste ;-) ) better readable and understandable.



Lutz

rickyboy

#6
Quote from: "Jeff"So there is no good way to emulate the common lisp backtick/comma use to create function templates apart from using lengthy expand expressions?

Hi Jeff!



Yes there is a way to do this.  http://www.alh.net/newlisp/phpbb/viewtopic.php?t=1086">Lutz, Dmi and I discussed this a little over a year ago.  Maybe you can write something better (in particular, faster).



--Rick
(λx. x x) (λx. x x)