Last active
January 28, 2016 03:32
-
-
Save yamasushi/0e6a039ced73d19dcca6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) | |
$ 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