Changeset 11996 in project for release/3/nemo/trunk/nmodl.scm


Ignore:
Timestamp:
09/25/08 09:56:46 (12 years ago)
Author:
Ivan Raikov
Message:

Added some useful shortcuts for tau/inf to alpha/beta conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/nemo/trunk/nmodl.scm

    r11995 r11996  
    178178(define (bind ks vs e) `(let ,(zip ks vs) ,e))
    179179
     180(define (name-normalize expr)
     181  (match expr
     182         (('if c t e)  `(if ,(name-normalize c) ,(name-normalize t) ,(name-normalize e)))
     183         (('let bs e)
     184          `(let ,(map (lambda (b) `(,(car b) ,(name-normalize (cadr b)))) bs) ,(name-normalize e)))
     185         ((f . es)
     186          (cons f (map name-normalize es)))
     187         ((? symbol? ) (nmodl-name expr))
     188         ((? atom? ) expr)))
    180189
    181190(define (if-convert expr)
     
    230239    (let* ((expr1 (if-convert expr))
    231240           (expr2 (subst-convert expr1 subst-empty))
    232            (expr3 (let-lift expr2)))
    233       expr3)))
     241           (expr3 (let-lift expr2))
     242           (expr4 (name-normalize expr3)))
     243      expr4)))
    234244
    235245(define (format-expr/NMODL indent expr . rest) 
     
    607617                                  (map second acc-ions) (map fourth acc-ions)))
    608618                  (asgns1 (delete-duplicates asgns0)))
    609              (for-each (lambda (x) (pp indent+ ,x)) asgns1)
     619             (for-each (lambda (x) (pp indent+ ,(nmodl-name x))) asgns1)
    610620             (pp indent "}")
    611621             
     
    616626                     (if (not (null? locals)) (pp indent+ (LOCAL ,(sl\ ", " locals)))))
    617627                   (for-each (lambda (def)
    618                                (let ((n (first def))
     628                               (let ((n (nmodl-name (first def)) )
    619629                                     (b (second def)))
    620630                                 (pp indent+ ,(expr->string/NMODL b n)))) asgn-eq-defs)
Note: See TracChangeset for help on using the changeset viewer.