Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/line-o/functastic-php
Some experiments with some of the language features of PHP v5.3+
https://github.com/line-o/functastic-php
Last synced: 26 days ago
JSON representation
Some experiments with some of the language features of PHP v5.3+
- Host: GitHub
- URL: https://github.com/line-o/functastic-php
- Owner: line-o
- License: other
- Created: 2012-08-15T08:50:38.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-08-21T11:16:46.000Z (over 12 years ago)
- Last Synced: 2024-10-19T11:31:07.499Z (3 months ago)
- Language: PHP
- Size: 129 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
#Functional Programming in PHP
![test](http://4.bp.blogspot.com/_6m1GwPz8e34/S6LaIgiBs0I/AAAAAAAAASw/66RPdKfgnfo/s200/functionalProgramming.png)
##What is Functional Programming all about
- (un)typed lambda calculus
- type theory
- type inference (Hindley-Milner)
- intuitionistic types(?)
- predicate logic
- mathematical proofs* Don't *really* know what all this is?
* Me neither, but we may find out.##the Idea behind it
* no side effects
* no state## Lambda functions
````php
0 ? 'true' : 'false');
}
return array_map('greaterThanZero', array(0, 1))
}
print_r(do());
````* introduces a new global function
* name collisionsafter:
````php
0 ? 'true' : 'false');
};
return array_map($map_func, array(0, 1));
}
print_r(do());
````* anonymous (lambda) function
* exists only in local scope### Scope?
````php
$i) };
print("#<$i: " . count(array_filter($map_func, $rng)) . PHP_EOL);
}
````## Currying / Partial Application
specific example:
````php
Juri Leino
working @spot-media