# Copyright 2005-2007 Kevin Reid, under the terms of the MIT X license # found at http://www.opensource.org/licenses/mit-license.html ................ ? pragma.enable("dot-props") > def ALL := EIO::ALL > null ? def mapStream :DeepFrozen := # value: ? def s := mapStream(List, [1, 2, 3].asStream(), __makeList) # value: <--[1, 2, 3].asStream() ? s.getChunkType() # value: List[List] ? EIO.takeAll(s) # value: [[1], [2], [3]] ? pragma.enable("accumulator") > def s := mapStream.chunked(List[int], > [1, 2, 3].asStream(), > def chunkFunc(es) :any { > return accum [] for x in es { _.with(x+1) }}) # value: <--[1, 2, 3].asStream() ? EIO.takeAll(s) # value: [2, 3, 4] Closure ? def [bo, bi] := EIO.pipe([].asMap()) > def bm := mapStream(any, bi, __makeList) > bo.reserve() <- resolve(null) > interp.waitAtTop(def r := bm.takeAtMost(1)) ? [r] # value: [null] XXX closing map stream propagates Erroneous chunk functions ? EIO.takeAll(mapStream.chunked(List[int], [1].asStream(), fn _ { [2, 3] })) # problem: mapStream chunk function <__main$_> produced 2 elements instead of 0, [] to [2, 3] ? EIO.takeAll(mapStream.chunked(List[int], [1].asStream(), fn _ { [] })) # problem: mapStream chunk function <__main$_> produced 0 elements instead of 1, [1] to []