Examples (and some documentation) for the Words in the Library
==============================================================
-.. code:: ipython2
+.. code:: ipython3
from notebook_preamble import J, V
``clear``
~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 clear')
``dup`` ``dupd``
~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 dup')
1 2 3 3
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 dupd')
Replace the stack with a quote of itself.
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 enstacken')
Unpack a list onto the stack.
-.. code:: ipython2
+.. code:: ipython3
J('4 5 6 [3 2 1] unstack')
Get the stack on the stack.
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 stack')
Replace the stack with the list on top. The items appear reversed but
they are not, is on the top of both the list and the stack.
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 [4 5 6] disenstacken')
``pop`` ``popd`` ``popop``
~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 pop')
1 2
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 popd')
1 3
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 popop')
The "down" and "up" refer to the movement of two of the top three items
(displacing the third.)
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 roll<')
2 3 1
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 roll>')
``swap``
~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 swap')
``tuck`` ``over``
~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 tuck')
1 3 2 3
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 over')
``unit`` ``quoted`` ``unquoted``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 unit')
1 2 [3]
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 quoted')
1 [2] 3
-.. code:: ipython2
+.. code:: ipython3
J('1 [2] 3 unquoted')
1 2 3
-.. code:: ipython2
+.. code:: ipython3
V('1 [dup] 3 unquoted') # Unquoting evaluates. Be aware.
.. parsed-literal::
- . 1 [dup] 3 unquoted
- 1 . [dup] 3 unquoted
- 1 [dup] . 3 unquoted
- 1 [dup] 3 . unquoted
- 1 [dup] 3 . [i] dip
- 1 [dup] 3 [i] . dip
- 1 [dup] . i 3
- 1 . dup 3
- 1 1 . 3
- 1 1 3 .
+ • 1 [dup] 3 unquoted
+ 1 • [dup] 3 unquoted
+ 1 [dup] • 3 unquoted
+ 1 [dup] 3 • unquoted
+ 1 [dup] 3 • [i] dip
+ 1 [dup] 3 [i] • dip
+ 1 [dup] • i 3
+ 1 • dup 3
+ 1 1 • 3
+ 1 1 3 •
List words
``concat`` ``swoncat`` ``shunt``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] [4 5 6] concat')
[1 2 3 4 5 6]
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] [4 5 6] swoncat')
[4 5 6 1 2 3]
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] [4 5 6] shunt')
``cons`` ``swons`` ``uncons``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 [2 3] cons')
[1 2 3]
-.. code:: ipython2
+.. code:: ipython3
J('[2 3] 1 swons')
[1 2 3]
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] uncons')
``first`` ``second`` ``third`` ``rest``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] first')
1
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] second')
2
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] third')
3
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] rest')
``flatten``
~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[[1] [2 [3] 4] [5 6]] flatten')
``at`` and ``getitem`` are the same function. ``of == swap at``
-.. code:: ipython2
+.. code:: ipython3
J('[10 11 12 13 14] 2 getitem')
12
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] 0 at')
1
-.. code:: ipython2
+.. code:: ipython3
J('2 [1 2 3 4] of')
3
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] 2 drop')
[3 4]
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] 2 take') # reverses the order
``remove``
~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 1 4] 1 remove')
``reverse``
~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 4] reverse')
``size``
~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 1 1 1] size')
put the old stack on top of the new one. Think of it as a context
switch. Niether of the lists/stacks change their order.
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 [4 5 6] swaack')
``choice`` ``select``
~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 1 choice')
9
-.. code:: ipython2
+.. code:: ipython3
J('23 9 0 choice')
23
-.. code:: ipython2
+.. code:: ipython3
J('[23 9 7] 1 select') # select is basically getitem, should retire it?
9
-.. code:: ipython2
+.. code:: ipython3
J('[23 9 7] 0 select')
``zip``
~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] [6 5 4] zip')
[[6 1] [5 2] [4 3]]
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3] [6 5 4] zip [sum] map')
``+`` ``add``
~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 +')
``-`` ``sub``
~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 -')
``*`` ``mul``
~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 *')
``/`` ``div`` ``floordiv`` ``truediv``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 /')
2.5555555555555554
-.. code:: ipython2
+.. code:: ipython3
J('23 -9 truediv')
-2.5555555555555554
-.. code:: ipython2
+.. code:: ipython3
J('23 9 div')
2.5555555555555554
-.. code:: ipython2
+.. code:: ipython3
J('23 9 floordiv')
2
-.. code:: ipython2
+.. code:: ipython3
J('23 -9 div')
-2.5555555555555554
-.. code:: ipython2
+.. code:: ipython3
J('23 -9 floordiv')
``%`` ``mod`` ``modulus`` ``rem`` ``remainder``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 %')
``neg``
~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 neg -5 neg')
pow
~~~
-.. code:: ipython2
+.. code:: ipython3
J('2 10 pow')
``sqr`` ``sqrt``
~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 sqr')
529
-.. code:: ipython2
+.. code:: ipython3
J('23 sqrt')
``++`` ``succ`` ``--`` ``pred``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 ++')
2
-.. code:: ipython2
+.. code:: ipython3
J('1 --')
``<<`` ``lshift`` ``>>`` ``rshift``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('8 1 <<')
16
-.. code:: ipython2
+.. code:: ipython3
J('8 1 >>')
``average``
~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 5] average')
``range`` ``range_to_zero`` ``down_to_zero``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('5 range')
[4 3 2 1 0]
-.. code:: ipython2
+.. code:: ipython3
J('5 range_to_zero')
[0 1 2 3 4 5]
-.. code:: ipython2
+.. code:: ipython3
J('5 down_to_zero')
``product``
~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 5] product')
``sum``
~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 5] sum')
``min``
~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 3 5] min')
``gcd``
~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('45 30 gcd')
If we represent fractions as a quoted pair of integers [q d] this word
reduces them to their ... least common factors or whatever.
-.. code:: ipython2
+.. code:: ipython3
J('[45 30] least_fraction')
[3.0 2.0]
-.. code:: ipython2
+.. code:: ipython3
J('[23 12] least_fraction')
Get the Boolean value of the item on the top of the stack.
-.. code:: ipython2
+.. code:: ipython3
J('23 truthy')
True
-.. code:: ipython2
+.. code:: ipython3
J('[] truthy') # Python semantics.
False
-.. code:: ipython2
+.. code:: ipython3
J('0 truthy')
? == dup truthy
-.. code:: ipython2
+.. code:: ipython3
V('23 ?')
.. parsed-literal::
- . 23 ?
- 23 . ?
- 23 . dup truthy
- 23 23 . truthy
- 23 True .
+ • 23 ?
+ 23 • ?
+ 23 • dup truthy
+ 23 23 • truthy
+ 23 True •
-.. code:: ipython2
+.. code:: ipython3
J('[] ?')
[] False
-.. code:: ipython2
+.. code:: ipython3
J('0 ?')
``&`` ``and``
~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 &')
``!=`` ``<>`` ``ne``
~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('23 9 !=')
``^`` ``xor``
~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 1 ^')
0
-.. code:: ipython2
+.. code:: ipython3
J('1 0 ^')
``help``
~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[help] help')
``parse``
~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[parse] help')
-.. code:: ipython2
+.. code:: ipython3
J('1 "2 [3] dup" parse')
Evaluate a quoted Joy sequence.
-.. code:: ipython2
+.. code:: ipython3
J('[1 2 dup + +] run')
``app1`` ``app2`` ``app3``
~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[app1] help')
program.
::
- ... x [Q] . app1
- -----------------------------------
- ... [x ...] [Q] . infra first
+ ... x [Q] . app1
+ -----------------------------------
+ ... [x ...] [Q] . infra first
---- end (app1)
-.. code:: ipython2
+.. code:: ipython3
J('10 4 [sqr *] app1')
10 160
-.. code:: ipython2
+.. code:: ipython3
J('10 3 4 [sqr *] app2')
10 90 160
-.. code:: ipython2
+.. code:: ipython3
J('[app2] help')
Like app1 with two items.
::
- ... y x [Q] . app2
- -----------------------------------
- ... [y ...] [Q] . infra first
- [x ...] [Q] infra first
+ ... y x [Q] . app2
+ -----------------------------------
+ ... [y ...] [Q] . infra first
+ [x ...] [Q] infra first
---- end (app2)
-.. code:: ipython2
+.. code:: ipython3
J('10 2 3 4 [sqr *] app3')
range == [0 <=] [1 - dup] anamorphism
-.. code:: ipython2
+.. code:: ipython3
J('3 [0 <=] [1 - dup] anamorphism')
``branch``
~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('3 4 1 [+] [*] branch')
12
-.. code:: ipython2
+.. code:: ipython3
J('3 4 0 [+] [*] branch')
cleave == [i] app2 [popd] dip
-.. code:: ipython2
+.. code:: ipython3
J('10 2 [+] [-] cleave')
``dip`` ``dipd`` ``dipdd``
~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] dip')
1 2 7 5
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] dipd')
1 5 4 5
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] dipdd')
n [Q] dupdip == n Q n
-.. code:: ipython2
+.. code:: ipython3
V('23 [++] dupdip *') # N(N + 1)
.. parsed-literal::
- . 23 [++] dupdip *
- 23 . [++] dupdip *
- 23 [++] . dupdip *
- 23 . ++ 23 *
- 24 . 23 *
- 24 23 . *
- 552 .
+ • 23 [++] dupdip *
+ 23 • [++] dupdip *
+ 23 [++] • dupdip *
+ 23 • ++ 23 *
+ 24 • 23 *
+ 24 23 • *
+ 552 •
``genrec`` ``primrec``
~~~~~~~~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[genrec] help')
General Recursion Combinator.
::
- [if] [then] [rec1] [rec2] genrec
- ---------------------------------------------------------------------
- [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
+ [if] [then] [rec1] [rec2] genrec
+ ---------------------------------------------------------------------
+ [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
From "Recursion Theory and Joy" (j05cmp.html) by Manfred von Thun:
"The genrec combinator takes four program parameters in addition to
For example, given a (general recursive) function 'F':
::
- F == [I] [T] [R1] [R2] genrec
+ F == [I] [T] [R1] [R2] genrec
If the [I] if-part fails you must derive R1 and R2 from:
::
- ... R1 [F] R2
+ ... R1 [F] R2
Just set the stack arguments in front, and figure out what R1 and R2
have to do to apply the quoted [F] in the proper way. In effect, the
the original definition in the else-part:
::
- F == [I] [T] [R1] [R2] genrec
- == [I] [T] [R1 [F] R2] ifte
+ F == [I] [T] [R1] [R2] genrec
+ == [I] [T] [R1 [F] R2] ifte
Primitive recursive functions are those where R2 == i.
::
- P == [I] [T] [R] primrec
- == [I] [T] [R [P] i] ifte
- == [I] [T] [R P] ifte
+ P == [I] [T] [R] tailrec
+ == [I] [T] [R [P] i] ifte
+ == [I] [T] [R P] ifte
---- end (genrec)
-.. code:: ipython2
+.. code:: ipython3
J('3 [1 <=] [] [dup --] [i *] genrec')
``i``
~~~~~
-.. code:: ipython2
+.. code:: ipython3
V('1 2 3 [+ +] i')
.. parsed-literal::
- . 1 2 3 [+ +] i
- 1 . 2 3 [+ +] i
- 1 2 . 3 [+ +] i
- 1 2 3 . [+ +] i
- 1 2 3 [+ +] . i
- 1 2 3 . + +
- 1 5 . +
- 6 .
+ • 1 2 3 [+ +] i
+ 1 • 2 3 [+ +] i
+ 1 2 • 3 [+ +] i
+ 1 2 3 • [+ +] i
+ 1 2 3 [+ +] • i
+ 1 2 3 • + +
+ 1 5 • +
+ 6 •
``ifte``
[predicate] [then] [else] ifte
-.. code:: ipython2
+.. code:: ipython3
J('1 2 [1] [+] [*] ifte')
3
-.. code:: ipython2
+.. code:: ipython3
J('1 2 [0] [+] [*] ifte')
``infra``
~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
V('1 2 3 [4 5 6] [* +] infra')
.. parsed-literal::
- . 1 2 3 [4 5 6] [* +] infra
- 1 . 2 3 [4 5 6] [* +] infra
- 1 2 . 3 [4 5 6] [* +] infra
- 1 2 3 . [4 5 6] [* +] infra
- 1 2 3 [4 5 6] . [* +] infra
- 1 2 3 [4 5 6] [* +] . infra
- 6 5 4 . * + [3 2 1] swaack
- 6 20 . + [3 2 1] swaack
- 26 . [3 2 1] swaack
- 26 [3 2 1] . swaack
- 1 2 3 [26] .
+ • 1 2 3 [4 5 6] [* +] infra
+ 1 • 2 3 [4 5 6] [* +] infra
+ 1 2 • 3 [4 5 6] [* +] infra
+ 1 2 3 • [4 5 6] [* +] infra
+ 1 2 3 [4 5 6] • [* +] infra
+ 1 2 3 [4 5 6] [* +] • infra
+ 6 5 4 • * + [3 2 1] swaack
+ 6 20 • + [3 2 1] swaack
+ 26 • [3 2 1] swaack
+ 26 [3 2 1] • swaack
+ 1 2 3 [26] •
``loop``
~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[loop] help')
Basic loop combinator.
::
- ... True [Q] loop
+ ... True [Q] loop
-----------------------
- ... Q [Q] loop
+ ... Q [Q] loop
- ... False [Q] loop
+ ... False [Q] loop
------------------------
- ...
+ ...
---- end (loop)
-.. code:: ipython2
+.. code:: ipython3
V('3 dup [1 - dup] loop')
.. parsed-literal::
- . 3 dup [1 - dup] loop
- 3 . dup [1 - dup] loop
- 3 3 . [1 - dup] loop
- 3 3 [1 - dup] . loop
- 3 . 1 - dup [1 - dup] loop
- 3 1 . - dup [1 - dup] loop
- 2 . dup [1 - dup] loop
- 2 2 . [1 - dup] loop
- 2 2 [1 - dup] . loop
- 2 . 1 - dup [1 - dup] loop
- 2 1 . - dup [1 - dup] loop
- 1 . dup [1 - dup] loop
- 1 1 . [1 - dup] loop
- 1 1 [1 - dup] . loop
- 1 . 1 - dup [1 - dup] loop
- 1 1 . - dup [1 - dup] loop
- 0 . dup [1 - dup] loop
- 0 0 . [1 - dup] loop
- 0 0 [1 - dup] . loop
- 0 .
+ • 3 dup [1 - dup] loop
+ 3 • dup [1 - dup] loop
+ 3 3 • [1 - dup] loop
+ 3 3 [1 - dup] • loop
+ 3 • 1 - dup [1 - dup] loop
+ 3 1 • - dup [1 - dup] loop
+ 2 • dup [1 - dup] loop
+ 2 2 • [1 - dup] loop
+ 2 2 [1 - dup] • loop
+ 2 • 1 - dup [1 - dup] loop
+ 2 1 • - dup [1 - dup] loop
+ 1 • dup [1 - dup] loop
+ 1 1 • [1 - dup] loop
+ 1 1 [1 - dup] • loop
+ 1 • 1 - dup [1 - dup] loop
+ 1 1 • - dup [1 - dup] loop
+ 0 • dup [1 - dup] loop
+ 0 0 • [1 - dup] loop
+ 0 0 [1 - dup] • loop
+ 0 •
``map`` ``pam``
~~~~~~~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('10 [1 2 3] [*] map')
10 [10 20 30]
-.. code:: ipython2
+.. code:: ipython3
J('10 5 [[*][/][+][-]] pam')
Run a quoted program enforcing
`arity <https://en.wikipedia.org/wiki/Arity>`__.
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] nullary')
1 2 3 4 5 9
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] unary')
1 2 3 4 9
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] binary') # + has arity 2 so this is technically pointless...
1 2 3 9
-.. code:: ipython2
+.. code:: ipython3
J('1 2 3 4 5 [+] ternary')
``step``
~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[step] help')
Run a quoted program on each item in a sequence.
::
- ... [] [Q] . step
- -----------------------
- ... .
+ ... [] [Q] . step
+ -----------------------
+ ... .
- ... [a] [Q] . step
- ------------------------
- ... a . Q
+ ... [a] [Q] . step
+ ------------------------
+ ... a . Q
- ... [a b c] [Q] . step
+ ... [a b c] [Q] . step
----------------------------------------
- ... a . Q [b c] [Q] step
+ ... a . Q [b c] [Q] step
The step combinator executes the quotation on each member of the list
on top of the stack.
-.. code:: ipython2
+.. code:: ipython3
V('0 [1 2 3] [+] step')
.. parsed-literal::
- . 0 [1 2 3] [+] step
- 0 . [1 2 3] [+] step
- 0 [1 2 3] . [+] step
- 0 [1 2 3] [+] . step
- 0 1 [+] . i [2 3] [+] step
- 0 1 . + [2 3] [+] step
- 1 . [2 3] [+] step
- 1 [2 3] . [+] step
- 1 [2 3] [+] . step
- 1 2 [+] . i [3] [+] step
- 1 2 . + [3] [+] step
- 3 . [3] [+] step
- 3 [3] . [+] step
- 3 [3] [+] . step
- 3 3 [+] . i
- 3 3 . +
- 6 .
+ • 0 [1 2 3] [+] step
+ 0 • [1 2 3] [+] step
+ 0 [1 2 3] • [+] step
+ 0 [1 2 3] [+] • step
+ 0 1 [+] • i [2 3] [+] step
+ 0 1 • + [2 3] [+] step
+ 1 • [2 3] [+] step
+ 1 [2 3] • [+] step
+ 1 [2 3] [+] • step
+ 1 2 [+] • i [3] [+] step
+ 1 2 • + [3] [+] step
+ 3 • [3] [+] step
+ 3 [3] • [+] step
+ 3 [3] [+] • step
+ 3 3 [+] • i
+ 3 3 • +
+ 6 •
``times``
~~~~~~~~~
-.. code:: ipython2
+.. code:: ipython3
V('3 2 1 2 [+] times')
.. parsed-literal::
- . 3 2 1 2 [+] times
- 3 . 2 1 2 [+] times
- 3 2 . 1 2 [+] times
- 3 2 1 . 2 [+] times
- 3 2 1 2 . [+] times
- 3 2 1 2 [+] . times
- 3 2 1 . + 1 [+] times
- 3 3 . 1 [+] times
- 3 3 1 . [+] times
- 3 3 1 [+] . times
- 3 3 . +
- 6 .
+ • 3 2 1 2 [+] times
+ 3 • 2 1 2 [+] times
+ 3 2 • 1 2 [+] times
+ 3 2 1 • 2 [+] times
+ 3 2 1 2 • [+] times
+ 3 2 1 2 [+] • times
+ 3 2 1 • + 1 [+] times
+ 3 3 • 1 [+] times
+ 3 3 1 • [+] times
+ 3 3 1 [+] • times
+ 3 3 • +
+ 6 •
``b``
~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[b] help')
-.. code:: ipython2
+.. code:: ipython3
V('1 2 [3] [4] b')
.. parsed-literal::
- . 1 2 [3] [4] b
- 1 . 2 [3] [4] b
- 1 2 . [3] [4] b
- 1 2 [3] . [4] b
- 1 2 [3] [4] . b
- 1 2 . 3 4
- 1 2 3 . 4
- 1 2 3 4 .
+ • 1 2 [3] [4] b
+ 1 • 2 [3] [4] b
+ 1 2 • [3] [4] b
+ 1 2 [3] • [4] b
+ 1 2 [3] [4] • b
+ 1 2 • 3 4
+ 1 2 3 • 4
+ 1 2 3 4 •
``while``
[predicate] [body] while
-.. code:: ipython2
+.. code:: ipython3
J('3 [0 >] [dup --] while')
``x``
~~~~~
-.. code:: ipython2
+.. code:: ipython3
J('[x] help')
-.. code:: ipython2
+.. code:: ipython3
V('1 [2] [i 3] x') # Kind of a pointless example.
.. parsed-literal::
- . 1 [2] [i 3] x
- 1 . [2] [i 3] x
- 1 [2] . [i 3] x
- 1 [2] [i 3] . x
- 1 [2] [i 3] . i 3
- 1 [2] . i 3 3
- 1 . 2 3 3
- 1 2 . 3 3
- 1 2 3 . 3
- 1 2 3 3 .
+ • 1 [2] [i 3] x
+ 1 • [2] [i 3] x
+ 1 [2] • [i 3] x
+ 1 [2] [i 3] • x
+ 1 [2] [i 3] • i 3
+ 1 [2] • i 3 3
+ 1 • 2 3 3
+ 1 2 • 3 3
+ 1 2 3 • 3
+ 1 2 3 3 •
``void``
over quote-only datastructures (that is, datastructures that consist
soley of containers, without strings or numbers or anything else.)
-.. code:: ipython2
+.. code:: ipython3
J('[] void')
False
-.. code:: ipython2
+.. code:: ipython3
J('[[]] void')
True
-.. code:: ipython2
+.. code:: ipython3
J('[[][[]]] void')
True
-.. code:: ipython2
+.. code:: ipython3
J('[[[]][[][]]] void')