jdantonio / functional-ruby

A gem for adding functional programming tools to Ruby. Inspired by Erlang, Clojure, Haskell, and Functional Java.

Home Page:http://www.functional-ruby.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thoughts on the new README

404pnf opened this issue · comments

commented

What draws me to this gem is the implementation of function pattern matching. The new syntax empowers me to do things more conveniently.

I am all for the goals especially

* Stay true to the spirit of the languages providing inspiration
* Keep the semantics as idiomatic Ruby as possible

I would like to see the project stretch ruby even more to copy patterns from other functional programming languages.

Ruby core has been adopting many functional idioms in the wild, including them to Enumerable, Array and Proc class. Most are semantics (including syntax sugar, function names) rather than implementation.

Therefore, I propose to remove some features from the gem. The proposed principles are:

  1. Stay away from implementing algorithm, unless it can be considered a poster child for FP in ruby like what quicksort does for Haskell http://www.haskell.org/haskellwiki/Introduction#Quicksort_in_Haskell. Besides, they are likely to be slow https://github.com/404pnf/algorithms.
  2. Stay away from implementing data structure, encourage adoption of other gems like Hamster https://github.com/hamstergem/hamster.
  3. Expose as few functions as possible. So we can change the code actively without fearing of breaking things.

I like all of your suggestions. The collections and algorithms code in this gem were copied from another project I got rid of (I had started work on a statistics gem that I later abandoned). I copied those files into this project because I didn't have a better place for them. You are correct, however, that they don't really fit here, either. I will create another git repo and move them.

Removed all non-functional code in PR #6.

commented

Thanks for the quick response.