#!/usr/bin/guile \ -e main -s !# ;;; Copyright 2005 Daniel Cer (daniel.cer@cs.colorado.edu) ;;; ;;; This work is licensed under the Creative Commons Attribution-NonCommercial- ;;; ShareAlike License. To view a copy of this license, visit ;;; http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to ;;; Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, ;;; 94105, USA. (define (main args) (if (not (equal? (length args) 3)) (begin (display (string-append "Usage:\n\t" (car args) " [int/real] (count)\n")) (exit -1)) (let ((type (cadr args)) (count (string->number (caddr args))) (intmax (- (expt 2 31) 1))) ; arbitrary value - so the normal 32-bit ; maxint value is used (cond ((<= count 0) (begin (display "Error: count should be an integer > 0\n") (exit -2))) ((equal? type "int") (map (lambda (R) (display (R)) (newline)) (make-list count (lambda () (random intmax))))) ((equal? type "real") (map (lambda (R) (display (R)) (newline)) (make-list count (lambda () (random 1.0))))) (else (begin (display (string-append "Invalid type: \"" type "\"\n")) (exit -3)) )))))