Changeset 34532 in project for release/4/srfi-27/OO-example.scm


Ignore:
Timestamp:
09/12/17 19:34:01 (3 years ago)
Author:
Kon Lovett
Message:

uses test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-27/OO-example.scm

    r34114 r34532  
    1212;; Parameterized extension "concept"
    1313;;
     14;FIXME by having 'src' separate makes dependent on 'ctor' argument order
    1415(define-class <parameterized> () (ctor params src))
    1516
     
    1718;;
    1819(define-generic (next-value obj))
     20(define-generic (reset obj))
     21
    1922(define-method (next-value (obj <stepper>))
    2023  ((slot-value obj 'nxtval)))
    21 (define-generic (reset obj))
     24
    2225(define-method (reset (obj <stepper>))
    2326  (let-values (
     
    6467      (ctor
    6568        (car ctor-form) )
     69      (ctor-args
     70        (cdr ctor-form) )
    6671      (procinfo
    6772        (procedure-information ctor) )
     
    7378          (and-let* ((kndpos (string-index-right procname #\-)))
    7479            (substring/shared procname (add1 kndpos)) ) ) )
     80      ;(<generator-thunk> [<parameters-thunk>])
    7581      (dstr-vals
    76         (receive (apply ctor (cdr ctor-form))) )
     82        (receive (apply ctor ctor-args)) )
     83      (genny
     84        (first dstr-vals) )
    7785      (params
    78         (and
    79           (<= 2 (length dstr-vals))
    80           (receive ((second dstr-vals))) ) )
    81       (gen (first dstr-vals) ) )
     86        (and (<= 2 (length dstr-vals)) (receive ((second dstr-vals))) ) ) )
    8287    ;"free" the temp slot
    8388    (set! (slot-value obj 'tmpval) #f)
    8489    ;initialize state
    8590    (set! (slot-value obj 'namsym) (string->symbol procname))
    86     (set! (slot-value obj 'nxtval) gen)
     91    (set! (slot-value obj 'nxtval) genny)
    8792    (set! (slot-value obj 'ctor) ctor)
    8893    (set! (slot-value obj 'params) (if (pair? params) (drop-right params 1) '()))
     
    9095
    9196#|
     97(use test)
     98(use srfi-27-distributions)
     99
    92100(let ((expn-rd (make-random-distribution make-random-exponentials #:mu 0.5)))
    93101  (test <random-distribution> (class-of expn-rd))
Note: See TracChangeset for help on using the changeset viewer.