bind-data   macro


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

Implementation

(define-macro (bind-data name . constructors)
  (let ((n (string->symbol (car (regex:type-split (symbol->string name) "{")))))
    ;; (println 'shape_datatype: (bind-data-type n name))
    (eval (bind-data-type n name) (interaction-environment))
    ;; (println 'shape_construct: (bind-data-type-constructor n name))
    (eval (bind-data-type-constructor n name) (interaction-environment))
    (map (lambda (x)
           ;; (println 'datatype: x)
           (eval x (interaction-environment)))
         (bind-data-types n constructors))
    (map (lambda (x)
           ;; (println 'getter: x)
           (eval x (interaction-environment)))
         (bind-data-getters n name constructors))
    (map (lambda (x)
           ;; (println 'construct: x)
           (eval x (interaction-environment)))
         (bind-data-constructors n name constructors))
    (map (lambda (x)
           ;; (println 'dstruct: x)
           (eval x (interaction-environment)))
         (bind-data-deconstructors n name constructors))
    (map (lambda (x)
           ;; (println 'macro: x)
           (eval x (interaction-environment)))
         (bind-data-deconstructors-macros n name constructors))
    ;; (println "DataT: " name)
    #t))


Back to Index

Similar Entries