Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glutexo/y
Different approaches to a factorial, hopefully resulting in using a combinator
https://github.com/glutexo/y
Last synced: 15 days ago
JSON representation
Different approaches to a factorial, hopefully resulting in using a combinator
- Host: GitHub
- URL: https://github.com/glutexo/y
- Owner: Glutexo
- Created: 2018-11-21T09:39:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-22T13:04:11.000Z (about 6 years ago)
- Last Synced: 2024-11-18T03:33:46.342Z (about 2 months ago)
- Language: Ruby
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Factorials, combined #
## Intro ##
I started hearing about the “Y combinator” from many directions. Since functional programming is appealing to me, I’d like to get to know more about this mythical beast.
There is [an exhaustive article][link] on this topic. It explains the idea on a factorial function, mostly using Scheme. I started with the two approaches using Ruby, going only one bit at a time.
## Howto ##
Install the dependencies.
```
$ bundle install
```Run the tests.
```
$ ruby test.rb
```Run the non-recursive factorial.
```
$ ruby run.rb 20
```## Progress ##
* [x] Write a non-recursive factorial using a loop
* [x] Write a recursive factorial using a named function
* [ ] Write a recursive factorial using only lambdas
* [ ] ???
* [ ] Profit## Links ##
* [The Y Combinator (Slight Return)][link] by Mike Vainer
[link]: https://mvanier.livejournal.com/2897.html