A Forth Haiku is an attempt to mix mathematics, art, and the Forth programming language. It resembles a texture shader, however, the emphasis is on direct expression in the resulting image.
The Forth program describing each Haiku is run once per pixel over a square image. Forth cells are floating point. Conditions return 1 instead of -1. The position is available from the words x and y, which range from 0 to 1, which the origin in the lower left hand corner. The haiku returns the desired color in (red, green, blue, alpha), with alpha being topmost on the stack. If the stack has less than 4 items default values are assumed: red:0, green:0, blue:0, alpha:1.
Like a traditional haiku, an ideal Forth Haiku has 3 lines of 5, 7, 5 words. Compositions which don't fit the haiku form are either 'short' (less than 140), or 'long'.
Alpha (opacity), can be used to make semi-transparent haiku. Not every haiku will specify alpha (instead relying on the default 1, fully opaque).
Core words (Glossary):
x
y
t
dt
mx
my
button
buttons
audio
sample
bwsample
@
!
(
\
push
pop
r@
dup
over
2dup
drop
swap
rot
-rot
=
<>
<
>
<=
>=
and
or
not
min
max
+
-
*
/
mod
pow
atan2
negate
sin
cos
tan
log
exp
sqrt
floor
ceil
abs
pi
z+
z*
random
:
if