Giter Site home page Giter Site logo

fredokun / cl-jupyter Goto Github PK

View Code? Open in Web Editor NEW
196.0 196.0 29.0 3.46 MB

An enhanced interactive Shell for Common Lisp (based on the Jupyter protocol)

License: BSD 2-Clause "Simplified" License

Shell 0.02% Common Lisp 15.41% JavaScript 1.48% Python 2.08% Jupyter Notebook 81.01%

cl-jupyter's People

Contributors

douglas-larocca avatar fredokun avatar glider-gun avatar gppassos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl-jupyter's Issues

Systemwide installation

Hi,

Thanks for writing this kernel! I'd like to use it on jupyterhub. And therefore I'd like to try and modify it so that I can install the kernel systemwide rather than on a per-user basis. Unfortunately, quick-lisp is (sanely) limited to a single user. Do you have suggestions about what changes I would need to make to install the kernel systemwide? I don't want to create a systemwide version of quicklisp as this would get hairy quickly as different users install different packages.

Thanks for your time.

Conditions issued by signal being caught by handling-errors form

Some of the libraries I am using use/abuse conditions to control program flow by using signal and handler-bind. Unfortunately the condition that these libraries signal are being caught by the handling-errors form evaluator.lisp.

The snippet below will let you reproduce the behavior:

