newLISP Fan Club

Forum => newLISP newS => Topic started by: Kazimir Majorinc on July 09, 2008, 03:03:37 AM

Title: Why comma is special?
Post by: Kazimir Majorinc on July 09, 2008, 03:03:37 AM
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?
Title:
Post by: Jeff on July 09, 2008, 05:04:47 AM
Yes, it is intentional.  The comma is a newlisp idiom for establishing local variables in a function:


(define (foo param , a b c)
  ;; here, a, b, and c are nil
  (println "Hello world"))
Title:
Post by: DrDave on July 09, 2008, 05:16:15 AM
From the manual
QuoteSome 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.
Title:
Post by: Jeff on July 09, 2008, 05:23:52 AM
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.