deconstructor-name-and-type   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/base/adt.xtm

Implementation

(define (deconstructor-name-and-type n type constructor)
  (let* ((name (symbol->string (car constructor)))
         (gentype "!zzz")
         (failtype (string-append "[" gentype "]*"))
         (successtype (string-append "[" gentype (if (null? (cdr constructor)) "" ",")
                                  (string-join (map (lambda (x) (symbol->string x)) (cdr constructor)) ",")
                                  "]*")))
    ;; (println 'name name 'types types)
    (string->symbol (string-append name "_Dstrct:[" gentype "," (symbol->string type) "*,"
                                   successtype "," failtype "]*"))))


Back to Index