On Thu, May 20, 2010 at 4:31 PM, Matthew Flatt <mfl...@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 [galst...@light] roll 3d4 > darkness _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-dev