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