OSDN Git Service

Misc cruft.
authorSimon Forman <sforman@hushmail.com>
Wed, 7 Sep 2022 16:28:30 +0000 (09:28 -0700)
committerSimon Forman <sforman@hushmail.com>
Wed, 7 Sep 2022 16:28:30 +0000 (09:28 -0700)
docs/notebooks/Joy-in-Jupyter.ipynb
docs/notebooks/README.md
docs/notebooks/jupyter_kernel/Try out the Joypy Jupyter Kernel.ipynb
implementations/Python/joy/parser.py

index 3958691..606dd74 100644 (file)
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "!= % & * *fraction *fraction0 + ++ - -- / // /floor < << <= <> = > >= >> ? ^ _Tree_add_Ee _Tree_delete_R0 _Tree_delete_clear_stuff _Tree_get_E abs add anamorphism and app1 app2 app3 at average b binary bool branch ccons choice clear cleave cmp 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 gt help i id ifte ii infra inscribe le least_fraction loop lshift lt make_generator map max min mod modulus mul ne neg not nullary of or over pam parse pick pm pop popd popdd popop popopd popopdd pow pred primrec product quoted range range_to_zero rem remainder remove rest reverse roll< roll> rolldown rollup round rrest rshift run second select sharing shunt size sort sqr sqrt stack step step_zero stuncons stununcons sub succ sum swaack swap swoncat swons tailrec take ternary third times trace truthy tuck unary uncons unique unit unquoted unstack unswons void warranty while words x xor zip •\n",
+      "!- != % & && * + ++ - -- / // /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 || •\n",
       "\n"
      ]
     }
index 48e2658..39a8871 100644 (file)
@@ -92,6 +92,12 @@ __Looks at code__ Oh FFS
 
 Done.  Can start joy kernal notebooks.
 
+But really you want to use the `--name` switch:
+
+    In Joypy/docs/notebooks/jupyter_kernel:
+    % jupyter kernelspec install --user --name=thun .
+    [InstallKernelSpec] Installed kernelspec thun in /usr/home/sforman/.local/share/jupyter/kernels/thun
+
 ## Building and Uploading
 
 This section is mostly for my own reference.
index f254555..374ae62 100644 (file)
   {
    "cell_type": "code",
    "execution_count": 8,
-   "metadata": {},
+   "metadata": {
+    "scrolled": false
+   },
    "outputs": [
     {
      "name": "stdout",
index 3e31a80..4b6f2f0 100644 (file)
@@ -45,9 +45,16 @@ from joy.utils.snippets import (
     )
 
 
-BRACKETS = r'\[|\]'
-BLANKS = r'\s+'
-WORDS = r'[^[\]\s]+'
+BRACKETS = r'\[|\]'  # Left or right square bracket.
+BLANKS = r'\s+'  # One-or-more blankspace.
+WORDS = (
+    '['  # Character class
+        '^'   # not a
+        '['   # left square bracket nor a
+        '\]'  # right square bracket (escaped so it doesn't close the character class)
+        '\s'  # nor blankspace
+    ']+'  # end character class, one-or-more.
+    )
 
 
 token_scanner = Scanner([