{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "61944c2e",
   "metadata": {},
   "source": [
    "Using the Joypy (Thun) Jupyter kernal."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f7bb85e5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "41"
     ]
    }
   ],
   "source": [
    "23 18 +"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "cbc09c4a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "41 123"
     ]
    }
   ],
   "source": [
    "123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f310ec86",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5043"
     ]
    }
   ],
   "source": [
    "*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8d86c75f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "clear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ff9b5754",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15"
     ]
    }
   ],
   "source": [
    "45 30 gcd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e1027ca3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "clear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "aef6f509",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "!- != % & && * + ++ - -- / // /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"
     ]
    }
   ],
   "source": [
    "words"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "904ce05e",
   "metadata": {},
   "source": [
    "``trace`` is only loaded in the ``pretty_printer.py`` module, so it's not automatically included in the dictionary in the kernel.\n",
    "\n",
    "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.)\n",
    "\n",
    "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.\n",
    "\n",
    "This would seem to indicate that I should polish the Joy kernel, eh?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f491e33f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 +]"
     ]
    }
   ],
   "source": [
    "[1 2 +]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "31d6ec54",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    • 1 2 +\n",
      "  1 • 2 +\n",
      "1 2 • +\n",
      "  3 • \n",
      "\n",
      "3"
     ]
    }
   ],
   "source": [
    "trace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f85a149a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "clear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2e13763d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[dup cons]"
     ]
    }
   ],
   "source": [
    "[dup cons]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e4509e6a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "           [dup cons] • x\n",
      "           [dup cons] • dup cons\n",
      "[dup cons] [dup cons] • cons\n",
      "[[dup cons] dup cons] • \n",
      "\n",
      "[[dup cons] dup cons]"
     ]
    }
   ],
   "source": [
    "[x] trace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8170053c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[dup cons] dup cons] • i\n",
      "                      • [dup cons] dup cons\n",
      "           [dup cons] • dup cons\n",
      "[dup cons] [dup cons] • cons\n",
      "[[dup cons] dup cons] • \n",
      "\n",
      "[[dup cons] dup cons]"
     ]
    }
   ],
   "source": [
    "[i] trace"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "50c24687",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": []
    }
   ],
   "source": [
    "clear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "21c86a84",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Joypy",
   "language": "",
   "name": "thun"
  },
  "language_info": {
   "file_extension": ".joy",
   "mimetype": "text/plain",
   "name": "Joy"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
