[bitc-dev] deeply immutable functions and Haskell's ST

Mark Miller markm at cs.jhu.edu
Fri Aug 26 08:18:57 EDT 2005


[cross posting to e-lang]

Mark Miller wrote:
> Here's the *-properties example from p16 of
> <http://www.erights.org/talks/asian03/paradigm-revised.pdf> translated into
> pseudo-Scheme with bitc-style type declarations.
> [...]

Richard Uhtenwoldt wrote:
> I want you to fill in the ellipses so that after translating it
> into Haskell, I have something that will compile and run.

The following should be adequate:

   (define (accept-product (calc-factory :deep-frozen))
       (let ((diode 0))
           (define (diode-write (val :deep-frozen)) (setq diode val))
           (define (diode-read)                     (diode))
           (define q    (calc-factory diode-write nil))
           (define bond (calc-factory nil diode-read))))

Note that I also corrected a missing pair of parens in the head of the let
expression.


> My initial impulse was to print out of copy of "Regained" and
> study it till I knew enough to fill in the ellipses myself. 

I encourage you to do this in any case. Please let me know if you find any of
the other examples puzzling, and I will happily translate them into
pseudo-Scheme.


> After all, your papers are well worth studying and you're an
> important computer scientist.  (Though I think I understand the
> reasons for your career choice, I find it quite ironic that you
> are a grad student right now.)

My orals are in six day. Let's hope my committee agrees with you ;).


> For my part, when I finish my coding and testing in Haskell, I'll
> translate my results back into pseudo-Scheme, "novice"-E or
> whatever other formal language you prefer.

Pseudo-Scheme would be fine, but I encourage you to try novice-E in order to 
learn a bit more about it. I'll be happy to help you translate fragments of 
pseudo-Scheme into novice-E.

I've been thinking lately about starting a set of wiki pages on capability 
programming patterns, starting with the examples in the Ode and Paradigm 
Regained. Perhaps as a result of our conversation, we'll have each of these 
examples expressed in several languages -- much as the original Design 
Patterns book used both C++ and Smalltalk -- making the concepts accessible to 
more communities.

-- 
Text by me above is hereby placed in the public domain

     Cheers,
     --MarkM




More information about the bitc-dev mailing list