In https://contextfreeart.org/gallery2/#design/3878 I managed to use ♡ as a rule name, and it works — both in ContextFree.app (Mac OS X) and in the gallery. Is this intended? Will it behave nicely on other platforms?
If you decide that it is a feature, can we have ● and ■ and ▲ as synonyms for CIRCLE and SQUARE and TRIANGLE? (This is not just for code golf.)
If you decide that it is a bug, I'll have to go and edit that cfdg file.
Feature: Unicode in shape names
Moderators: MtnViewJohn, chris, mtnviewmark
Re: Feature: Unicode in shape names
Further experimentation:
Code: Select all
startshape 🖖
💩💩=.5
∡=120
shape 🖖{
CIRCLE[]
loop 3 [[ r ∡ ]] 🖖[s 💩💩 x 1 ]
}
Re: Feature: Unicode in shape names
Code: Select all
startshape 🌳
■=SQUARE
ξ=sqrt(1.25)-.5 // mmm ... √(1.25)-.5 doesn't work.
θ=60
shape 🌳{
■[[s .1 1 y .5]]
loop 2 [[ f 90 ]] 🌳[[ y 1 r θ s ξ]]
}
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Feature: Unicode in shape names
It's not a bug! Unicode is allowed in shape names and in included/imported cfdg filenames. CFDG files are UTF-8 encoded. It's a bit of a hack because the parser library does not understand UTF-8. There are a few unicode tokens too: ≤, ≥, ≠, …, ±, ∞, and π. Pretty much any unicode character is allowed in a shape name except for these 6 (π is allowed in shape names). You can't name a shape '1', but you can name a shape ①,1,𝟏,𝟷,𝟭,𝟙,¹,₁,⑴,⒈,⓵, or ❶.
I suppose I should create a design Pile of Poop, .
I like your idea for CIRCLE, SQUARE, and TRIANGLE synonyms. I could easily add them the same way that π is a synonym for 3.1416.
I suppose I should create a design Pile of Poop, .
I like your idea for CIRCLE, SQUARE, and TRIANGLE synonyms. I could easily add them the same way that π is a synonym for 3.1416.
Re: Feature: Unicode in shape names
Yes I had previously caught that that ≠±∞≤≥π have meaning.
For the shapes, there is a macosx keystroke for • (⌥8), but there are also ●⬤⚫︎ which have no keystrokes.
There are no keystrokes for or ▲ AFAIK.
However it is possible to have text input settings on an individual macosx computer so that something like \triangle gets converted to ▲.
Not sure that any of this is *that* useful.
For the shapes, there is a macosx keystroke for • (⌥8), but there are also ●⬤⚫︎ which have no keystrokes.
There are no keystrokes for or ▲ AFAIK.
However it is possible to have text input settings on an individual macosx computer so that something like \triangle gets converted to ▲.
Not sure that any of this is *that* useful.
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Feature: Unicode in shape names
Not terribly useful, but fun. And it saves 3-5 bytes in code golf. I can add keyboard shortcuts for the three shapes, like I did for the other 7.
Re: Feature: Unicode in shape names
Fair enough.
I fully support your efforts for further CF glory on codegolf.stackexchange
Surely should be a primitive.
I fully support your efforts for further CF glory on codegolf.stackexchange
Surely should be a primitive.
Re: Feature: Unicode in shape names
Ideas for synonyms:
On Mac OS X keyboard √ ∆ % could have obvious meanings (oops — you've done %)
Other unicode symbols ⟦ ⟧ ⎡⎤⎣⎦ ⸬ ² ⅛ α could have obvious meaning.
further random ideas:
loop=∑ (⌥w) or Σ (Sigma) … since loop functions as "image summation".
shape=∫ (⌥b), or maybe ß (⌥s) however,
startshape=ß or § (save 9 bytes on all designs!)
rule=ρ (no keystroke) or ® (⌥r) or maybe → would look nice in v3 code
(sqrt(5)+1)/2=φ=ϕ
transform = τ, or 2*π=τ (no, don't start that argument)
skew=▱ or #
saturation=§
MOVETO=µ
LINETO=— (em-dash) or λ
CURVETO=~ (bezier curve - tilde) or κ
ARCTO=⌣ or α
STROKE=✎
FILL=Φ or paint bucket (can't find)
It seems that standard ternary •?•:• doesn't exist, but if(•,•,•) does. Is this a parsing issue? Could ¿•,•,•? be a synonym for if(…)? Is there a use for ‽?
On Mac OS X keyboard √ ∆ % could have obvious meanings (oops — you've done %)
Other unicode symbols ⟦ ⟧ ⎡⎤⎣⎦ ⸬ ² ⅛ α could have obvious meaning.
further random ideas:
loop=∑ (⌥w) or Σ (Sigma) … since loop functions as "image summation".
shape=∫ (⌥b), or maybe ß (⌥s) however,
startshape=ß or § (save 9 bytes on all designs!)
rule=ρ (no keystroke) or ® (⌥r) or maybe → would look nice in v3 code
(sqrt(5)+1)/2=φ=ϕ
transform = τ, or 2*π=τ (no, don't start that argument)
skew=▱ or #
saturation=§
MOVETO=µ
LINETO=— (em-dash) or λ
CURVETO=~ (bezier curve - tilde) or κ
ARCTO=⌣ or α
STROKE=✎
FILL=Φ or paint bucket (can't find)
It seems that standard ternary •?•:• doesn't exist, but if(•,•,•) does. Is this a parsing issue? Could ¿•,•,•? be a synonym for if(…)? Is there a use for ‽?
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
Re: Feature: Unicode in shape names
Let's not slide down this slippery slope.
The Bison parser is capable of parsing a ternary operator but the ternary operator can be ambiguous while the if function syntax is never ambiguous. If C had lazy function argument evaluation then they would never have bothered with the ternary operator.
The Bison parser is capable of parsing a ternary operator but the ternary operator can be ambiguous while the if function syntax is never ambiguous. If C had lazy function argument evaluation then they would never have bothered with the ternary operator.