Page 1 of 1

Why comma is special?

Posted: Wed Jul 09, 2008 10:03 am
by Kazimir Majorinc
I noted that comma cannot be part of the symbol; it appears identifier

x,y

is understood like it is the sequence of three symbols

x , y

Is it intentional?

Posted: Wed Jul 09, 2008 12:04 pm
by Jeff
Yes, it is intentional. The comma is a newlisp idiom for establishing local variables in a function:

Code: Select all

(define (foo param , a b c)
  ;; here, a, b, and c are nil
  (println "Hello world"))

Posted: Wed Jul 09, 2008 12:16 pm
by DrDave
From the manual
Some of the example programs contain functions that use a comma to separate the parameters into two groups. This is not a special syntax of newLISP, but rather a visual trick. The comma is a symbol just like any other symbol.

Posted: Wed Jul 09, 2008 12:23 pm
by Jeff
It is a symbol and may be set, but the comma is recognized individually by the parser and is not a valid character in other symbols.