(define-condition snake-handler () ())
(handler-bind ((snake-handler (lambda (x) (format t "Bazinga:~a" x))))
(signal 'snake-handler)
(print "Doh"))

Removing the condition clause in handler case as shown below resolves the issue.

(defmacro handling-errors (&body body)
  `(handler-case
       (handler-bind
           ((simple-warning
              #'(lambda (wrn)
                  (format *error-output* "~&~A: ~%" (class-name (class-of wrn)))
                  (apply (function format) *error-output*
                         (simple-condition-format-control   wrn)
                         (simple-condition-format-arguments wrn))
                  (format *error-output* "~&")
                  (muffle-warning)))
            (warning
              #'(lambda (wrn)
                  (format *error-output* "~&~A: ~%  ~S~%"
                          (class-name (class-of wrn)) wrn)
                  (muffle-warning))))
         (progn ,@body))
       (simple-condition (err)
         (format *error-output* "~&~A: ~%" (class-name (class-of err)))
         (apply (function format) *error-output*
                (simple-condition-format-control   err)
                (simple-condition-format-arguments err))
         (format *error-output* "~&"))
       #+ignore(condition (err)
                 (format *error-output* "~&~A: ~%  ~S~%"
                         (class-name (class-of err)) err))))

Initial startup fails on Catalina with SBCL

$ sbcl --load ./cl-jupyter.lisp
This is SBCL 1.5.9, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
... initialization mode... please wait...
To load "cl-jupyter":
  Load 1 ASDF system:
    cl-jupyter
; Loading "cl-jupyter"
...While evaluating the form starting at line 5, column 0
  of #P"/Users/glenhenshaw/Code/cl-jupyter/./cl-jupyter.lisp":

debugger invoked on a ASDF/SESSION:FORMATTED-SYSTEM-DEFINITION-ERROR in thread
#<THREAD "main thread" RUNNING {10005184C3}>:
  OPERATION instances must only be created through MAKE-OPERATION.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry
                                     compiling #<GROVEL-FILE "pzmq" "grovel">.
  1: [ACCEPT                       ] Continue, treating
                                     compiling #<GROVEL-FILE "pzmq" "grovel">
                                     as having been successful.
  2:                                 Retry ASDF operation.
  3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  4:                                 Retry ASDF operation.
  5:                                 Retry ASDF operation after resetting the
                                     configuration.
  6: [ABORT                        ] Give up on "cl-jupyter"
  7: [RETRY                        ] Retry EVAL of current toplevel form.
  8: [CONTINUE                     ] Ignore error and continue loading file "/Users/glenhenshaw/Code/cl-jupyter/./cl-jupyter.lisp".
  9:                                 Abort loading file "/Users/glenhenshaw/Code/cl-jupyter/./cl-jupyter.lisp".
 10:                                 Ignore runtime option --load "./cl-jupyter.lisp".
 11:                                 Skip rest of --eval and --load options.
 12:                                 Skip to toplevel READ/EVAL/PRINT loop.
 13: [EXIT                         ] Exit SBCL (calling #'EXIT, killing the process).

(ASDF/SESSION:SYSDEF-ERROR "OPERATION instances must only be created through MAKE-OPERATION.")
   source: (ERROR 'FORMATTED-SYSTEM-DEFINITION-ERROR :FORMAT-CONTROL FORMAT
                  :FORMAT-ARGUMENTS ARGUMENTS)
0] 

ironclad

Hello Frederic
Many thanks for this master-piece. I was using 'fishbowl' for some time as native FriCAS/Axiom kernel and tried to implement protocol 5 myself, with - needless to say - little success. Now 'cl-jupyter' worked out of the box!
One small issue is the following (which is easy to work around) compile error.

resolved

Magics in cl-jupyter

Frederic,

Do you know about magics in iPython? Would it be difficult to add them to the cl-jupyter kernel?
It looks like it would give us access to a lot of widget functionality without porting widgets like we have been.
Check out:
github.com/clasp-developers/cl-jupyter-widgets.git
github.com/clasp-developers/cl-nglview.git
github.com/clasp-developers/cl-bqplot.git

These are some of the widgets that we have been translating from Python to Common Lisp.

`install-image` No such file or directory

(cl-jupyter:install-image)
Creating directories.
Installing kernel spec file /home/foranw/.local/share/jupyter/kernels/common-lisp/kernel.json
Installing kernel resources to /home/foranw/.local/share/jupyter/kernels/common-lisp/.
Creating kernel image /home/foranw/.local/share/common-lisp-jupyter/image
/home/foranw/.local/share/common-lisp-jupyter/image: No such file or directory

resolved with mkdir .~/local/share/jupyter/kernels/common-lisp/

Error: mismatch ipython version (7.29 vs 7.31)

I'm installing cl-jupyter on Win10 (Microsoft Windows [10.0.18362.1256]) when this error pops up:


C:\tmp\cl-jupyter>python3 install-cl-jupyter.py

cl-Jupyter -- an enhanced interactive Common Lisp shell
(C) 2014-2015 Frederic Peschanski (cf. LICENSE)
----
... Frontend: using IPython v7.31
Error: mismatch ipython version (7.29 vs 7.31)
Abort.

The problem is I don't even have IPython 7.31 ( I checked all files on disk using Everything), so I don't know how the script file chose this IPython in the first place. I do have IPython7.29, and a very old ipython 0.13 from python 2.6. Could there be some residue registry from previous anaconda/python installations that needs to be cleaned up? Or maybe I could specify a frontend manually? Thanks.

SBCL 1.3.15 lisp kernel errors

Hello Fredokun

I am almost through getting cl-jupyter to run on windows 7 with the following
Jupyter console 5.1.0
Jupyter notebook 5
sbcl 1.3.15
latest quicklisp
C:\Users\athena> jupyter console --kernel=lisp

This is SBCL 1.3.15, an implementation of ANSI Common Lisp.
More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

WARNING: the Windows port is fragile, particularly for multithreaded
code. Unfortunately, the development team currently lacks the time
and resources this platform demands.
To load "cl-jupyter":
Load 1 ASDF system:
cl-jupyter
; Loading "cl-jupyter"
.....

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((shell_port . 51315) (iopub_port . 51316)
(stdin_port . 51317) (control_port . 51318)
(hb_port . 51319) (ip . 127.0.0.1)
(key . cca8a02f-2732-43a8-a9e3-a4ba2d74c81f)
(transport . tcp) (signature_scheme . hmac-sha256)
(kernel_name . lisp))

Unhandled SIMPLE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
{1002DB2B93}>:
Trying to access undefined foreign variable "errno".

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1002DB2B93}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SIMPLE-ERROR "Trying to access undefined foreign variable ~S.
" {1006BEF483}> #)
1: (SB-DEBUG::RUN-HOOK SB-EXT:INVOKE-DEBUGGER-HOOK #<SIMPLE-ERROR "Trying to access undefined fore
ign variable ~S." {1006BEF483}>)
2: (INVOKE-DEBUGGER #<SIMPLE-ERROR "Trying to access undefined foreign variable ~S." {1006BEF483}>)
3: (ERROR "Trying to access undefined foreign variable ~S." "errno")
4: (CFFI::FS-POINTER-OR-LOSE "errno" :DEFAULT)
5: ((SETF PZMQ::%VAR-ACCESSOR-ERRNO) 0)
6: (PZMQ:SOCKET #.(SB-SYS:INT-SAP #X00A9ABA0) :ROUTER)
7: (CL-JUPYTER::MAKE-SHELL-CHANNEL #<CL-JUPYTER::KERNEL {1006B38063}>)
8: (KERNEL-START)
9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (KERNEL-START) #)
10: (SB-EXT:EVAL-TLF (KERNEL-START) 5 NIL)
11: ((LABELS SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE) (KERNEL-START) 5)
12: ((LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) (KERN
EL-START) :CURRENT-INDEX 5)
13: (SB-C::%DO-FORMS-FROM-INFO #<CLOSURE (LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KE
YS) :IN SB-INT:LOAD-AS-SOURCE) {100446A30B}> #<SB-C::SOURCE-INFO {100446A2C3}> SB-C::INPUT-ERROR-IN-
LOAD)
14: (SB-INT:LOAD-AS-SOURCE #<SB-INT:FORM-TRACKING-STREAM for "file C:\Users\athena\Git\cl-jupyter
\cl-jupyter.lisp" {1004467423}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
15: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-INT:FORM-TRACKING-STREAM for "file C:\Users\athena\G
it\cl-jupyter\cl-jupyter.lisp" {1004467423}> NIL)
16: (LOAD #P"C:/Users/athena/Git/cl-jupyter/cl-jupyter.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIS
T T :EXTERNAL-FORMAT :DEFAULT)
17: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:LOAD . "C:\Users\athena\Git\cl-jupyter/cl-jupyter.lisp"
) (:QUIT)))
18: (SB-IMPL::TOPLEVEL-INIT)
19: ((FLET #:WITHOUT-INTERRUPTS-BODY-74 :IN SB-EXT:SAVE-LISP-AND-DIE))
20: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))
21: ("foreign function: #x4301BC")

Looping kernel--setting up lisp for the kernel?

I am new to lisp, but more familiar with Jupyter, so I thought I'd try to learn lisp in Jupyter. However, following instructions on quicklisp.org, I found that the kernel looped repeatedly. I thought maybe the system load causes problems, so I tried again with the following commands.

sudo apt-get install sbcl
cd ~/Codes/src
curl -O https://beta.quicklisp.org/quicklisp.lisp
curl -O https://beta.quicklisp.org/quicklisp.lisp.asc
gpg --verify quicklisp.lisp.asc quicklisp.lisp
sbcl --load quicklisp.lisp
   (quicklisp-quickstart:install :path "~/Codes/quicklisp/")
   (ql:add-to-init-file)
   (quit)
git clone https://github.com/fredokun/cl-jupyter
cd cl-jupyter
python3 ./install-cl-jupyter.py
sbcl --load ./cl-jupyter.lisp

Firing this up in Jupyter gave me the following output:

Kernel started: 53aaaa7d-75d1-4ba2-b3ff-85785d1af71e
[I 20:26:37.142 NotebookApp] Adapting to protocol v5.1 for kernel 53aaaa7d-75d1-4ba2-b3ff-85785d1af71e
[I 20:26:44.391 NotebookApp] Starting buffering for 53aaaa7d-75d1-4ba2-b3ff-85785d1af71e:126c1d0ee4f34ffaafd7cc1b1c9c9073
[I 20:26:44.802 NotebookApp] Kernel shutdown: 53aaaa7d-75d1-4ba2-b3ff-85785d1af71e
This is SBCL 1.3.1.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
[I 20:26:44.840 NotebookApp] Kernel started: e6bb4c07-ce8d-4e26-9ab6-413844cf0b7c
To load "cl-jupyter":
  Load 1 ASDF system:
    cl-jupyter
; Loading "cl-jupyter"
.................

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((shell_port . 37095) (iopub_port . 34819)
                        (stdin_port . 49001) (control_port . 33311)
                        (hb_port . 39983) (ip . 127.0.0.1)
                        (key . 60c9347d-d949c6e44d2f7cfd9fadc901)
                        (transport . tcp) (signature_scheme . hmac-sha256)
                        (kernel_name . lisp))
While evaluating the form starting at line 50, column 0
  of #P"/home/jordan/Codes/src/cl-jupyter/cl-jupyter.lisp":
Unhandled SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR in thread #<SB-THREAD:THREAD
                                                                "main thread" RUNNING
                                                                 {100399D2B3}>:
  The alien function "zmq_ctx_new" is undefined.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {100399D2B3}>
0: ("undefined function")
1: (PZMQ:CTX-NEW)
2: (KERNEL-START)
3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (KERNEL-START) #<NULL-LEXENV>)
4: (SB-EXT:EVAL-TLF (KERNEL-START) 5 NIL)
5: ((LABELS SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE) (KERNEL-START) 5)
6: ((LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) (KERNEL-START) :CURRENT-INDEX 5)
7: (SB-C::%DO-FORMS-FROM-INFO #<CLOSURE (LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) {10058F2B4B}> #<SB-C::SOURCE-INFO {10058F2B03}> SB-C::INPUT-ERROR-IN-LOAD)
8: (SB-INT:LOAD-AS-SOURCE #<SB-INT:FORM-TRACKING-STREAM for "file /home/jordan/Codes/src/cl-jupyter/cl-jupyter.lisp" {10058EFAD3}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
9: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-INT:FORM-TRACKING-STREAM for "file /home/jordan/Codes/src/cl-jupyter/cl-jupyter.lisp" {10058EFAD3}> NIL)
10: (LOAD #P"/home/jordan/Codes/src/cl-jupyter/cl-jupyter.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
11: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:LOAD . "/home/jordan/Codes/src/cl-jupyter/cl-jupyter.lisp") (:QUIT)))
12: (SB-IMPL::TOPLEVEL-INIT)
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-82 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))

unhandled condition in --disable-debugger mode, quitting

then it restarted. Thoughts of what I could try to get up and running? I'm guessing I need to do more to configure quicklisp, but I'm not sure what to do there.

cl-jupyter unresponsive "issue with UTF-8 decoding"?

Hello,

I am using SBCL 1.3.1.debian on Ubuntu 16.04. I have updated all my quicklisp dists.

I start in a terminal with "jupyter notebook".

When I load "about-cl-jupyter.ipynb", the kernel does not respond to evaluation requests. I get an asterisk in the brackets. I get the following message in the terminal:

[I 15:54:13.959 NotebookApp] Kernel started: 6459a13b-4f46-4935-911f-123f13f80457
To load "cl-jupyter":
Load 1 ASDF system:
cl-jupyter
; Loading "cl-jupyter"
..................

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

[Kernel] Entering mainloop ...

Kernel] Entering mainloop ...
[Heartbeat] thread startedm[Shell] loop started

Kernel] Entering mainloop ...
[Heartbeat] thread startedm[Recv]: issue with UTF-8 decoding
[Recv]: parts: ("k�\213Eg" "<IDS|MSG>"
"eda0f ... dcb2"
"{"msg_id":"8816 ... cbc4d0e8f48",
"msg_type":"kernel_info_request",
"username":"mfleming","session":
"44db9641d ... 822a1d1226760",
"date":"2018-11-02T22:54:14.170030Z",
"version":"5.3"}"
"{}" "{}" "{}")
[W 15:54:35.140 NotebookApp] Replacing stale connection: 6459 ...

Capturing *trace-output*

Hello,

I'm new to Lisp, and studying Norvig's book. In the book, he makes use of the trace special form.

So, I was wondering if there might be a way to capture the *trace-output* stream and make it visible on the frontend. I tried (setf *trace-output* *standard-output*), but it didn't seem to work.

I don't really yet know what I'm doing, so any help's appreciated!

Thanks

JSONDecodeError when reading file

When I try to read a simple file (via sbcl kernel) such as this one, using the following code:

(with-open-file (stream "~/test.txt" :direction :input)
    (do ((line (read-line stream nil) 
                    (read-line stream nil)))
           ((null line))
         (print line)))

I get a JSONDecodeError. Here is a full stack trace:
stacktrace.txt

Any help is very much appreciated :)

[offer to help] encryption support

Hi,

I notice encryption support is not yet supported. I'm very interested in making a webserver with cl-jupyter notebooks. So I'd be interested in adding this feature. However, I don't have much experience with the internals of jupyter. Can you point me to the resources I'd need to learn how to do this? In return, I'll submit a pull request with encryption support. :)

Thanks for your time.

segmentation faults in kernel

when run either in a console or from a notebook, the kernel responds to at most one execution message:

james@de10:/development/source/library/com/github/lisp/cl-jupyter$ jupyter console --kernel=lisp
; loading #P"/development/source/library/com/github/lisp/cl-jupyter/cl-jupyter.lisp"

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((shell_port . 45106) (iopub_port . 40205)
                        (stdin_port . 35629) (control_port . 44938)
                        (hb_port . 48466) (ip . 127.0.0.1)
                        (key . eb269086-a78f4477c18a51673407b7d0)
                        (transport . tcp) (signature_scheme . hmac-sha256)
                        (kernel_name . lisp))
[Hearbeat] starting...
[Kernel] Entering mainloop ...
[Shell] loop started
[Heartbeat] thread started
WARNING:
   [Shell] message type 'history_request' not (yet ?) supported, skipping...
Jupyter console 5.2.0

cl-jupyter


In [1]: 1WARNING:
   [Shell] message type 'is_complete_request' not (yet ?) supported, skipping...
/home/james/anaconda3/lib/python3.7/site-packages/jupyter_console/ptshell.py:617: UserWarning: The kernel did not respond to an is_complete_request. Setting `use_kernel_is_complete` to False.
  warn('The kernel did not respond to an is_complete_request. '
In [1]: 1
Out[1]: 1

In [2]: 1
      : 

when the send/receive functions are traced, it appears that the last operation is a call to receive the next message, which never returns.
when run from a notebook, the notebook believes its next execution request times out and that the kernel has died.

when the kernel process is traced, this appears in the strace transcript:

--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x10006757b0} ---
mprotect(0x1000670000, 32768, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
rt_sigreturn({mask=[]})                 = 68721402799
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x10035bc110} ---
mprotect(0x10035b8000, 32768, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
rt_sigreturn({mask=[]})                 = 537919511

is this a known failure mode?

Needs zmq3-dev on Debian + Ipython versions mismatch

Hi,

I encountered 2 pbs with cl-jupyter:

Ipython versions mismatch

First the installation script reported an Ipython version mismatch

... Frontend: using IPython v4.1
Error: mismatch ipython version (5.0 vs 4.1)
Abort.

I edited the script to carry on the installation and it worked.

zmq needed

Then as I ran a notebook I got two errors:

 fatal error: zmq.h: Aucun fichier ou dossier de ce type

for which I installed apt-get install libzmq-dev

right after I got The alien function "zmq_ctx_new" is undefined. for which I did apt-get install libzmq3-dev.

I don't know if the two are necessary.

Now I get a notebook working ! \o/

Nice work, cheers !

AttributeError: 'ZMQTerminalInteractiveShell' object has no attribute 'has_readline'

Followed the install instructions. Got the above error at the command $ jupyter console --kernel=lisp

$ jupyter --version
4.1.0
$ sbcl --version
SBCL 1.3.5.24.master.16-7c9f24e

zeromq version 4.1.5-1

On the sbcl side, there's an error message :PATHNAME #P"/home/bon/code/src/cl-jupyter/src/" :FORMAT-CONTROL "Can't LOAD a directory: ~s."

Eternal Loop Kernel Reset in Linux with Jupyter 4.1 and SBCL 1.3.1

CORRUPTION WARNING in SBCL pid 8320(tid 140737353799424):
Memory fault at (nil) (pc=0x10001b8d07, sp=0x7ffff2b27fb8)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
INFO: Control stack guard page unprotected
CORRUPTION WARNING in SBCL pid 8320(tid 140737353799424):
Enabling blocked gc signals to allow returning to Lisp without risking
gc deadlocks. Since GC signals are only blocked in signal handlers when 
they are not safe to interrupt at all, this is a pretty severe occurrence.

The integrity of this image is possibly compromised.
Continuing with fingers crossed.
fatal error encountered in SBCL pid 8320(tid 140737353799424):
maximum interrupt nesting depth (1024) exceeded

Always when I try eval some instrunction at any cell of jupyter I receive that message in kernel backend. After that the kernel is reloaded and restarted. Any ideas?

SBCL Lisp kernel keeps restarting (Looping)

Hello

I am running sbcl 1.3.14 together with slime and everything works fine in emacs. I also run jupyter 4.1.0 with a few kernels. which are working fine.

I am hoping to utilized the jupyter notebooks interface for my class but i am getting a kernel loop or restart anytime i launch the SBCL lisp. Below is the error. Assistance will be very much appreciated to resolve this issue.

`[I 11:55:57.920 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel d4136aa7-e963-4491-9023-914d7f1d690f restarted
This is SBCL 1.3.14, an implementation of ANSI Common Lisp.
More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
To load "cl-jupyter":
Load 1 ASDF system:
cl-jupyter
; Loading "cl-jupyter"
^C[I 11:55:58.681 NotebookApp] interrupted
Serving notebooks from local directory: /home/kofi/notebooks
1 active kernels
The Jupyter Notebook is running at: http://localhost:8888/
Shutdown this notebook server (y/[n])? ......

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((control_port . 37949) (shell_port . 45585)
(stdin_port . 57295) (signature_scheme . hmac-sha256)
(hb_port . 52669)
(key . 12b86afd-e852-471e-9d64-4b8ecb69833c)
(transport . tcp) (kernel_name . lisp)
(iopub_port . 59293) (ip . 127.0.0.1))
[Hearbeat] starting...
[Heartbeat] thread started
[Kernel] Entering mainloop ...
[Shell] loop started
Argh! corrupted error depth, halting
fatal error encountered in SBCL pid 795(tid 140737353875072):
%PRIMITIVE HALT called; the party is over.
`

Thanks

Integrating cl-jupyter-widgets with cl-jupyter

The future home of the cl-jupyter-widgets ASDF system is found here:

https://github.com/clasp-developers/cl-jupyter-widgets

It's not quite ready for prime-time - we need to take another run at cleaning up the documentation and the source code.

It's translated from the ipython widgets code and is compatible with iPython widgets 7.0

It works in Clasp - you can try it out using the docker image here...
https://hub.docker.com/r/drmeister/cando/

But there is a problem in sbcl that we haven't debugged yet.

You can test cl-jupyter-widgets by cloning this github repo into your ~/quicklisp/local-projects and using:
(ql:quickload "cl-jupyter-widgets")

The way we developed and tested this code is to insert print statements in the ipython-widgets code and turn on logging in cl-jupyter-widgets and then compare the JSON messages that are sent back and forth to the Common Lisp kernel with the traffic sent back and forth by a Python kernel. Once they match - the front end and Jupyter machinery can't tell the difference.

We are currently focused on getting everything working with the upcoming jupyter-lab environment. This is including some other jupyter widgets like cl-nglview and cl-bqplot.

Loading cl-jupyter.lisp does not work

Just learning LISP, so I have no idea what could be wrong here:

sbcl --load cl-jupyter.lisp

This is SBCL 1.2.11-1.fc22, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
... initialization mode... please wait...
To load "cl-jupyter":
  Load 1 ASDF system:
    cl-jupyter
; Loading "cl-jupyter"
............
; file: /home/xiaolong/quicklisp/dists/quicklisp/software/cffi_0.17.1/toolchain/asdf-compat.lisp
; in: DEFUN BUNDLE-PATHNAME-TYPE
;     ((UIOP/OS:OS-UNIX-P) "o")
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-WINDOWS-P)
;      (IF (UIOP/OS:FEATUREP '(:OR :MINGW32 :MINGW64))
;          "o"
;          "obj"))
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-UNIX-P) "a")
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-WINDOWS-P)
;      (IF (UIOP/OS:FEATUREP '(:OR :MINGW32 :MINGW64))
;          "a"
;          "lib"))
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-MACOSX-P) "dylib")
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-UNIX-P) "so")
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-WINDOWS-P) "dll")
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-UNIX-P) NIL)
; 
; caught ERROR:
;   illegal function call

;     ((UIOP/OS:OS-WINDOWS-P) "exe")
; 
; caught ERROR:
;   illegal function call
.
debugger invoked on a LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD "main thread" RUNNING {1002D5E9C3}>: Error while trying to load definition for system pzmq from pathname /home/xiaolong/quicklisp/dists/quicklisp/software/pzmq-20160531-git/pzmq.asd: COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "cffi-toolchain" "toolchain" "asdf-compat">

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry compiling #<CL-SOURCE-FILE "cffi-toolchain" "toolchain" "asdf-compat">.
  1: [ACCEPT                       ] Continue, treating compiling #<CL-SOURCE-FILE "cffi-toolchain" "toolchain" "asdf-compat"> as having been successful.
  2: [RETRY                        ] Retry EVAL of current toplevel form.
  3: [CONTINUE                     ] Ignore error and continue loading file "/home/xiaolong/quicklisp/dists/quicklisp/software/pzmq-20160531-git/pzmq.asd".
  4: [ABORT                        ] Abort loading file "/home/xiaolong/quicklisp/dists/quicklisp/software/pzmq-20160531-git/pzmq.asd".
  5:                                 Retry ASDF operation.
  6: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
  7:                                 Give up on "cl-jupyter"
  8:                                 Retry EVAL of current toplevel form.
  9:                                 Ignore error and continue loading file "/home/xiaolong/development/anaconda3/envs/lisp-notebook/cl-jupyter/cl-jupyter.lisp".
 10:                                 Abort loading file "/home/xiaolong/development/anaconda3/envs/lisp-notebook/cl-jupyter/cl-jupyter.lisp".
 11:                                 Ignore runtime option --load "cl-jupyter.lisp".
 12:                                 Skip rest of --eval and --load options.
 13:                                 Skip to toplevel READ/EVAL/PRINT loop.
 14: [EXIT                         ] Exit SBCL (calling #'EXIT, killing the process).

((FLET #:HANDLER1452 :IN ASDF/FIND-SYSTEM:LOAD-ASD) #<COMPILE-FILE-ERROR {10046BE7F3}>)
0] 

Why does the execution count stop at 64?

When I run the notebook below the execution count always stops at 64. Why?

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 1"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"("kenzo")"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(ql:quickload "kenzo")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"---done---"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:cat-init)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.2.2 Ordering the generators"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"F-CMPR\n",
"Args: (n1 n2)\n",
"Returns :LESS, :EQUAL, or :GREATER, according to the result of the canonical\n",
"comparison of the integers N1 and N2.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:f-cmpr 'function)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":LESS"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:f-cmpr 123 789)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"S-CMPR\n",
"Args: (symbol1 symbol2)\n",
"Returns :LESS, :EQUAL, or :GREATER, according to the result of the Lisp string\n",
"comparison function of the strings (SYMBOL-NAME SYMBOL1) and\n",
"(SYMBOL-NAME SYMBOL2).\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:s-cmpr 'function)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GREATER"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:s-cmpr 'circulation 'circular)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"L-CMPR\n",
"Args: (list1 list2)\n",
"Returns :LESS, :EQUAL, or :GREATER, according to the lexicographical ordering\n",
"of the generator lists LIST1 and LIST2.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:l-cmpr 'function)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GREATER"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:l-cmpr '(1 a b) '(1 a))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.2.3 Functions handling combinations"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"CMBN\n",
"Args: (degr &rest rest)\n",
"Returns a combination of degree DEGR from a sum of terms provided as a sequence\n",
"CF1 GNRT1 CF2 GNRT2 ... CFn GNRTn of coefficient / generator pairs in REST.\n",
"REST can be of arbitrary even length and can be empty, in which case the\n",
"combination is an instance of the null combination of degree DEGR.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:cmbn 'function)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * U>\n",
"<2 * V>\n",
"<3 * W>\n",
"<4 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def comb1 (cat:cmbn 1 1 'u 2 'v 3 'w 4 'z))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""-----------------------------------------------------------------[macro-doc]\n",
"CMBN-NON-ZERO-P\n",
"Args: (cmbn)\n",
"Tests if the combination CMBN is a non-null combination of any degree.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:cmbn-non-zero-p 'function)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"T"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:cmbn-non-zero-p comb1)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"((1 . U) (2 . V) (3 . W) (4 . Z))"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:cmbn-list comb1)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(3 . W)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def term3 (third (cat:cmbn-list comb1)))"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:cffc term3)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"W"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:gnrt term3)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"CMBN-OPPS\n",
"Args: (cmbn)\n",
"Returns the combination opposite combination of CMBN.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:cmbn-opps 'function)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<-1 * U>\n",
"<-2 * V>\n",
"<-3 * W>\n",
"<-4 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def mcomb1 (cat:cmbn-opps comb1))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"N-CMBN\n",
"Args: (n cmbn)\n",
"Returns N times the combination CMBN. N must be non-zero.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:n-cmbn 'function)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<10 * U>\n",
"<20 * V>\n",
"<30 * W>\n",
"<40 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def comb2 (cat:n-cmbn 10 comb1))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"2CMBN-ADD\n",
"Args: (cmpr cmbn1 cmbn2)\n",
"Returns the combination, which is the sum of CMBN1 and CMBN2. The first\n",
"argument, CMPR, must be a function or macro, which is used to compare the\n",
"generators of the combination arguments and to order the terms of the result\n",
"combination.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:2cmbn-add 'function)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<11 * U>\n",
"<22 * V>\n",
"<33 * W>\n",
"<44 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def cmb12 (cat:2cmbn-add #'cat:s-cmpr comb1 comb2))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"2CMBN-SBTR\n",
"Args: (cmpr cmbn1 cmbn2)\n",
"Returns the combination, which is the difference of CMBN1 and CMBN2. The first\n",
"argument, CMPR, must be a function or macro, which is used to compare the\n",
"generators of the combination arguments and to order the terms of the result\n",
"combination.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:2cmbn-sbtr 'function)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"NCMBN-ADD\n",
"Args: (cmpr cmbn &rest rest)\n",
"Returns the sum of an arbitrary number of combinations. The first argument,\n",
"CMPR, must be a function or macro, which is used to compare the generators of\n",
"the input combinations and to order the terms of the result combination.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:ncmbn-add 'function)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<55 * U>\n",
"<110 * V>\n",
"<165 * W>\n",
"<220 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:ncmbn-add #'cat:s-cmpr\n",
" comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.3.1 The function build-chcm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### A first example of a chain complex"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-cmpr #'cat:s-cmpr)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DMN) :IN "/home/gerd/git/fishbowl-repl/cl-jupyter.lisp") {10074481BB}>"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-basis #'(lambda (dmn)\n",
" (case dmn\n",
" (0 '(s0 s1 s2 s3 s4 s5))\n",
" (1 '(s01 s02 s12 s23 s34 s35 s45))\n",
" (2 '(s345))\n",
" (otherwise nil))))"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"S0"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-bspn 's0)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DMN GNR) :IN "/home/gerd/git/fishbowl-repl/cl-jupyter.lisp") {10075B669B}>"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-pure-dffr\n",
" #'(lambda (dmn gnr)\n",
" (unless (<= 0 dmn 2)\n",
" (error "Incorrect dimension for diabolo-dp."))\n",
" (case dmn\n",
" (0 (cat:cmbn -1)) ; Note the null combination of degree -1\n",
" (1 (case gnr\n",
" (s01 (cat:cmbn 0 -1 's0 1 's1))\n",
" (s02 (cat:cmbn 0 -1 's0 1 's2))\n",
" (s12 (cat:cmbn 0 -1 's1 1 's2))\n",
" (s23 (cat:cmbn 0 -1 's2 1 's3))\n",
" (s34 (cat:cmbn 0 -1 's3 1 's4))\n",
" (s35 (cat:cmbn 0 -1 's3 1 's5))\n",
" (s45 (cat:cmbn 0 -1 's4 1 's5))))\n",
" (2 (case gnr\n",
" (s345 (cat:cmbn 1 1 's34 -1 's35 1 's45))))\n",
" (otherwise (error "Bad generator for complex diabolo")))))"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GNRT"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-strt :GNRT)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(DIABOLO-FOR-EXAMPLE)"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo-orgn '(diabolo-for-example))"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"BUILD-CHCM\n",
"Args: (&key cmpr basis bsgn intr-dffr strt orgn)\n",
"Returns an instance of the class CHAIN-COMPLEX. The keyword arguments are as\n",
"follows:\n",
"\n",
":CMPR CMPR, the comparison function for generators\n",
"\n",
":BASIS BASIS, the function defining the basis of the freee Z-modules C_p or the\n",
" the keyword :LOCALLY-EFFECTIVE\n",
"\n",
":BSGN BSGN, a generator, the base point of the underlying set\n",
"\n",
":INTR-DFFR INTR-DFFR, a Lisp function defining the differential homomorphism\n",
" for each p (d_p: C_p -> C_{p-1}\n",
"\n",
":STRT STRT, one of the keywords :GNRT or :CMBN, defining the mapping strategy\n",
" of the differential homomorphism, either by generator or by\n",
" combination. The default is :GNRT\n",
"\n",
":ORGN ORGN, a list containing a relevant and carefully chosen comment about\n",
" the origin of the chain complex. This comment should be unique\n",
" for a Kenzo session (between calls of CAT-INIT), as it is used\n",
" for caching purposes.\n",
"\n",
"Use this function instead of creating instances via the standard constructor\n",
"MAKE-INSTANCE.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:build-chcm 'function)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def diabolo (cat:build-chcm :cmpr diabolo-cmpr :basis diabolo-basis\n",
" :bsgn diabolo-bspn :intr-dffr diabolo-pure-dffr\n",
" :strt diabolo-strt :orgn diabolo-orgn))"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"CHCM\n",
"Args: (idnm)\n",
"Return from the list CHCM-LIST the chain complex instance with Kenzo\n",
"identifier IDNUM or NIL, if it doesn't exist.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:chcm 'function)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:chcm 1)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(DIABOLO-FOR-EXAMPLE)"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:orgn diabolo)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:idnm diabolo)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S0 S1 S2 S3 S4 S5)"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:basis diabolo 0)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S01 S02 S12 S23 S34 S35 S45)"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:basis diabolo 1)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S345)"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:basis diabolo 2)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:basis diabolo 10)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * S34>\n",
"<-1 * S35>\n",
"<1 * S45>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:dffr diabolo 2 's345)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 0}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:dffr diabolo (cat:dffr diabolo 2 's345))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### An important trivial case: the unit chain complex, $\mathbb{Z}$"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Chain-Complex]"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def ZCC\n",
" (the cat:chain-complex\n",
" (cat:build-chcm\n",
" :cmpr #'(lambda (gnrt1 gnrt2)\n",
" (declare (ignore gnrt1 gnrt2))\n",
" (the cat:cmpr :equal))\n",
" :basis #'(lambda (n)\n",
" (the list\n",
" (if (zerop n) '(:Z-gnrt) cat:+empty-list+)))\n",
" :bsgn :Z-gnrt\n",
" :intr-dffr #'(lambda (cmbn)\n",
" (the cat:cmbn (cat:zero-cmbn (1- (cat:cmbn-degr cmbn)))))\n",
" :strt :cmbn\n",
" :orgn '(zcc-constant))))"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"Z-CHCM\n",
"Args: ()\n",
"Build the unit chain complex.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:z-chcm 'function)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The chain complex $\texttt{circle}$"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"CIRCLE"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(defun CIRCLE ()\n",
" (the cat:chain-complex\n",
" (cat:build-chcm\n",
" :cmpr #'(lambda (gnrt1 gnrt2)\n",
" (declare (ignore gnrt1 gnrt2))\n",
" (the cat:cmpr :equal))\n",
" :basis #'(lambda (dmns)\n",
" (the list\n",
" (case dmns (0 '()) (1 '(s1))\n",
" (otherwise cat:+empty-list+))))\n",
" :bsgn '
\n",
" :intr-dffr #'cat:zero-intr-dffr\n",
" :strt :cmbn\n",
" :orgn '(circle))))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1.4 Morphisms"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""-----------------------------------------------------------------[class-doc]\n",
"MORPHISM\n",
"Slots: (sorc trgt degr intr strt ???-clnm ?-clnm rslts idnm orgn)\n",
"Intances of this class represent morphisms between chain complexes, and the\n",
"differential homomorphism of a chain complex is treated as a morphism of\n",
"degree -1. The class has 10 slots:\n",
"\n",
"1. SORC, an object of class CHAIN-COMPLEX, the source chain complex of this\n",
" morphism.\n",
"\n",
"2. TRGT, an object of class CHAIN-COMPLEX, the target chain complex of this\n",
" morphism.\n",
"\n",
"3. DEGR, an integer, the degree of the morphism.\n",
"\n",
"4. INTR, a Lisp function implementing the morphism, taking account of the\n",
" strategy STRT.\n",
"\n",
"5. STRT, a symbol, one of :GNRT or :CMBN.\n",
"\n",
"6. ???-CLNM, an integer updated by the system for internal statistics.\n",
"\n",
"7. ?-CLNM, another integer maintained by the system for internal pusposes.\n",
"\n",
"8. RSLTS, an array of length +MAXIMAL-DIMENSION+ reserved by the system for\n",
" caching intermediate results.\n",
"\n",
"9. IDNM, an integer, a system-generated identifier for this object.\n",
"\n",
"10. ORGN, a list containg a comment indicating the origin of the object. The\n",
" should be unique (per session), since it is used in the implementation for\n",
" caching purposes.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:morphism 'type)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.1 The function $\texttt{build-mprh}$"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
""--------------------------------------------------------------[function-doc]\n",
"BUILD-MRPH\n",
"Args: (&key sorc trgt degr intr strt orgn)\n",
"Returns an instance of the class MORPHISM. The keyword arguments are as\n",
"follows:\n",
"\n",
":SORC SORC, the source object, a CHAIN-COMPLEX type object\n",
"\n",
":TRGT TRGT, the target object, a CHAIN-COMPLEX type object\n",
"\n",
":DEGR DEGR, the degree of the morphism, an integer\n",
"\n",
":INTR INTR, the Lisp function defining the effective mapping\n",
"\n",
":STRT STRT, one of the keywords :GNRT or :CMBN, defining the mapping strategy\n",
" of the differential homomorphism, either by generator or by\n",
" combination. The default is :GNRT\n",
"\n",
":ORGN ORGN, a list containing a relevant and carefully chosen comment about\n",
" the origin of the chain complex. This comment should be unique\n",
" for a Kenzo session (between calls of CAT-INIT), as it is used\n",
" for caching purposes.\n",
"\n",
"Use this function instead of creating instances via the standard constructor\n",
"MAKE-INSTANCE.\n",
"------------------------------------------------------------------------------""
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'cat:build-mrph 'function)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The differential homomorphism in a chain complex instance"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"---done---"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:cat-init)"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def ZCC (cat:z-chcm))"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Cohomology-Class on K1 of degree 1]"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def zero-morphism (cat:build-mrph :sorc ZCC\n",
" :trgt ZCC\n",
" :degr -1\n",
" :intr #'(lambda (comb)\n",
" (cat:cmbn (1- (cat:degr comb))))\n",
" :strt :cmbn\n",
" :orgn '(zero morphism on ZCC)))"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K4 Cohomology-Class on K1 of degree 0]"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def id-morphism (cat:build-mrph :sorc ZCC\n",
" :trgt ZCC\n",
" :degr 0\n",
" :intr #'identity\n",
" :strt :cmbn\n",
" :orgn '(identity morphism on ZCC)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.3 Functions defining morphisms"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DGR GNR) :IN "/home/gerd/git/fishbowl-repl/cl-jupyter.lisp") {100477BF4B}>"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def ccn-boundary #'(lambda (dgr gnr)\n",
" (if (evenp (+ dgr gnr))\n",
" (cat:cmbn (1- dgr) 1 (- gnr 10))\n",
" (cat:cmbn (1- dgr)))))"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K5 Chain-Complex]"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def ccn (cat:build-chcm :cmpr #'cat:f-cmpr\n",
" :basis #'(lambda (n) (cat:<a-b< (* 10 n) (* 10 (1+ n))))\n",
" :bsgn 0\n",
" :intr-dffr ccn-boundary\n",
" :strt :gnrt\n",
" :orgn '(ccn)))"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K7 Morphism (degree 1): K5 -> K5]"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def upper-shift (cat:build-mrph\n",
" :sorc ccn :trgt ccn :strt :gnrt :degr +1\n",
" :intr #'(lambda (d gn) (cat:cmbn (1+ d) 1 (+ gn 10)))\n",
" :orgn '(ccn shift +10)))"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K8 Morphism (degree -1): K5 -> K5]"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def lower-shift (cat:build-mrph\n",
" :sorc ccn :trgt ccn :strt :gnrt :degr -1\n",
" :intr #'(lambda (d gn) (cat:cmbn (1- d) 1 (- gn 10)))\n",
" :orgn '(ccn shift -10)))"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 12>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? ccn 2 22)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 0}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? ccn (cat:? ccn 2 22))"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 5}\n",
"<1 * 50>\n",
"<5 * 55>\n",
"<9 * 59>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def combn (cat:cmbn 5 1 50 5 55 9 59))"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 4}\n",
"<5 * 45>\n",
"<9 * 49>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? ccn combn)"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? ccn (cat:? ccn combn))"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 16>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? upper-shift 0 6)"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 4}\n",
"<1 * 41>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? lower-shift 5 51)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"<1 * 31>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? lower-shift (cat:? lower-shift 5 51))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def comb1 (cat:cmbn 1 1 10 2 11 3 12 4 13))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K9 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def identity? (cat:cmps upper-shift lower-shift))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:degr identity?)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? identity? comb1)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:2cmbn-sbtr (cat:cmpr ccn) comb1 (cat:? identity? comb1))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K10 Morphism (degree 2): K5 -> K5]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def upper-shift2 (cat:cmps upper-shift upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:degr upper-shift2)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"<1 * 30>\n",
"<2 * 31>\n",
"<3 * 32>\n",
"<4 * 33>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? upper-shift2 comb1)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K11 Morphism (degree 1): K5 -> K5]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def twice-up-shift (cat:add upper-shift upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:degr twice-up-shift)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 2}\n",
"<2 * 20>\n",
"<4 * 21>\n",
"<6 * 22>\n",
"<8 * 23>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? twice-up-shift comb1)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K12 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def up-d (cat:cmps upper-shift (cat:dffr1 ccn)))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K13 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def d-up (cat:cmps (cat:dffr1 ccn) upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 11>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? up-d 1 11)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? d-up 1 11)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"<5 * 14>\n",
"<6 * 15>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:def comb3 (cat:cmbn 1 1 10 2 11 3 12 4 13 5 14 6 15))"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<2 * 11>\n",
"<4 * 13>\n",
"<6 * 15>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? up-d comb3)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<3 * 12>\n",
"<5 * 14>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:? d-up comb3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.4 Accessing $\texttt{Kenzo}$ objects"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:k 1)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K1 Chain-Complex]\n",
" Origin: (Z-CHCM)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd 1)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Cohomology-Class on K1 of degree 1]"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:k 3)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K3 Cohomology-Class on K1 of degree 1]\n",
" Origin: (ZERO MORPHISM ON ZCC)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd 3)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K8 Morphism (degree -1): K5 -> K5]\n",
" Origin: (CCN SHIFT -10)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd 8)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K5 Chain-Complex]\n",
" Origin: (CCN)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd 5)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K9 Morphism (degree 0): K5 -> K5]\n",
" Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd 9)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K9 Morphism (degree 0): K5 -> K5]\n",
" Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT)\n",
"\n",
"\n",
"Object: [K8 Morphism (degree -1): K5 -> K5]\n",
" Origin: (CCN SHIFT -10)\n",
"\n",
"\n",
"Object: [K7 Morphism (degree 1): K5 -> K5]\n",
" Origin: (CCN SHIFT 10)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"(9 8 7)"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat:kd2 9)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SBCL Lisp",
"language": "lisp",
"name": "lisp"
},
"language_info": {
"codemirror_mode": "text/x-common-lisp",
"mimetype": "text/x-common-lisp",
"name": "common-lisp",
"pygments_lexer": "common-lisp",
"version": "X3J13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

Package ASDF does not exist.

Hi,

I wanted to try cl-jupyter the quick and dirty way (just starting to learn about lisp), and what I got was:

[I 16:12:43.298 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
This is SBCL 1.4.5.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
Unhandled SB-C::INPUT-ERROR-IN-LOAD in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                 {10005E85B3}>:
  READ error during LOAD:

    Package ASDF does not exist.

      Line: 3, Column: 29, File-Position: 150

      Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" {1001B73963}>

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10005E85B3}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SB-C::INPUT-ERROR-IN-LOAD {1001B75F83}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<SB-C::INPUT-ERROR-IN-LOAD {1001B75F83}>)
2: (INVOKE-DEBUGGER #<SB-C::INPUT-ERROR-IN-LOAD {1001B75F83}>)
3: (ERROR #<SB-C::INPUT-ERROR-IN-LOAD {1001B75F83}>)
4: (SB-C:COMPILER-ERROR SB-C::INPUT-ERROR-IN-LOAD :CONDITION #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {1001B75F23}> :STREAM #<SB-INT:FORM-TRACKING-STREAM for "file /home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" {1001B73963}>)
5: (SB-C::%DO-FORMS-FROM-INFO #<CLOSURE (LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) {1001B75A6B}> #<SB-C::SOURCE-INFO {1001B75A23}> SB-C::INPUT-ERROR-IN-LOAD)
6: (SB-INT:LOAD-AS-SOURCE #<SB-INT:FORM-TRACKING-STREAM for "file /home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" {1001B73963}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
7: ((FLET SB-FASL::THUNK :IN LOAD))
8: (SB-FASL::CALL-WITH-LOAD-BINDINGS #<CLOSURE (FLET SB-FASL::THUNK :IN LOAD) {7FFFF63E77DB}> #<SB-INT:FORM-TRACKING-STREAM for "file /home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" {1001B73963}>)
9: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-INT:FORM-TRACKING-STREAM for "file /home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" {1001B73963}> NIL)
10: (LOAD #P"/home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
11: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:LOAD . "/home/pollinta/Downloads/cl-jupyter-master/cl-jupyter.lisp") (:QUIT)))
12: (SB-IMPL::TOPLEVEL-INIT)
13: ((FLET SB-UNIX::BODY :IN SAVE-LISP-AND-DIE))
14: ((FLET "WITHOUT-INTERRUPTS-BODY-36" :IN SAVE-LISP-AND-DIE))
15: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))

unhandled condition in --disable-debugger mode, quitting

I have a clean SBCL installation on Ubuntu 18.04, and quite possibly I just need to know how to get asdf permanently - nothing had changed after running (require 'asdf) in sbcl.

CodeMirror colorization -- how is it supposed to work?

Hi Frederic, how is CodeMirror supposed to work? I expected that when I enter some input, the input cell would be colorized, but that doesn't seem to be working for me. Does it work for you? (Have I misunderstood -- is the colorization supposed to be applied to output, not input?)

I haven't tried updating to cl-jupyter -- I am working with the older fishbowl-repl instead. I don't know if that makes a difference.

Thanks in advance for any insight!

Multiple forms in code cell

It would be nice to have multiple forms inside a code cell without having to wrap multiple forms in a PROGN. It just adds a little extra noise. Currently when multiple forms are placed in a code cell only the first form is evaluated.

A few examples are failing

For instance, this is one (and the only one from messages.lisp) error message:

While evaluating the form starting at line 5, column 0
  of #P"C:/Users/Peeyush/git-clones/cl-jupyter/./cl-jupyter.lisp":

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {23FF2421}>:
  Failed example:
  Expression: "(ENCODE-JSON-TO-STRING *HEADER1* INDENT 0)"
  ==> expected: {
  "msg_id": "XXX-YYY-ZZZ-TTT",
  "username": "fredokun",
  "session": "AAA-BBB-CCC-DDD",
  "msg_type": "execute_request",
  "version": "5.0"
}
  ==> evaluated: {
  "msg_id": "XXX-YYY-ZZZ-TTT",
  "username": "fredokun",
  "session": "AAA-BBB-CCC-DDD",
  "msg_type": "execute_request",
  "version": "5.0"
}


Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [TRY-RECOMPILING              ] Recompile message and try loading it again
  1: [RETRY                        ] Retry
                                     loading FASL for #<CL-SOURCE-FILE "cl-jupyt
er" "message">.
  2: [ACCEPT                       ] Continue, treating
                                     loading FASL for #<CL-SOURCE-FILE "cl-jupyt
er" "message">
                                     as having been successful.
  3:                                 Retry ASDF operation.
  4: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  5: [ABORT                        ] Give up on "cl-jupyter"
  6: [RETRY                        ] Retry EVAL of current toplevel form.
  7: [CONTINUE                     ] Ignore error and continue loading file "C:\
\Users\\Peeyush\\git-clones\\cl-jupyter\\.\\cl-jupyter.lisp".
  8:                                 Abort loading file "C:\\Users\\Peeyush\\git
-clones\\cl-jupyter\\.\\cl-jupyter.lisp".
  9:                                 Ignore runtime option --load "./cl-jupyter.
lisp".
 10:                                 Skip rest of --eval and --load options.
 11:                                 Skip to toplevel READ/EVAL/PRINT loop.
 12: [EXIT                         ] Exit SBCL (calling #'EXIT, killing the proc
ess).

(SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for
"file C:\\Users\\Peeyush\\AppData\\Local\\common-lisp\\sbcl-1.2.16-win-x86\\C\\U
sers\\Peeyush\\git-clones\\cl-jupyter\\.\\src\\message.fasl" {25880A69}> :TABLE
#(385 SET *PACKAGE* "CL-JUPYTER" #<PACKAGE "CL-JUPYTER"> +KERNEL-PROTOCOL-VERSIO
N+ :STANDARD #<PACKAGE "SB-C"> SB-C::DELETED #(SB-C::DELETED) #(1 7 38 0 0 1 2 6
2 0 0) #() ...) :STACK #(0 FUNCALL #<FUNCTION ERROR> "Failed example:~%  Express
ion: ~S~%  ==> expected: ~A~%  ==> evaluated: ~A~%" "(ENCODE-JSON-TO-STRING *HEA
DER1* INDENT 0)" "{
  \"msg_id\": \"XXX-YYY-ZZZ-TTT\",
  \"username\": \"fredokun\",
  \"session\": \"AAA-BBB-CCC-DDD\",
  \"msg_type\": \"execute_request\",
  \"version\": \"5.0\"
}" "{
  \"msg_id\": \"XXX-YYY-ZZZ-TTT\",
  \"username\": \"fredokun\",
  \"session\": \"AAA-BBB-CCC-DDD\",
  \"msg_type\": \"execute_request\",
  \"version\": \"5.0\"
}" #(#S(SB-C::COMPILED-DEBUG-FUN :NAME (SB-C::TOP-LEVEL-FORM #) :KIND :TOPLEVEL
:VARS NIL :BLOCKS NIL :TLF-NUMBER 3 :FORM-NUMBER 1 :ARGUMENTS NIL :RETURNS :STAN
DARD :NFP NIL :START-PC 47 :ELSEWHERE-PC 132 :CLOSURE-SAVE NIL ...)) NIL "top le
vel form" #<SB-KERNEL:LAYOUT for SB-C::COMPILED-DEBUG-INFO {22345681}> 47 ...) :
DEPRECATED-STUFF NIL :SKIP-UNTIL NIL) NIL)

Similar to this, I've had to comment out quite a lot of examples from "myjson.lisp" file in order to get the "initialization done" message.

I'm using Windows 7/64bit if that might matter.

I'm including the list of examples that I commented out from "myjson.lisp" for the precompilation to run without errors:

; (example (with-input-from-string (s "this is a \\\"string\" and the rest")
;       (parse-json-string s))
;     => "this is a \"string")


; (example (with-input-from-string (s "this is a \\\"string with a \\n newline\" and the rest")
;           (parse-json-string s))
;          => "this is a \"string with a 
;  newline")

; (example (with-output-to-string (stream)
;      (let ((toto '(me toto)))
;        (json-write stream 2 t (format nil "blabla ~A" toto))))
;      => "    blabla (ME TOTO)
; ")

; (example 
;  (encode-json-to-string "help me \"man\"
; yeah !")
;  => "\"help me \\\"man\\\"\\nyeah !\"")

;(example
; (encode-json-to-string '(("name" . "frederic")
;             ("age" . 41)
;             ("geek" . :true)
;             ("socks" . :null)))
; => "{\"name\": \"frederic\",\"age\": 41,\"geek\": true,\"socks\": null}")

;(example
; (encode-json-to-string '(("name" . "frederic")
;             ("age" . 41)
;             ("geek" . :true)
;             ("socks" . :null)) :indent 0)
; => "{
;  \"name\": \"frederic\",
;  \"age\": 41,
;  \"geek\": true,
;  \"socks\": null
;}")

code can't be executed there is warning

when I try to execute this a cell :
In [6]:
(dolist (i '(1 2 3))
  (format t "hello"))

I get this:
;
; compilation unit aborted
; caught 1 fatal ERROR condition

SIMPLE-STYLE-WARNING:
The variable I is defined but never used.
Out [6]: Nil

and the format function seems not be called, and the same can be executed with sbcl and slime.

Trying to access undefined foreign variable "errno"

I'm getting the following error in the command line window when I load jupyter up in the browser and select new notebook -> SBCL Lisp

C:\Users\Peeyush\tmp>jupyter notebook
[I 12:23:21.648 NotebookApp] Serving notebooks from local directory: C:\Users\Pe
eyush\tmp
[I 12:23:21.649 NotebookApp] 0 active kernels
[I 12:23:21.649 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/
[I 12:23:21.650 NotebookApp] Use Control-C to stop this server and shut down all
 kernels (twice to skip confirmation).
[I 12:23:32.935 NotebookApp] 302 GET / (127.0.0.1) 1.00ms
[I 12:23:57.850 NotebookApp] Creating new notebook in
This is SBCL 1.2.16, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

WARNING: the Windows port is fragile, particularly for multithreaded
code.  Unfortunately, the development team currently lacks the time
and resources this platform demands.
[I 12:24:01.104 NotebookApp] Kernel started: 9e542d8b-1737-4aa2-b8ab-e9342a1a889
e
To load "cffi":
  Load 1 ASDF system:
    cffi
; Loading "cffi"
........
To load "cl-jupyter":
  Load 1 ASDF system:
    cl-jupyter
; Loading "cl-jupyter"
.......

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((transport . tcp) (shell_port . 51334)
                        (stdin_port . 51336)
                        (key . 56c9dc0a-4b80-47a8-869a-6f694f9b80ec)
                        (signature_scheme . hmac-sha256) (kernel_name . lisp)
                        (iopub_port . 51335) (control_port . 51337)
                        (hb_port . 51338) (ip . 127.0.0.1))
While evaluating the form starting at line 51, column 0
  of #P"C:/Users/Peeyush/git-clones/cl-jupyter/cl-jupyter.lisp":
Unhandled SIMPLE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                    {23FF27B1}>:
  Trying to access undefined foreign variable "errno".

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {23FF27B1}>
0: ((LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX))
1: (SB-IMPL::CALL-WITH-SANE-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCAL
L-WITH-DEBUG-IO-SYNTAX) {25D20315}>)
2: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCAL
L-WITH-DEBUG-IO-SYNTAX) {25D202FD}>)
3: (SB-DEBUG:PRINT-BACKTRACE :STREAM #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDERR* {2
23BC961}> :START 0 :FROM :INTERRUPTED-FRAME :COUNT NIL :PRINT-THREAD T :PRINT-FR
AME-SOURCE NIL :METHOD-FRAME-STYLE NIL)
4: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SIMPLE-ERROR "Trying to access undefined
foreign variable ~S." {25D1DE39}> #<unavailable argument>)
5: (SB-DEBUG::RUN-HOOK SB-EXT:*INVOKE-DEBUGGER-HOOK* #<SIMPLE-ERROR "Trying to a
ccess undefined foreign variable ~S." {25D1DE39}>)
6: (INVOKE-DEBUGGER #<SIMPLE-ERROR "Trying to access undefined foreign variable
~S." {25D1DE39}>)
7: (ERROR "Trying to access undefined foreign variable ~S." "errno")
8: (CFFI::FS-POINTER-OR-LOSE "errno" :DEFAULT)
9: ((SETF PZMQ::%VAR-ACCESSOR-ERRNO) 0)
10: (PZMQ:SOCKET #.(SB-SYS:INT-SAP #X005E89B8) :ROUTER)
11: (CL-JUPYTER::MAKE-SHELL-CHANNEL #<CL-JUPYTER::KERNEL {25CC3861}>)
12: (KERNEL-START)
13: (SB-INT:SIMPLE-EVAL-IN-LEXENV (KERNEL-START) #<NULL-LEXENV>)
14: (SB-EXT:EVAL-TLF (KERNEL-START) 5 #<NULL-LEXENV>)
15: ((LABELS SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE) (KERNEL-START) 5)
16: ((LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:L
OAD-AS-SOURCE) (KERNEL-START) :CURRENT-INDEX 5)
17: (SB-C::%DO-FORMS-FROM-INFO #<CLOSURE (LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-I
NDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) {25983995}> #<SB-C::SOURCE-IN
FO {25983971}> SB-C::INPUT-ERROR-IN-LOAD)
18: (SB-INT:LOAD-AS-SOURCE #<SB-INT:FORM-TRACKING-STREAM for "file C:\\Users\\Pe
eyush\\git-clones\\cl-jupyter\\cl-jupyter.lisp" {25980C11}> :VERBOSE NIL :PRINT
NIL :CONTEXT "loading")
19: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-INT:FORM-TRACKING-STREAM for "fil
e C:\\Users\\Peeyush\\git-clones\\cl-jupyter\\cl-jupyter.lisp" {25980C11}> NIL)
20: (LOAD #P"C:/Users/Peeyush/git-clones/cl-jupyter/cl-jupyter.lisp" :VERBOSE NI
L :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
21: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:LOAD . "C:\\Users\\Peeyush\\git-clone
s\\cl-jupyter\\cl-jupyter.lisp") (:QUIT)))
22: (SB-IMPL::TOPLEVEL-INIT)
23: ((FLET #:WITHOUT-INTERRUPTS-BODY-94 :IN SB-EXT:SAVE-LISP-AND-DIE))
24: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))
25: ("foreign function: #x42BF70")
26: ("foreign function: #x416F36")

unhandled condition in --disable-debugger mode, quitting

The browser window shows a prompt telling me that kernel has died and will restart.

I get the same error when I try >jupyter console --kernel=lisp

I can't make out what's going on. Do you have any clue as to what is causing this?

cl-jupyter fails on Windows if started on a different drive than it was installed on

When jupyter is started on a drive which is different from the drive where cl-jupyter was installed, the cl-jupyter kernel does not start any more on Windows. This failure is caused by registration code in cl-jupyter.lisp:

(push (truename (format nil "~Asrc/" (directory-namestring *load-truename*)))
          asdf:*central-registry*)

On Windows (directory-namestring *load-truename*) does not include the drive letter. Therefore, if the lisp kernel is started from a drive different, it fails. I have fixed this locally in cl-jupyter.lisp like so:

(if (member :win32 *features*)
   (push (truename (format nil "~A:~Asrc/" (pathname-device *load-truename*)(directory-namestring *load-truename*)))
          asdf:*central-registry*)
;else
   (push (truename (format nil "~Asrc/" (directory-namestring *load-truename*)))
          asdf:*central-registry*)
)

This works on SBCL and Clisp. I'm not sure about other lisp flavors

WetHat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.