rlwhitcomb / utilities

Some of my personal utility programs
MIT License
2 stars 0 forks source link

Change Calc "length" function to a symbol instead #660

Closed rlwhitcomb closed 7 months ago

rlwhitcomb commented 7 months ago

The length of an object or list is pretty fundamental, and seems to be used a lot, so it would be nice to have a more compact way to reference it, but would still be a meaningful symbol, so it would be easy to remember.

One possibility is @# ... I would like to just use @ but since this is the format prefix, the grammar gets really tricky.

rlwhitcomb commented 7 months ago

Another possibility is just to use @# as a format. The grammar would work (so far I haven't been able to get the grammar to work right with the other possibilities), but this should be easy. The downside is that formats currently only work between expressions, so a lot of places where we would use "length" would get to be more complicated (using an interpolated string, for instance), thus negating the utility of this change. But I'll play around with it anyway...

rlwhitcomb commented 7 months ago

Well, due to the complexities of dealing with rangeExpr vs expr with "length" it appears that parsing length without the built-in function protocol isn't going to work. Going to close this as unworkable (at least for now).