[Pharo-users] Is lazy evaluation of infinite series possible?
emdonahu at gmail.com
Sun May 29 23:45:45 EDT 2016
Other people are probably better qualified to weigh in on the best ways to
manage packages in a Pharo image, but this is what I do:
1) Left click on the "desktop" to bring up the "world menu" and select
2) Click the "+Repository" button and select "smalltalkhub.com" from the
3) Type 'EvanDonahue' and 'Lazy' inside the provided quotes next to owner:
and project:, respectively (user and password can be left ''). Then click
4) Highlight "Lazy-Core-EvanDonahue.26.mcz" on the right panel (may be 26 or
any other number) and click the "Browse" button to explore the classes and
methods without actually installing in your image.
5) Click the "Load" button to install the classes in the image. You may also
want to install Lazy-Tests just to have some code examples to look at.
6) To remove everything later, open Monticello again, search for "Lazy,"
right-click Lazy-Core in the left pane, and "unload"
As for your use case, what you have written should work, but if you just
want a ton of 1's, you can use
LazyList repeat: 1
There are other class methods of increasing generality for generating
infinite lists, but of course you can always use #collect: and friends to
compose appropriately. LazyList is technically still "under development,"
but it should be feature complete for most uses. Let me know if there's any
functionality it's missing, or if you're wondering whether and how it can do
something. If you want to say any more about the operations you are trying
to perform, I can be more specific about how to do them. Roughly, aside from
the infinite methods, the API follows the standard Pharo collections.
And also welcome to Pharo. It's a trip.
View this message in context: http://forum.world.st/Is-lazy-evaluation-of-infinite-series-possible-tp4897956p4898034.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
More information about the Pharo-users