factor out generating of 'unique' numbers
This commit is contained in:
parent
2ab93f703b
commit
107cb30eb2
|
@ -307,6 +307,7 @@
|
|||
(define-interface surflets/utilities-interface
|
||||
(export form-query-list
|
||||
rev-append
|
||||
generate-unique-number
|
||||
generate-unique-name))
|
||||
|
||||
;; Intelligent Addresses
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
(rev-app (cdr a) (cons (car a) b))
|
||||
b)))
|
||||
|
||||
;; FIXME: consider creating small names
|
||||
(define generate-unique-name
|
||||
;; Every call will surely return another number.
|
||||
(define generate-unique-number
|
||||
(let ((id 0))
|
||||
(lambda (type-string)
|
||||
(lambda ()
|
||||
(set! id (+ 1 id))
|
||||
(string-append type-string (number->string id)))))
|
||||
id)))
|
||||
|
||||
;; FIXME: consider creating small names
|
||||
(define (generate-unique-name type-string)
|
||||
(string-append type-string
|
||||
(number->string (generate-unique-number))))
|
Loading…
Reference in New Issue