Table of Contents
I decided I was going to participate in this year's advent of code, and I decided I wanted to do it with APL. Now I already have Dyalog RIDE installed but I don't want to create a new workspace for every problem so instead decided I would take advantage of the dyalogScript feature to write small executables in order to solve each problem. Now, VScode does have language support extensions for APL, including a language server client. However, I ran into some problems getting the language server running so instead I decided it would be easier to download an APL keyboard and run each executable from the command line.
install the keyboard
Go here to download the keyboard. (for macos click the flag associated with your keyboard ie american layout) then go here to view the layout. Press alt
to use the apl unicode keybinds.
a basic example
#!/usr/local/bin/dyalogscript
name←⎕
⎕←∊'hello ' name
what to know about shell scripts
⎕←val
outputs to stdout⍞←val
outputs to stderrval←⎕
evaluates stdin as apl code, thus strings must be 'quoted' or they will be used as namesval←⍞
pulls from stdin as a string
As far as I can tell, you cannot give a dyalogscript arguments like you would another script. However, you can pipe them in and your first read of stdin will receive whatever was piped in. If you try to read an argument this way it will simply ignore it and wait for user input.
if we really want to we can always use a bash wrapper
#!/usr/local/bin/bash
echo $@ | ./foo.apl
There might be a system command to get something like argv but I looked over the release notes and language reference and didn't notice it.