[clean-list] Re: relationship between uniqueness types and single-threaded lambda calculus?

Adam Megacz megacz at cs.berkeley.edu
Wed May 30 22:50:36 MEST 2007


Regarding Edsko de Vries's original message: your message was quite
illuminating.  I had to email the author of the paper to ask about the
type of "lookup" (not given in the paper).  If he doesn't reply in a
day or two I'll follow up without that information.

Regarding John van Groningen's message,

John van Groningen <johnvg at cs.ru.nl> writes:
> swap a i j
> 	#! x = lookup a i
> 	#! y = lookup a j
> 	= update! (update! a i y) j x

Is this a valid Clean program?  I thought the Clean array operators
had names like "select" instead of "lookup".  I'm having trouble with
your download registration right now, so I can't try this out
firsthand...

I believe that in Clean, one would need to replace "lookup" with
"uselect" to get the correct behavior.  However, the resulting program
would no longer be type-correct -- "uselect" returns a pair.  So the
program would need to be changed to "thread" the array through the
lookups, somewhat like this:

 swap a i j
 	#! (x,a1) = uselect a  i
 	#! (y,a2) = uselect a1 j
 	= update! (update! a2 i y) j x

Note that this increases the degree of sequentialization in the code
(ie removes potential parallelism).  I believe that this threading is
not necessary in STPLC.  So although #! and let* have similar
meanings, STPLC can use let* in a way which does not appear to have an
analogue in Clean (using #!).

  - a

-- 
PGP/GPG: 5C9F F366 C9CF 2145 E770  B1B8 EFB1 462D A146 C380


More information about the clean-list mailing list