Fantastic, thanks Rick! I continue to be so happy I chose S7 for this project. Being able to build on the Common Music work is great. :-)
On Sun, Feb 14, 2021 at 10:08 AM Taube, Heinrich K <[email protected]> wrote: > FWIW The Common Music 2 code base is 100% CLOS. The Grace code base uses > Bil’s record structure to implement its Scheme pattern objects and it works > quite well. > > C Side... > > pattern_tag = s7_make_c_type(s7, "<pattern>"); > > s7_define_function(s7, "make-pattern", ffi_make_pattern, 14, 0, false, > "pattern > constructor”); > [...] > > Scheme Side... > > (define-record pattern flags data length datum period value state > repeat returning counting traversing next mapr cache) > > > (define (%alloc-pattern) > ;; flags data length datum period value state limit returning counting > traversing next mapr cache > (make-pattern 0 (list) #f +nad+ #f +nad+ +nad+ most-positive-fixnum #f > #:periods #:depth-first > #f #f #f)) > > (define (initialize-pattern obj data for rep flags len dper getr mapr) > (pattern-data-set! obj data) > (pattern-length-set! obj len) > (pattern-mapr-set! obj mapr) > (pattern-next-set! obj getr) > ;; map data to see if it is constant data or has subpatterns > (let ((con? #t)) > (map-pattern-data (lambda (x) (if (pattern? x) (set! con? #f))) > obj) > (if con? (set! flags (logior flags +constant-data+)))) > [...] > ) > [...] > (define (make-cycle data . args) > (unless (pair? data) (set! data (list data))) > (with-optkeys (args for limit) > (let ((obj (%alloc-pattern)) > (flags 0) > (len (length data))) > (initialize-pattern obj (cons data data) for limit > flags len len next-in-cycle > (lambda (fn obj) > (for-each fn (car (pattern-data obj))))) > obj))) > > [...] > > > On Feb 14, 2021, at 10:17 AM, Iain Duncan <[email protected]> > wrote: > > Oh great, I hadn't looked there yet. Thanks! Is there any particular > implementation or resource you based the class system in there on? (ie, > place to read more about how you did it) > > iain > > > > > > On Sun, Feb 14, 2021 at 2:33 AM <[email protected]> wrote: > >> stuff.scm has define-class and friends with some examples >> in s7test.scm. It has some similarities to CLOS. >> >> _______________________________________________ > Cmdist mailing list > [email protected] > > https://urldefense.com/v3/__https://cm-mail.stanford.edu/mailman/listinfo/cmdist__;!!DZ3fjg!vlx95wjWmKfGndRV-oOKnf1WnD1TzGmD7FIKM6HTtoIAyd5rLoZ3G8sO8ulQhA$ > > >
_______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
