Using parentheses in symbols.

Q&A's, tips, howto's
Locked
Kazimir Majorinc
Posts: 388
Joined: Thu May 08, 2008 1:24 am
Location: Croatia
Contact:

Using parentheses in symbols.

Post by Kazimir Majorinc »

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.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Using parentheses in symbols.

Post by cormullion »

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?

Code: Select all

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

Kazimir Majorinc
Posts: 388
Joined: Thu May 08, 2008 1:24 am
Location: Croatia
Contact:

Re: Using parentheses in symbols.

Post by Kazimir Majorinc »

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

itistoday
Posts: 429
Joined: Sun Dec 02, 2007 5:10 pm
Contact:

Re: Using parentheses in symbols.

Post by itistoday »

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).
Get your Objective newLISP groove on.

Locked