[plt-dev] Racket web page
On Thu, May 20, 2010 at 4:31 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
> We'd like to have more 7-line programs for the middle slideshow, so
> please contribute.
Command line tool to simulate rolling M dice with N sides each, for
each input of the form "MdN":
#lang racket
(for ([s (current-command-line-arguments)])
(match (regexp-match #px"(\\d+)d(\\d+)" s)
[(list _ (app string->number m)
(app string->number n))
(for ([i (in-range m)])
(printf "~a\n" (+ 1 (random n))))]))
--Carl
[galstaff at light] roll 3d4 > darkness