Defining a class within a Jupyter notebook
4 posts
• Page 1 of 1
Defining a class within a Jupyter notebook
I've used the recent Jupyter notebook capability to develop and document APL code. I wanted to go a step further and define classes as well, but it seems that can only be done within the Dyalog Editor or by putting the text into an external script file. The closest I could come to doing so within the notebook kernel session was the rather awkward
One can do multi-line dfns using the ]dinput user command, but I could find no equivalent for script input. This probably falls in the Why Would You Want To Do That category, but is there any similar mechanism for evaluating script text?
Thanks in advance,
~Mark
- Code: Select all
src← ⊂':Class Constants'
src,←⊂' :Field Public False'
src,←⊂' :Field Public True'
src,←⊂' :Field Public Epsilon'
src,←⊂' :Field Public Infinity'
src,←⊂' :Field Public MaxRecursion'
src,←⊂' ⍝ Constructor, Niladic'
src,←⊂' ∇ new'
src,←⊂' :Implements Constructor'
src,←⊂' :Access Public'
src,←⊂' True← 1'
src,←⊂' False← 0'
src,←⊂' Epsilon← 0.00001'
src,←⊂' MaxRecursion← 5'
src,←⊂' ∇'
src,←⊂':EndClass'
2⎕fix src
One can do multi-line dfns using the ]dinput user command, but I could find no equivalent for script input. This probably falls in the Why Would You Want To Do That category, but is there any similar mechanism for evaluating script text?
Thanks in advance,
~Mark
- mfleming
- Posts: 10
- Joined: Sat Mar 02, 2019 11:09 pm
Re: Defining a class within a Jupyter notebook
Hi Mark
Well you've just given me a bit of help there - I didn't know about ]Dinput
It doesn't look like there is currently a way to input scripted classes or namespaces directly in a notebook - of course you could ⎕FIX from a text file or nested character vector
We'll look into implementing multi-line :Namespace and :Class shortly
Well you've just given me a bit of help there - I didn't know about ]Dinput
It doesn't look like there is currently a way to input scripted classes or namespaces directly in a notebook - of course you could ⎕FIX from a text file or nested character vector
nscript←':Namespace myns' '∇ r←Echo input' 'r←input' '∇' ':Endnamespace'
⎕FIX nscript
We'll look into implementing multi-line :Namespace and :Class shortly
- RichardP|Dyalog
- Posts: 30
- Joined: Fri Oct 12, 2018 3:05 pm
Re: Defining a class within a Jupyter notebook
Good news, Mark
We have now implemented support for scripted :Namespaces, :Classes and :Interfaces
The latest version of the kernel is available from https://github.com/Dyalog/dyalog-jupyter-kernel
https://github.com/Dyalog/dyalog-jupyte ... ng-content has been updated to reflect the new change
We have now implemented support for scripted :Namespaces, :Classes and :Interfaces
The latest version of the kernel is available from https://github.com/Dyalog/dyalog-jupyter-kernel
https://github.com/Dyalog/dyalog-jupyte ... ng-content has been updated to reflect the new change
- RichardP|Dyalog
- Posts: 30
- Joined: Fri Oct 12, 2018 3:05 pm
Re: Defining a class within a Jupyter notebook
Amazing!
I had an adviser years ago who was a real proponent of literate programming, but Knuth's tangle and weave tools were kind of primitive. Jupyter notebooks are a much more natural approach to documenting work.
Many thanks for the update,
~Mark
I had an adviser years ago who was a real proponent of literate programming, but Knuth's tangle and weave tools were kind of primitive. Jupyter notebooks are a much more natural approach to documenting work.
Many thanks for the update,
~Mark
- mfleming
- Posts: 10
- Joined: Sat Mar 02, 2019 11:09 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group