newLISP Fan Club

Forum => newLISP in the real world => Topic started by: Kazimir Majorinc on November 19, 2009, 08:32:20 AM

Title: Using parentheses in symbols.
Post by: Kazimir Majorinc on November 19, 2009, 08:32:20 AM
Is there a chance that one of the [] and {} is released of its duty on a meta level and allowed to be the part of legal symbols? I think that at least one parentheses could be left for that purpose. {}'s are currently used for {hi"ho"he} instead of "hi"ho"he", although it doesn't appear that it is very important, and [text]hi"ho"he[/text] already does the same.
Title: Re: Using parentheses in symbols.
Post by: cormullion on November 19, 2009, 10:48:20 AM
I think that square brackets are already allowed in symbol names. And you can enclose any characters in matching square brackets and get legal symbol names....



If you want parentheses in symbol names, can you use Unicode?


(context '[(parentheses)])
(set '⦅2985and2986⦆ 0
    '⦗2997and2998⦘ 0  
    '⧼29FCand29Fd⧽ 0  
    '❰2770and2771❱ 0  
    '⟦27E7and27E8⟧ 0
    '(FF08andFF09) 0)

(println (symbols))

(❰2770and2771❱ ⟦27E7and27E8⟧ ⦅2985and2986⦆ ⦗2997and2998⦘ ⧼29FCand29Fd⧽
 (FF08))


Perhaps I'm not understanding what you're asking for?
Title: Re: Using parentheses in symbols.
Post by: Kazimir Majorinc on November 19, 2009, 12:06:31 PM
You understood well, cormullion.



Brackets would be perfect, and I used it until recently. Unfortunatelly, Newlisp cannot parse nested brackets well, like (set '[hi.[ho.he]] 3), and really (legal? "[hi.[ho.he]]") returns nil. Other version is, as you suggested, using Unicode and exotic brackets, but there are still compatibility problems, so I currently use pairs of characters as and ˙>. I contemplate using <-- and -->.
Title: Re: Using parentheses in symbols.
Post by: itistoday on November 19, 2009, 01:42:09 PM
I love braces and use them all the time, it's actually one of my favorite features of newLISP, so please don't get rid of them (although I wouldn't shed tears if they were used to represent anonymous maps... :-p). Same goes for brackets [] as they make for a great way to represent arrays in the language without confusion and also anonymously (if such a feature is ever brought into the language).