4 ms·
As others have noted, the choice of both syntax (extremely elaborate, to the point of reeking of esoteric languages like Shakespeare) and semantics (scalar impe
by 5- 7y ago
As others have noted, the choice of both syntax (extremely elaborate, to the point of reeking of esoteric languages like Shakespeare) and semantics (scalar imperative language, JavaScript) seem to be a poor match for Classical Chinese, known for the brevity and tacitness of its texts.
I always thought that if for some reason one wanted to map an existing programming language into Classical Chinese (instead of coming up with something semantically closer resembling the latter), one could do worse than start with the likes of APL.
Consider the Fibonacci example: https://github.com/wenyan-lang/wenyan/blob/master/examples/fibonacci.wy https://github.com/wenyan-lang/wenyan/blob/master/examples/f...
Is this really how you would like to use Classical Chinese to convey the idea of a Fibonacci number? Indeed, this form maximises the number of words one can use in a single definition; is there anything else for which it is good?
Here's an equivalent program in APL (also naively recursive, that's not necessary how I'd implement Fibonacci sequence):
{⍵<2:⍵⋄+/∇¨⍵-1 2}
If the argument is below 2, that's the answer; otherwise, compute sum of the function applied, in turn, to the argument less 1 and 2.
- pollinia 7y agoaddio
- tvb12 7y agoCan you recommend an APL interpreter? I'd like to fiddle with that.
- 5- 7y agoDyalog APL is a mature, modern, and well-supported implementation of APL. https://www.dyalog.com/ https://www.dyalog.com/ It's also powering https://tryapl.org/ https://tryapl.org/ and available on https://tio.run/ https://tio.run/ You might also find K interesting -- an APL descendant with somewhat different aesthetics, though Dyalog has recently done a lot of catching up to it. https://code.kx.com/q/ https://code.kx.com/q/
- tvb12 7y agoIt looks like there's a Jupyter kernel for dyalog. I'll give this a try. Thanks!