[clean-list] reference type

lethevert acatofearlgrey at ybb.ne.jp
Fri Apr 27 17:24:44 MEST 2007


Hello,


I made a module which introduces reference type in Clean.
I was thinking about lazy IO for these two days and I reached the idea.

Reference type enables to update values not in lexical order but in runtime order,
and it is useful for lazy IO, logging, and some other purposes.

For example, the program

=========================================
Start w
    # (ri1,ri2) = copy (refer 1)
      ls1 = process 1 ri1
      ls2 = process 2 ri2
      ls = interleave ls1 ls2
    = take 10 ls

process a ri
    # (e,ri) = access f ri
    = [e:process a ri]
  where
    f i = (i,i+a)
=========================================

will produce '[1,2,4,5,7,8,10,11,13,14].'


I think it is very useful and it will change my style of Clean programming.
If you are interested in it, see my blog at http://lethevert.blogspot.com/.

-- 
lethevert
lethevert at users.sourceforge.net





More information about the clean-list mailing list