Sha256: 5593b7838029e851b6f0a5fd6348c4ee81577a9d8b4cf827771e1dd17d369777
Contents?: true
Size: 798 Bytes
Versions: 396
Compression:
Stored size: 798 Bytes
Contents
(define-module (robot) #:export (build-robot robot-name reset-name) #:autoload (srfi srfi-1) (iota)) (define random-alpha-char (lambda () (list-ref (map integer->char (iota 26 65)) (random 26)))) (define random-digit-char (lambda () (list-ref (map integer->char (iota 10 48)) (random 10)))) (define gen-name (lambda () (string (random-alpha-char) (random-alpha-char) (random-digit-char) (random-digit-char) (random-digit-char)))) (define build-robot (lambda () (let ((robot (make-hash-table 2))) (hashq-set! robot 'name (gen-name)) robot))) (define robot-name (lambda (robot) (hashq-ref robot 'name))) (define reset-name (lambda (robot) (set! robot (hashq-set! robot 'name (gen-name)))))
Version data entries
396 entries across 396 versions & 1 rubygems