[plt-scheme] Invoking units

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Mon Jun 15 06:21:12 EDT 2009

On Mon, 2009-06-15 at 09:47 +0100, Noel Welsh wrote:
> I always use the 'infer' variants these days. The unit
> gaussian-cluster@ below imports a binding named a (alpha rendered as
> ascii). I just define a in the lexical environment and invoke as
> follows:
> (define a (vector covariance prior-mean prior-covariance))
> (define-values/invoke-unit/infer gaussian-cluster@)

Thanks Noel, but I don't think I can use the /infer variant.
I am generating in run-time the unit code and passing the file name
containing the unit to a function that dynamically requires it and
invokes the unit. A small example is this:
#lang scheme

(define-signature test^

(define (main my-module)
  (let* ([test@ (dynamic-require my-module 'test@)]
         [test (lambda (foo) (* 2 foo))]
         [unit-result (invoke-unit/infer test@)])

This will generate:
invoke-unit/infer: unknown unit definition in: test@

So, I guess my only solution is to link the unit manually... 


Paulo Matos

> HTH,
> N.
> On Mon, Jun 15, 2009 at 1:14 AM, Paulo J. Matos<pocmatos at gmail.com> wrote:
> > Hi,
> >
> > My units are a bit rusty and deprecated (last time I used them was
> > pretty much in 300 I guess). I have a unit that imports 3 thunks:
> ...

Posted on the users mailing list.