Re: [pure-lang-users] pure won't complile anymore
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-09-03 19:47:37
|
Eddie Rucker wrote: > OK. Compiles now. Hi Eddie, just FYI: In the latest from svn I also rewrote the better part of prelude.pure to make the list operations handle infinite lists, but that's not quite finished yet (I still have to do the list generator functions, and there might still be some bugs in the new code even though it passes all tests), so please consider this "experimental" for now. (And of course your bug reports are appreciated.) Unfortunately, sf.net has a scheduled downtime of svn write tonight (or rather this morning, 04:00 UTC), i.e., svn reads will work, but I won't be able to commit anything. I'll try to do the overhauled list generators and update the manual before that, but any further bugfixes will probably have to wait until that ordeal is over... In the meantime, here's some stuff from SICP you can play around with: > ones = 1:ones&; > integers = 1 : zipwith (+) ones integers&; > let ints = integers; > ints; 1:<<thunk 0xb5fe1588>> > take 10 ints; [1,2,3,4,5,6,7,8,9,10] > ints; 1:2:3:4:5:6:7:8:9:10:<<thunk 0xb5fe1b28>> Note the new & operator (postfix, binds stronger than anything else but function application) which does all the magic. It defers the evaluation of its operand until that value is actually needed somewhere (in which case evaluation and memoization happens automagically, as you can see above). So in difference to Q, there's no separate stream data structure, it's just a normal list with a thunked tail, which makes things a bit easier (and leaves the curly braces for something else ;-). Happy streaming! Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |