Skip to content

Instantly share code, notes, and snippets.

@yamasushi
Last active January 28, 2016 03:32
Show Gist options
  • Save yamasushi/0e6a039ced73d19dcca6 to your computer and use it in GitHub Desktop.
Save yamasushi/0e6a039ced73d19dcca6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env gosh
; https://gist.github.com/yamasushi/0e6a039ced73d19dcca6
(use gauche.parseopt)
(use gauche.sequence)
(use gauche.lazy)
(use srfi-27)
(define rand (make-random-source))
(random-source-randomize! rand)
(define (main args) (let-args (cdr args)
( (help "h|help")
(str "s=s") . files )
(if str
($ print $ shuffle str)
($ print
$ list->string
$ (cut shuffle <> rand)
(if (null? files)
($ port->char-lseq $ standard-input-port)
($ lconcatenate $ lmap ($ port->char-lseq $ open-input-file $) files)
) ) )
) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment