The Twelve Days of Christmas: Difference between revisions

→‎{{header|Fish}}: Add implementation.
(→‎{{header|APL}}: Add implementation.)
(→‎{{header|Fish}}: Add implementation.)
Line 2,355:
A partridge in a pear tree.
</pre>
 
=={{header|Fish}}==
<syntaxhighlight lang="fish">> 0 7 . (0,0): Vector. Jumps to main, then used for sub returns
> 0 f 5 + . (0,1): Print a NUL-terminated string
> 6 6 * 9 + f 8 + . (0,2): Pop N, push Nth (e.g. 1 -> "first")
> 0 f 8 + . (0,3): Pop N, push gift countdown starting from N.
> 0 f 1 + . (0,4): Jump to line in range 16-31
 
main:
> 1 \
/ a "On the " 0 <
\ "a" 4 0 p 0 1 .
> "b" 4 0 p : 0 2 .
> "c" 4 0 p 0 1 .
> \
/ " day of Christmas, my true love gave to me:" a 0 /
> "f" 4 0 p 0 1 .
> "1" 6 4 p "4" 4 0 p : 0 3 .
> "2" 6 4 p 0 1 .
> 1 + : c ) ?\ /
;
 
> : ?\ ~ 0 0 .
\ o / > 0 0 .
^ "first" 0 ~ \
> \ > 1 - : ?\ /
/ "A partridge in a pear tree." a 0 & < / / ^ "second" 0 ~ \
\ & 1 - : ?\ ~ 0 0 . \ 1 - : ?\ /
\ \ / / ^ "third" 0 ~ \
/ "Two turtle doves and" a & / \ 1 - : ?\ /
\ & 1 - : ?\ ~ 0 0 . / / ^ "fourth" 0 ~ \
\ \ \ 1 - : ?\ /
/ "Three French hens," a & / / / ^ "fifth" 0 ~ \
\ & 1 - : ?\ ~ 0 0 . \ 1 - : ?\ /
\ \ / / ^ "sixth" 0 ~ \
/ "Four calling birds," a & / \ 1 - : ?\ /
\ & 1 - : ?\ ~ 0 0 . / / ^ "seventh" 0 ~ \
\ \ \ 1 - : ?\ /
/ "Five gold rings," a & / / / ^ "eighth" 0 ~ \
\ & 1 - : ?\ ~ 0 0 . \ 1 - : ?\ /
\ \ / / ^ "ninth" 0 ~ \
/ "Six geese a-laying," a & / \ 1 - : ?\ /
\ & 1 - : ?\ ~ 0 0 . / / ^ "tenth" 0 ~ \
\ \ \ 1 - : ?\ /
/ "Seven swans a-swimming," a & / / / ^ "eleventh" 0 ~ \
\ & 1 - : ?\ ~ 0 0 . \ 1 - : ?\ /
\ \ \ ~ \
/ "Eight maids a-milking," a & / ^ "twelfth" 0 /
\ & 1 - : ?\ ~ 0 0 .
\ \
/ "Nine ladies dancing," a & /
\ & 1 - : ?\ ~ 0 0 .
\ \
/ "Ten lords a-leaping," a & /
\ & 1 - : ?\ ~ 0 0 .
\ \
/ "Eleven pipers piping," a & /
\ & 1 - : ?\ ~ 0 0 .
\ \
/ "Twelve drummers drumming," a & /
\ & ~ 0 0 .</syntaxhighlight>
{{Out}}
<pre>
On the first day of Christmas, my true love gave to me:
A partridge in a pear tree.
 
On the second day of Christmas, my true love gave to me:
Two turtle doves and
A partridge in a pear tree.
 
[...]
 
 
On the twelfth day of Christmas, my true love gave to me:
Twelve drummers drumming,
Eleven pipers piping,
Ten lords a-leaping,
Nine ladies dancing,
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five gold rings,
Four calling birds,
Three French hens,
Two turtle doves and
A partridge in a pear tree.
</pre>
 
 
=={{header|Forth}}==
1,480

edits