# Joy-in-Jupyter

Using the Joypy (Thun) Jupyter kernal.

In [1]:

    23 18 +

    41

In [2]:

    123

    41 123

In [3]:

    *

    5043

In [4]:

    clear

In [5]:

    45 30 gcd

    15

In [6]:

    clear

In [7]:

    words

    !- != % & && * + ++ - -- / // /floor < << <<{} <= <> <{} = > >= >> ? ^ _Tree_add_Ee _Tree_delete_R0 _Tree_delete_clear_stuff _Tree_get_E _map0 _map1 _map2 _map? _mape _step0 _step1 _stept _times0 _times1 _timest abs add anamorphism and app1 app2 app3 appN at average b binary bool branch ccccons ccons choice clear cleave clop cmp codi codireco concat cond cons dinfrirst dip dipd dipdd disenstacken div divmod down_to_zero drop dup dupd dupdd dupdip dupdipd enstacken eq first first_two flatten floor floordiv fork fourth gcd gcd2 ge genrec getitem grabN grba gt help hypot i id ifte ii infra infrst inscribe le loop lshift lt make_generator map max min mod modulus mul ne neg not nulco nullary of or over pam pick pm pop popd popdd popop popopd popopdd popopop pow pred primrec product quoted range range_to_zero reco rem remainder remove rest reverse roll< roll> rolldown rollup round rrest rshift run second select sharing shift shunt size sort spiral_next split_at split_list sqr sqrt stack stackd step step_zero stuncons stununcons sub succ sum swaack swap swapd swoncat swons tailrec take ternary third times trace truthy tuck unary uncons unique unit unquoted unswons void warranty while words x xor zip || •

`trace` is only loaded in the `pretty_printer.py` module, so it's not automatically included in the dictionary in the kernel.

Stdout is also not captured and returned to the notebook. (So `words` doesn't work, for example, and neither would `trace` if it was available, I imagine.)

Also, exceptions (like `trace` not being found in the dictionary) lead to the kernal "hanging" in the sense that you just see the "pending computation" asterix in the notebook cell.

This would seem to indicate that I should polish the Joy kernel, eh?

In [8]:

    [1 2 +]

    [1 2 +]

In [9]:

    trace

        • 1 2 +
      1 • 2 +
    1 2 • +
      3 •

    3

In [10]:

    clear

In [11]:

    [dup cons]

    [dup cons]

In [12]:

    [x] trace

               [dup cons] • x
               [dup cons] • dup cons
    [dup cons] [dup cons] • cons
    [[dup cons] dup cons] •

    [[dup cons] dup cons]

In [13]:

    [i] trace

    [[dup cons] dup cons] • i
                          • [dup cons] dup cons
               [dup cons] • dup cons
    [dup cons] [dup cons] • cons
    [[dup cons] dup cons] •

    [[dup cons] dup cons]

In [14]:

    clear

In [ ]: