Bug in fn parameters

Notices and updates
Locked
Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Bug in fn parameters

Post by Jeff »

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

Code: Select all

(foo bar ,baz :bat)
expands its parameter list to:

Code: Select all

(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...

Artful code

jrh
Posts: 36
Joined: Mon Nov 14, 2005 9:54 pm
Location: Portland, Oregon

Post by jrh »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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:

Code: Select all

(constant (global ':) context)

(: 'Foo "x" 123)
(: Foo "x") => 123
also puts a lot of smileys in your code ;-)

Lutz

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The manual seems to imply that the colon is a legal start character though
see also here:

http://newlisp.org/downloads/newlisp_ma ... mbol_names

Lutz

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by 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?
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

Jeff wrote: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 a little over a year ago. Maybe you can write something better (in particular, faster).

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

Locked