Functional Library for C# that follows the Clojure idiom.
- This style forces you to follow the Single Responsibility method.
- lower case method name to make calling the functions
- Upper case names for classes
- list of functions
- how to add your own functions.
Each function has two different access methods.
The funclib.Core.First( method is the standard C# naming style:
using funclib.Compoents.Core;
...
var mapVector = new Map().Invoke(new Inc(), new Vector().Invoke(1, 2, 3, 4, 5));
// => [2, 3, 4, 5, 6]
The second and cleaner method is:
using static funclib.Core;
...
var mapVector = Map(inc, Vector(1, 2, 3, 4, 5));
// => [2, 3, 4, 5, 6]
From the example above there are a few things to note.
-
Using a C# 6 feature:
using static
. This feature allows you to remove a explicit reference to the type when invoking a static method. -
The use of the lower case function name for
map
. To distinguish between the different functions and the instantiation of the function's class, I choose to use lower case function name. I am still trying to figure out if using lower case for methods or I should flip it to be upper case for methods and lower case for properties. If anyone has any suggests as to why please let me know. -
The use of the capital name of
Inc
. Again this is to distinguish between a function and a property.
- Missing functions:
- read
- read line
- read stringmapv
- map indexed
- some fn
- dedupe
- run!
- thread
- case
- cond
- cond thread
- if not
- if some
- keep indexed
- slurp
- spit
- while
Non-Pure methods (methods that have side effects) should be suffixed with at http://www.fileformat.info/info/unicode/char/01c3/index.htm character.
http://www.fileformat.info/info/unicode/char/1405/index.htm http://www.fileformat.info/info/unicode/char/1433/index.htm http://www.fileformat.info/info/unicode/char/2d67/index.htm http://www.fileformat.info/info/unicode/char/ffda/index.htm
https://unicode-table.com/en/1433/
maybe test functions end with http://www.fileformat.info/info/unicode/char/0294/index.htm character