extensions.st
changeset 3094 4b7e65efd84f
parent 3006 1847bcaf8018
child 3114 1d5224486d3c
equal deleted inserted replaced
3093:46e903dd0a67 3094:4b7e65efd84f
  1244 collecting:aBlock
  1244 collecting:aBlock
  1245     "return a stacked computing stream, which reads elements from the receiver,
  1245     "return a stacked computing stream, which reads elements from the receiver,
  1246      applies aBlock to each read element, and provides the results as elements to its reader."
  1246      applies aBlock to each read element, and provides the results as elements to its reader."
  1247 
  1247 
  1248     ^ CollectingReadStream on:self collecting:aBlock
  1248     ^ CollectingReadStream on:self collecting:aBlock
       
  1249 
       
  1250     "
       
  1251      |s s2|
       
  1252 
       
  1253      s := 'hello world' readStream.
       
  1254      s2 := s collecting:[:ch | ch asUppercase].
       
  1255      s2 upToEnd.   
       
  1256     "
  1249 ! !
  1257 ! !
  1250 
  1258 
  1251 !Stream methodsFor:'stacked computing streams'!
  1259 !Stream methodsFor:'stacked computing streams'!
  1252 
  1260 
  1253 selecting:aBlock
  1261 selecting:aBlock
  1254     "return a stacked computing stream, which reads elements from the receiver,
  1262     "return a stacked computing stream, which reads elements from the receiver,
  1255      but only provides elements for which aBlock returns true to its reader."
  1263      but only provides elements for which aBlock returns true to its reader."
  1256 
  1264 
  1257     ^ SelectingReadStream on:self selecting:aBlock
  1265     ^ SelectingReadStream on:self selecting:aBlock
       
  1266 
       
  1267     "
       
  1268      |s s2|
       
  1269 
       
  1270      s := 'hello world' readStream.
       
  1271      s2 := s selecting:[:ch | ch isVowel].
       
  1272      s2 upToEnd.
       
  1273     "
  1258 ! !
  1274 ! !
  1259 
  1275 
  1260 !stx_libbasic2 class methodsFor:'documentation'!
  1276 !stx_libbasic2 class methodsFor:'documentation'!
  1261 
  1277 
  1262 extensionsVersion_CVS
  1278 extensionsVersion_CVS
  1263     ^ '$Header: /cvs/stx/stx/libbasic2/extensions.st,v 1.25 2013-06-20 13:52:11 vrany Exp $'
  1279     ^ '$Header: /cvs/stx/stx/libbasic2/extensions.st,v 1.26 2013-08-18 11:03:18 cg Exp $'
  1264 ! !
  1280 ! !
  1265 
  1281