The Twelve Days of Christmas: Difference between revisions

→‎{{header|APL}}: Add implementation.
imported>Arakov
(→‎{{header|APL}}: Add implementation.)
Line 465:
Two turtle doves, and
A partridge in a pear tree.</pre>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
{{trans|Forth}}
<syntaxhighlight lang="apl">ord ← { ⍵ ⌷ 'first' 'second' 'third' 'fourth' 'fifth' 'sixth' 'seventh' 'eighth' 'ninth' 'tenth' 'eleventh' 'twelfth' }
 
gift ← { ⍵ ⌷ 'A partridge in a pear tree.' 'Two turtle doves, and' 'Three French hens,' 'Four calling birds,' 'Five gold rings,' 'Six geese a-laying,' 'Seven swans a-swimming,' 'Eight maids a-milking,' 'Nine ladies dancing,' 'Ten lords a-leaping,' 'Eleven pipers piping,' 'Twelve drummers drumming,' }
 
day ← { ⎕ ← 'On the',(ord ⍵),'day of Christmas, my true love sent to me:' ⋄ { ⎕ ← gift ⍵ } ¨ ⌽⍳⍵ }
 
{ ⎕←⎕ucs 10⋄day ⍵ } ¨ ⍳12</syntaxhighlight>
 
{{Out}}
<pre>
On the first day of Christmas, my true love sent to me:
A partridge in a pear tree.
 
 
On the second day of Christmas, my true love sent to me:
Two turtle doves, and
A partridge in a pear tree.
 
 
On the third day of Christmas, my true love sent to me:
Three French hens,
Two turtle doves, and
A partridge in a pear tree.
 
[...]
 
On the twelfth day of Christmas, my true love sent 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|AppleScript}}==
1,479

edits