__file__ = './00_core.ipynb'
aplnb IPython magic
Provides
apl
magics in Jupyter and IPython
APLMagic
APLMagic ()
Initialize self. See help(type(self)) for accurate signature.
create_magic
create_magic (shell=None)
# Only required if you don't load the extension
create_magic()
%%apl
3 ⍝ Set x to positive integers up to 3 x←⍳
[1, 2, 3]
%%apl
3 ⍝ Set x to positive integers up to 3 x←⍳
[1, 2, 3]
%apl x ⍝ Get the value of x
[1, 2, 3]
%%apl
; ⍝ Add a ';' to skip returning the last result ⎕←x
1 2 3
= %apl x
x x
[1, 2, 3]
%apl ⎕A
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
load_ipython_extension
load_ipython_extension (ipython)
Required function for creating magic
create_ipython_config
create_ipython_config ()
Called by aplnb_install
to install magic
def dyalog_cmd():
"Helper function to get shell command to run Dyalog"
= Path(which('dyalogscript.bash'))
dyalogscript_path = dyalogscript_path.read_text()
cts = re.search(r'^INSTALLDIR="([^"]*)"', cts, flags=re.MULTILINE).group(1)
install_dir = "/Applications/Dyalog-19.0.app/Contents/Resources/dyalog"
install_dir = os.environ.get('SCRIPT_DIR', install_dir)
script_dir return f'{script_dir}/dyalog APLKEYS="{install_dir}/aplkeys" APLTRANS="{install_dir}/apltrans"'
dyalog_cmd()
'/Applications/Dyalog-19.0.app/Contents/Resources/dyalog/dyalog APLKEYS="/Applications/Dyalog-19.0.app/Contents/Resources/dyalog/aplkeys" APLTRANS="/Applications/Dyalog-19.0.app/Contents/Resources/dyalog/apltrans"'