Add variable-prefix enumerator
This commit is contained in:
parent
46d3493b99
commit
c23f326b58
|
@ -102,8 +102,16 @@
|
||||||
[`(variable-except ,s ...)
|
[`(variable-except ,s ...)
|
||||||
(apply except/e var/e s)]
|
(apply except/e var/e s)]
|
||||||
[`(variable-prefix ,s)
|
[`(variable-prefix ,s)
|
||||||
;; todo
|
(define as-str (symbol->string s))
|
||||||
(unimplemented "var-prefix")]
|
(map/e (compose string->symbol
|
||||||
|
(curry string-append as-str)
|
||||||
|
symbol->string)
|
||||||
|
(compose string->symbol
|
||||||
|
list->string
|
||||||
|
(curry (flip drop) (string-length as-str))
|
||||||
|
string->list
|
||||||
|
symbol->string)
|
||||||
|
var/e)]
|
||||||
[`variable-not-otherwise-mentioned
|
[`variable-not-otherwise-mentioned
|
||||||
unused/e]
|
unused/e]
|
||||||
[`hole
|
[`hole
|
||||||
|
@ -323,3 +331,7 @@
|
||||||
(disj-sum/e #:alternate? #t
|
(disj-sum/e #:alternate? #t
|
||||||
(cons base/e (negate pair?))
|
(cons base/e (negate pair?))
|
||||||
(cons (cons/e any/e any/e) pair?)))))
|
(cons (cons/e any/e any/e) pair?)))))
|
||||||
|
|
||||||
|
(define (flip f)
|
||||||
|
(λ (x y)
|
||||||
|
(f y x)))
|
||||||
|
|
|
@ -101,17 +101,21 @@
|
||||||
(n (p_!_1 p_!_1))
|
(n (p_!_1 p_!_1))
|
||||||
(x number))
|
(x number))
|
||||||
;; Mismatch isn't working for now, will come back to this.
|
;; Mismatch isn't working for now, will come back to this.
|
||||||
#;#;#;
|
|
||||||
(try-it 100 M m)
|
|
||||||
(try-it 100 M n)
|
|
||||||
(try-it 100 M p)
|
|
||||||
|
|
||||||
;; test variable-not-otherwise-mentioned
|
;; (try-it 100 M m)
|
||||||
(define-language VarMentioned
|
;; (try-it 100 M n)
|
||||||
|
;; (try-it 100 M p)
|
||||||
|
|
||||||
|
;; test variable filtering
|
||||||
|
(define-language Vars
|
||||||
(mention a b c x y z 2 #f #\c (vec 1 2))
|
(mention a b c x y z 2 #f #\c (vec 1 2))
|
||||||
(var variable-not-otherwise-mentioned))
|
(varpre (variable-prefix moo))
|
||||||
|
(varexc (variable-except x λ))
|
||||||
|
(varnom variable-not-otherwise-mentioned))
|
||||||
|
|
||||||
(try-it 20 VarMentioned var)
|
(try-it 100 Vars varpre)
|
||||||
|
(try-it 100 Vars varexc)
|
||||||
|
(try-it 100 Vars varnom)
|
||||||
|
|
||||||
;; Named repeats
|
;; Named repeats
|
||||||
(define-language NRep
|
(define-language NRep
|
||||||
|
|
Loading…
Reference in New Issue
Block a user