99 bottles of beer: Difference between revisions

Content added Content deleted
m (used the inline lambdas, and auto property setter)
Line 13,887: Line 13,887:
=={{header|YAMLScript}}==
=={{header|YAMLScript}}==
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
#!/usr/bin/env yamlscript
main(number=99):
map:
- println
- map:
- paragraph
- range(number, 0, -1)


# Print the verses to "99 Bottles of Beer"
paragraph(num): |
#
# usage:
# yamlscript 99-bottles.ys [<count>]

defn main(number=99):
map(say):
map(paragraph):
(number .. 1)

defn paragraph(num): |
$(bottles num) of beer on the wall,
$(bottles num) of beer on the wall,
$(bottles num) of beer.
$(bottles num) of beer.
Line 13,900: Line 13,905:
$(bottles (num - 1)) of beer on the wall.
$(bottles (num - 1)) of beer on the wall.


bottles(n):
defn bottles(n):
cond: [
???:
(n == 0), "No more bottles",
(n == 0) : "No more bottles"
(n == 1), "1 bottle",
(n == 1) : "1 bottle"
:else, "$n bottles" ]
:else : "$n bottles"
</syntaxhighlight>
</syntaxhighlight>



=={{header|Yorick}}==
=={{header|Yorick}}==