newLISP Fan Club

Forum => newLISP newS => Topic started by: Jeff on July 07, 2007, 06:23:13 AM

Title: Bug in fn parameters
Post by: Jeff on July 07, 2007, 06:23:13 AM
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.
Title:
Post by: jrh on July 07, 2007, 10:51:28 AM
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.
Title:
Post by: Lutz on July 07, 2007, 10:57:07 AM
this is intended and documented here:



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
Title:
Post by: Lutz on July 07, 2007, 10:58:45 AM
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



Lutz
Title:
Post by: Jeff on July 07, 2007, 12:16:13 PM
So there is no good way to emulate the common lisp backtick/comma use to create function templates apart from using lengthy expand expressions?
Title:
Post by: Lutz on July 07, 2007, 12:37:32 PM
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
Title:
Post by: rickyboy on July 07, 2007, 09:04:07 PM
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.  Lutz, Dmi and I discussed this (//http) a little over a year ago.  Maybe you can write something better (in particular, faster).



--Rick