[plt-scheme] Linking unit
Would this help?
#lang scheme
(define-signature mt^ ())
(define-signature cluster^ (f))
(define cluster@
(unit (import)
(export cluster^)
(define (f x)
(printf "cluster ~s\n" x))))
(define binary-cluster@
(unit (import (tag a [prefix a: cluster^])
(tag b [prefix b: cluster^]))
(export cluster^)
(define (f x)
(a:f (string-append "a:" x))
(b:f (string-append "b:" x)))))
(define client@
(unit (import cluster^)
(export mt^)
(f "client")))
(define link@
(compound-unit
(import)
(export)
(link (((A : cluster^)) cluster@)
(((C : cluster^)) binary-cluster@ (tag a A) (tag b A))
(((B : mt^)) client@ C))))
(invoke-unit link@)
On Jun 4, 2009, at 4:31 PM, Noel Welsh wrote:
> Hello,
>
> I have the following units:
>
> binary-cluster:
>
> #lang scheme/unit
> ...
> (import (tag a [prefix a: cluster^])
> (tag b [prefix b: cluster^]))
> (export cluster^)
> ...
>
> cluster:
>
> #lang scheme/unit
> ...
> (import cluster-config^)
> (export cluster^)
> ...
>
> I want to link two instances of cluster to one binary cluster to
> create a new compound unit. I've read the docs (ref and guide), I've
> grepped through the PLT collects, and I can't for the life of me get
> this to work.
>
> One bogus attempt is this:
>
> (define-compound-unit/infer c@
> (import cluster-config^)
> (export cluster^)
> (link (((BC : cluster^)) binary-cluster@ A B)
> (((A : (tag a cluster^))) cluster@)
> (((B : (tag b cluster^))) cluster@)))
>
> How do I do this?
>
> Thanks,
> N.
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme