~dieggsy/chicken-genann

6c5487ca606d9c23a7e8310ed5f82dfd4d016561 — dieggsy 4 years ago b5e0e66
Add genann-init* and genann-copy*
1 files changed, 9 insertions(+), 4 deletions(-)

M genann.scm
M genann.scm => genann.scm +9 -4
@@ 8,7 8,9 @@
                genann-run

                ;; Added
                genann-init*
                make-genann
                genann-copy*
                genann?
                genann-inputs
                genann-hidden-layers


@@ 59,9 61,6 @@
  (define genann-randomize
    (foreign-lambda void "genann_randomize" genann))

  (define fdopen
    (foreign-lambda (c-pointer "FILE") "fdopen" int c-string))

  (define %genann-read
    (foreign-lambda genann "genann_read" (c-pointer "FILE")))



@@ 94,11 93,17 @@

  (define genann-randomize
    (foreign-lambda void "genann_randomize" genann))

  ;; Added
  (define (make-genann inputs hidden-layers hidden-neurons outputs)
  (define (genann-init* inputs hidden-layers hidden-neurons outputs)
    (set-finalizer! (genann-init inputs hidden-layers hidden-neurons outputs)
                    genann-free!))

  (define make-genann genann-init*)

  (define (genann-copy* genann)
    (set-finalizer! (genann-copy genann) genann-free!))

  (define genann-inputs
    (foreign-lambda* int ((genann ann))
      "C_return(ann->inputs);"))