You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently , syntax is only useful when it's used at head of an expression. If it's put inside an expression, it will be regarded just as a symbol of ,. Now I suppose, , can also be used inside expressions, as an operator of "nest former items".
Say we have code:
ab,cd
now it's parsed to:
["a""b"",""c""d"]
in the context of extended comma syntax, it can be parsed to:
[["a""b"] "c""d"]
And then combined with $, we can have code:
ab,$ cd
which can be parsed to:
[["a""b"] ["c""d"]]
I'm not ready to add it yet. Maybe it could be a new operator just like ,$ since they are used in pair in the cases above. I'm not sure.
It seems this extension will not break current semantics of Cirru, and will unlikely to break existing codebase. Only case I think that will break is there was a [,] macro in calcit-runner that relies on commas, but it won't be big problem to change that macro for a better syntax like ,$.
Not ready to make this change yet. And current solution is still handing in most cases. To be decided in the future.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Short version
Currently
,
syntax is only useful when it's used at head of an expression. If it's put inside an expression, it will be regarded just as a symbol of,
. Now I suppose,,
can also be used inside expressions, as an operator of "nest former items".Say we have code:
now it's parsed to:
in the context of extended comma syntax, it can be parsed to:
And then combined with
$
, we can have code:which can be parsed to:
I'm not ready to add it yet. Maybe it could be a new operator just like
,$
since they are used in pair in the cases above. I'm not sure.Details
The idea bumped when I was trying to describe https://en.wikipedia.org/wiki/B,_C,_K,_W_system in Cirru. For SKI, we have
written in Cirru, with a new lambda syntax:
And for BCKW, we have:
written in Cirru:
And if we extend comma syntax, we could make it simpler:
it's simpler, right?
And this extended comma may also help in formatting continuous nested expressions like:
which currently parsed to:
With extended commas, it can be written as:
quite inspiring for me.
Considerations
It seems this extension will not break current semantics of Cirru, and will unlikely to break existing codebase. Only case I think that will break is there was a
[,]
macro in calcit-runner that relies on commas, but it won't be big problem to change that macro for a better syntax like,$
.Not ready to make this change yet. And current solution is still handing in most cases. To be decided in the future.
Beta Was this translation helpful? Give feedback.
All reactions