Changeset 12784 in project for release/3/nemo/trunk/nemoutils.scm
 Timestamp:
 12/05/08 08:36:44 (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

release/3/nemo/trunk/nemoutils.scm
r12685 r12784 34 34 (declare 35 35 (lambdalift) 36 (export lookupdef binding? bind 37 enumbnds enumfreevars sum substterm 36 (export lookupdef enumbnds enumfreevars sum 38 37 ifconvert letenum letelim letlift 39 38 s+ sw+ sl\ nl spaces ppf … … 77 76 ((x . rest) `(+ ,x ,(sum rest)))))) 78 77 79 80 (define (substterm t subst k)81 (match t82 (('if c t e)83 `(if ,(k c subst) ,(k t subst) ,(k e subst)))84 85 (('let bs e)86 (k `(let ,(map (lambda (b) `(,(car b) ,(k (cadr b) subst))) bs) ,(k e subst))87 subst))88 89 ((f . es)90 (cons (k f subst) (map (lambda (e) (k e subst)) es)))91 92 ((? symbol? ) (lookupdef t subst t))93 94 ((? atom? ) t)))95 96 (define (binding? t) (and (list? t) (eq? 'let (car t)) (cdr t)))97 98 (define (bind ks vs e) `(let ,(zip ks vs) ,e))99 78 100 79 (define (ifconvert expr) … … 164 143 165 144 (define (transitionsgraph n open transitions statename) 166 (let* ((substconvert (substdriver (lambda (x) (and (symbol? x) x)) binding? identity bind substterm)) 145 (let* ((substconvert (substdriver (lambda (x) (and (symbol? x) x)) 146 nemo:binding? identity nemo:bind nemo:substterm)) 167 147 (g (makedigraph n (stringappend (>string n) " transitions graph"))) 168 148 (addnode! (g 'addnode!)) … … 220 200 221 201 (define (statelineqs n transitions lineqs statename) 222 (let* ((substconvert (substdriver (lambda (x) (and (symbol? x) x)) binding? identity bind substterm)) 202 (let* ((substconvert (substdriver (lambda (x) (and (symbol? x) x)) 203 nemo:binding? identity nemo:bind nemo:substterm)) 223 204 (statelist (let loop ((lst (list)) (tlst transitions)) 224 205 (if (null? tlst) (deleteduplicates lst eq?)
Note: See TracChangeset
for help on using the changeset viewer.