Functional Programming in CoffeeScript
npm install coffee-mateCoffeeMate
==========
Having CoffeeScript for Functional Programming is cool, and it will be much better with this CoffeeMate, which provides a lot of properties(which should be implemented by a library rather than the CS-compiler) for CSers, includes:
- log macro%22)
- assert macro
- dict comprehension%5Cnlog%20-%3E%20json%20squared%5Cn%5Cnchars%20%3D%20dict(%5Bi%2C%20chr(ord(%27a%27)%20%2B%20i)%5D%20for%20i%20in%20%5B0...26%5D)%5Cnlog%20-%3E%20json%20chars%22)
- nested list comprehensions%5Cnlog%20-%3E%20json%20r1%5Cn%5Cn%23without%20cartProd%2C%20you%20chould%20only%20got%20this%3A%5Cnr2%20%3D%20(%5C%22%23%7Bn%7D%23%7Bc%7D%5C%22%20for%20n%20in%20ls1%20for%20c%20in%20ls2)%5Cnlog%20-%3E%20json%20r2%22)
- copy & deepcopy%20of%20a.third%22)
- [lazy evaluation]()
- [type convertions]()
- [string formating]()
- [pseudo-random]()
- [classic js object reinforcement]()
- [funny & useful high-order functions for FPers.]()
API list
--------
Here lists all APIs provided, click it to see demo. you can also read API description for more details.
- useful utils:
log%5Cnlog%20-%3E%20json%20list%20take(10)%20prime_number()%5Cn%5Cna%20%3D%201%5Cnb%20%3D%202%5Cnlog.info%20-%3E%20a%20%2B%20b%22 ),
assert%5Cnassert%20-%3E%20a%20!%3D%20b%22),
[dict](),
[copy](),
[deepcopy](),
[securely](),
- type convertors:
[int](),
[float](),
[bool](),
[str](),
[hex](),
[ord](),
[chr](),
[json](),
[obj](),
- url helpers:
[uri_encoder](),
[uri_decoder](),
- lazy evaluation:
here
- funny functions:
[church](),
[Y](),
[memoize](),
- basic functions:
[flip](),
[seek](),
[pluck](),
[abs](),
[floor](),
[ceil](),
[sum](),
[max](),
[min](),
[max_index](),
[min_index](),
[next_permutation](),
- reinforce String:
[a_string.format](),
[a_string.repeat](),
- reinforce Array:
[an_array.first](),
[an_array.second](),
[an_array.third](),
[an_array.last](),
- reinforce Object:
[Object.size](),
[Object.extend](),
[Object.update](),
Install
-------
#### for nodejs
1. install with npm: your-repo/> npm install coffee-mate --save
2. require separately or globally:
- require separately: {log, assert, dict} = require 'coffee-mate'
- require globally: require 'coffee-mate/global'
#### for browsers
``html`
Run Demo (nodejs)
-----------------
run coffee ./demo.coffee under directory coffee-mate/ directly after you have coffee-script` installed.