https://github.com/mkoubik/sloth
https://github.com/mkoubik/sloth
functional lazy-evaluation php
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mkoubik/sloth
- Owner: mkoubik
- License: mit
- Created: 2014-02-08T11:22:27.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-05-14T19:14:46.000Z (about 6 years ago)
- Last Synced: 2025-08-04T01:05:53.276Z (11 months ago)
- Topics: functional, lazy-evaluation, php
- Language: PHP
- Size: 21.5 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sloth
=====

[](https://codecov.io/gh/mkoubik/Sloth)
Installation
------------
`composer require mkoubik/sloth`
Usage
-----
```php
'Hello world!');
echo $string; // callback is called at this point
echo $string; // callback is not called any more
```
```php
range(1, 9999));
foreach ($iterator as $number) { // callback is called at this point
echo $number . "\n";
}
echo count($iterator); // works too
```
```php
new Person('John Doe'));
echo $person->name; // callback is called at this point
if (isset($person->name)) {
unset($person->name);
}
echo $person->setName('John Doe');
```