|
Class: LazyArray
Object
|
+--Collection
|
+--SequenceableCollection
|
+--ArrayedCollection
|
+--LazyArray
- Package:
- stx:libbasic2
- Category:
- Collections-Arrayed
- Version:
- rev:
1.6
date: 2017/02/15 21:07:18
- user: cg
- file: LazyArray.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Gittinger (cg@alan)
An Array which computes its values lazily (on demand) and remembers them.
Useful if it is relatively expensive to compute an element,
and it may be needed again later.
Lazy
initialization
-
initialize
-
self initialize
instance creation
-
new: size
-
accessing
-
at: index
-
-
valueGenerator: aBlock
-
UncomputedValue
|squares|
squares := LazyArray new:100.
squares valueGenerator:[:index | index squared].
squares at:50.
squares inspect.
|
|