On Mon, Feb 21, 2022 at 9:58 PM Jean Abou Samra <j...@abou-samra.fr> wrote:
> Not sure what confuses you? In TCL I got used to bare strings being values, not varnames, so I'm learning stuff again. It's just different, but in languages that in many other things are very similar. Of course I don't find it confusing in C or python... But I was just reading the page you suggested: as a beginner I read this example (define capital-cities '((sweden . stockholm) (usa . washington) (germany . berlin) )) As an associative array, where the values are dereferenced variables, but I don't know about the keys, whether they're strings, symbols or also variables. Say the first line, if it was python, would it be capitalcities["sweden"] = stockholm or capitalcities[sweden] = stockholm or capitalcities['sweden'] = stockholm # fake out a symbol with ticks, just for argument's sake The TCL form uses parens for array keys, the setter would be set capital-cities(sweden) $stockholm Note this is exactly equivalent to these two: set capital-cities("sweden") $stockholm set capital-cities({sweden}) $stockholm dblquotes interpolate (like in shell/perl) and curlies don't (like ticks in shell/perl). It's easier to keep one's head straight given there's so little extra typing to guide you while one is still learning. I'll learn, I'm just not there yet. It's the same as in most > other languages (such as C++): a bare name dereferences > a variable. The exception to this is within quotes, > which prevent evaluation of symbols, returning them naked. > That too, interpolating into strings, like you have in TCL/perl/shell ("Hello $username" kinda stuff) is handy :-) I also need to learn comma operator and backtick. > > (and the parentheses... take some getting used to, esp with strange > > indentation patterns) > > In case you want to understand them better: > http://community.schemewiki.org/?scheme-style I do, thanks much, I'll keep that around. Looks handy. > Yes, that is the approach taken in the script I linked. > The .ly file is made entirely of embedded Scheme code. > Neat, I'll read up on that > Before spending significant time on it, though, be sure > to do a dedicated request for comments on the mailing list, > giving concrete examples of how it looks like in the > documentation -- not all ideas meet consensus (syntax > highlighting is a good example of a largely subjective > matter). > Indeed. Thanks Jean L