shashi / APL.jl

Other
63 stars 7 forks source link

"apl iota" does not work only \iota #8

Open Thomashrb opened 2 years ago

Thomashrb commented 2 years ago

Using the same unicode for iota that APL uses gives this

julia> apl"⍳2"
ERROR: LoadError: ⍳: undefined APL symbol
Stacktrace:
 [1] parse_apl(s::String, i::Int64, paren_level::Int64, curly_level::Int64)
   @ APL ~/.julia/packages/APL/qzFcC/src/parser.jl:85
 [2] parse_apl(str::String)
   @ APL ~/.julia/packages/APL/qzFcC/src/parser.jl:45
 [3] var"@apl_str"(__source__::LineNumberNode, __module__::Module, str::Any)
   @ APL ~/.julia/packages/APL/qzFcC/src/APL.jl:11
in expression starting at REPL[42]:1

However using \iota works.

julia> apl"ι2"
1:2

Unicode codepoints:

julia> codepoint('ι')
0x000003b9

julia> codepoint('⍳')
0x00002373

I am not sure if this is intended but I couldn't find that documented anywhere if so. If it is not intended I am not sure what the solution is but perhaps it makes sense to support both?

razetime commented 2 years ago

Many of APL's symbols are specifically reserved for it due to its historical significance.

Hence, most widely used APL implementations use only (APL FUNCTIONAL SYMBOL IOTA), and not ι (GREEK SMALL LETTER IOTA) as their iota.

shashi commented 2 years ago

Open to a PR adding all of them!

razetime commented 2 years ago

There appear to be two that can be added:

ι | greek small letter iota | 01671 | 953 | 0x3B9 | ι
ɩ | latin small letter iota | 01151 | 617 | 0x269 | ɩ
shashi commented 2 years ago

By all of them, I mean all the APL alternatives to the standard ones this package uses. I just figured being able to type into the julia repl is important.

razetime commented 2 years ago

Got it. Added the symbol in #9.