Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts on joy.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/joy.e>
#           or at <http://angg.twu.net/e/joy.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######




#####
#
# Joy
# 2011nov21
#
#####

# «joy»  (to ".joy")
# (find-angg ".emacs" "joy")
# http://en.wikipedia.org/wiki/Joy_(programming_language)
# http://concatenative.org/wiki/view/Concatenative%20language
# http://concatenative.org/wiki/view/Joy
# http://www.latrobe.edu.au/phimvt/joy.html
# http://www.kevinalbrecht.com/code/joy-mirror/joy.html
# http://www.kevinalbrecht.com/code/joy-mirror/joy.tar.gz
# Atomic programs:
#   http://www.latrobe.edu.au/phimvt/joy/j03atm.html
# tcK:
#   http://archive.vector.org.uk/art10000360

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv ~/usrc/joy/
mkdir  ~/usrc/joy/
tar -C ~/usrc/joy/ -xvzf $S/http/www.kevinalbrecht.com/code/joy-mirror/joy.tar.gz
cd     ~/usrc/joy/
make    |& tee om

* (eepitch-joy)
* (eepitch-kill)
* (eepitch-joy)
2 3 + .
2 [3 +] i .
2 [3 +] dup concat i .
  [3 +] [3 +] concat .



        pop     dup

The top element does not have to satisfy any particular condition, it can be of any type. The pop operator removes the top element. The dup operator pushes a
duplicate on top, so it replaces the one original by two copies.

The following binary operators are defined on all stacks containing at least two elements:

        swap    popd    popop    dupd

The swap operator interchanges the top two elements. The popd operator removes the second element. The popop operator removes the first and the second element. The
dupd operator duplicates the second element.

The following ternary operators are defined for all stacks containing at least three elements:

        swapd    rollup    rolldown

The swapd operator interchanges the second and third elements but leaves the first element in place. The rollup operator moves the third and second element into
second and third position and moves the first element into third position. The rolldown operator moves the second and first element into third and second position
and moves the third element into first position.

There is another ternary operator:

        choice

The choice operator expects three values on top of the stack, say X, Y and Z, with Z on top. The third value from the top, X, has to be a truth value. If it is true,
then the choice operator just leaves Y on top of the stack, and X and Z disappear. On the other hand, if X is false, then the choice operator just leaves Z on top of
the stack, and X and Y disappear. This operator is related to two combinators ifte and branch which are explained in the next sections.

There is another operator for multi-choices. It expects a non-empty list of non-empty lists on top of the stack and below that one further item.

        opcase





#  Local Variables:
#  coding:               raw-text-unix
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  End: