,
svn: r779
This commit is contained in:
parent
146a0eed1a
commit
508f5f0510
|
@ -259,17 +259,24 @@ incompatible changes to be done:
|
||||||
[(null? l) mt-l]
|
[(null? l) mt-l]
|
||||||
[else (cons (f (car l)) (loop (cdr l)))])))
|
[else (cons (f (car l)) (loop (cdr l)))])))
|
||||||
|
|
||||||
(define re:gen-d (regexp ".*[^0-9]([0-9]+)$"))
|
(define re:gen-d #rx".*[^0-9]([0-9]+)$")
|
||||||
(define (variable-not-in sexp var)
|
(define (variable-not-in sexp var)
|
||||||
(let ([nums (let loop ([sexp sexp]
|
(let* ([var-str (symbol->string var)]
|
||||||
[nums null])
|
[nums (let loop ([sexp sexp]
|
||||||
(cond
|
[nums null])
|
||||||
[(pair? sexp) (loop (cdr sexp) (loop (car sexp) nums))]
|
(cond
|
||||||
[(symbol? sexp) (let ([match (regexp-match re:gen-d (symbol->string sexp))])
|
[(pair? sexp) (loop (cdr sexp) (loop (car sexp) nums))]
|
||||||
(if match
|
[(symbol? sexp) (let* ([str (symbol->string sexp)]
|
||||||
(cons (string->number (cadr match)) nums)
|
[match (regexp-match re:gen-d str)])
|
||||||
nums))]
|
(if (and match
|
||||||
[else nums]))])
|
(is-prefix? var-str str))
|
||||||
|
(cons (string->number (cadr match)) nums)
|
||||||
|
nums))]
|
||||||
|
[else nums]))])
|
||||||
(if (null? nums)
|
(if (null? nums)
|
||||||
(string->symbol (format "~a1" var))
|
(string->symbol (format "~a1" var))
|
||||||
(string->symbol (format "~a~a" var (+ 1 (apply max nums))))))))
|
(string->symbol (format "~a~a" var (+ 1 (apply max nums)))))))
|
||||||
|
|
||||||
|
(define (is-prefix? str1 str2)
|
||||||
|
(and (<= (string-length str1) (string-length str2))
|
||||||
|
(equal? str1 (substring str2 0 (string-length str1))))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user