Skip to content

Instantly share code, notes, and snippets.

@akanehara
Created February 7, 2013 08:59
Show Gist options
  • Select an option

  • Save akanehara/4729675 to your computer and use it in GitHub Desktop.

Select an option

Save akanehara/4729675 to your computer and use it in GitHub Desktop.
selectManyWith を使った filter (ただの曲芸)
<?php
Ginq::range(1,10)
->selectManyWith(
function($x) { if ($x % 2 == 0) return [null]; else return []; },
function($x) { return $x; });
@akanehara
Copy link
Author

別にべったりリストモナド真似なくても manySelector で [$x] か [] 返せばただの selectMany でもできるか。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment