Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added curry documentation to the method so that it can be auto-genera…

…ted.
commit f6865be1fdb6bfa01a2662909faa32a9d38d9bf3 1 parent fc13d6a
@atuttle atuttle authored
Showing with 47 additions and 47 deletions.
  1. +46 −46 README.md
  2. +1 −1  sesame/functions.cfm
View
92 README.md
@@ -35,92 +35,92 @@ It currently has 4 sections:
## Collections ##
-Functions that allow you manipulate and use structs and arrays much easier
+Functions that allow you manipulate and use structs and arrays much easier
### _collect(any data, function transform) : array ###
-collect data from a array, structure or query into a whole new array. Transform closure should return the item that i to be added to the new array.
+collect data from a array, structure or query into a whole new array. Transform closure should return the item that i to be added to the new array.
-* data - the array / struct / query to collect from
-* transform - closure to return the item for the new array
+* data - the array / struct / query to collect from
+* transform - closure to return the item for the new array
### _collectEntries(any data, function transform) : struct ###
-collect data from an array, struct or query into a new struct. The transform function can return either a Map, with a single key to be used as the key, and a 2nd level struct, or an array, where the 1st index in the key, and the 2nd is the value.
+collect data from an array, struct or query into a new struct. The transform function can return either a Map, with a single key to be used as the key, and a 2nd level struct, or an array, where the 1st index in the key, and the 2nd is the value.
-* data - the array / struct / query to collect from
-* transform - the closure to create the map entry.
+* data - the array / struct / query to collect from
+* transform - the closure to create the map entry.
### _groupBy(any data, function grouping) : struct ###
-Take an array/struct and group the data into a grouped struct. The closure should return the key that the data should be grouped by. For arrays, this will return a struct of arrays. For structs, this will return a struct of structures.
+Take an array/struct and group the data into a grouped struct. The closure should return the key that the data should be grouped by. For arrays, this will return a struct of arrays. For structs, this will return a struct of structures.
-* data - the array / struct
-* grouping - the closure to return the group key.
+* data - the array / struct
+* grouping - the closure to return the group key.
### _queryEach(query data, [function func]) : any ###
-Iterates over a query and executes the closure on each row.
+Iterates over a query and executes the closure on each row.
-* data - the query
-* func - the closure
+* data - the query
+* func - the closure
### _unique(any data, [function comparator]) : any ###
-Returns an array with all the duplicates removed (i.e. unique). For structs, this iterates through all the values, and returns an array from that, with duplicates removed.
+Returns an array with all the duplicates removed (i.e. unique). For structs, this iterates through all the values, and returns an array from that, with duplicates removed.
-* data - the array/struct
-* comparator - optional comparator closure that takes 2 arguments for comparing of objects, and returns 0 if they are the same. If not supplied, then natural comparison will be used.
+* data - the array/struct
+* comparator - optional comparator closure that takes 2 arguments for comparing of objects, and returns 0 if they are the same. If not supplied, then natural comparison will be used.
## Functions ##
-Functions that allow you to manipulate other functions / closures
+Functions that allow you to manipulate other functions / closures
### _curry(function func, array args) : function ###
-Curry a function from left to right. Currying is creating a wrapper function where you set a constant value for one or more of the arguments of the function being wrapped. If you curry the function: `function (a,b)` with values `[5]`, then your wrapper will accept one argument (b), and always pass 5 for a.
+Curry a function from left to right. Currying is creating a wrapper function where you set a constant value for one or more of the arguments of the function being wrapped. If you curry the function: `function (a,b,c)` with values `[4,2]`, then your wrapper will accept one argument (`c`), and always pass 4 for `a` and 2 for `b`.
-* func - the function/closure you want to curry
-* args - the array of arguments you wish to curry with.
+* func - the function/closure you want to curry
+* args - the array of arguments you wish to curry with.
## Numbers ##
-Functions for working with numbers and general looping
+Functions for working with numbers and general looping
### _step(numeric numberFrom, numeric numberTo, numeric stepNumber, function closure) : void ###
-Iterates from a given number, up to a given number, using a step increment. Each number is passed through to the closure.
+Iterates from a given number, up to a given number, using a step increment. Each number is passed through to the closure.
-* numberFrom - the number to start at
-* numberTo - the number to go to
-* stepNumber - the step to take between iterations
-* closure - the closure to call with the current count.
+* numberFrom - the number to start at
+* numberTo - the number to go to
+* stepNumber - the step to take between iterations
+* closure - the closure to call with the current count.
### _times(numeric number, function closure) : void ###
-Executes the closure this many times, starting from zero. The current index is passed to the closure each time
+Executes the closure this many times, starting from zero. The current index is passed to the closure each time
-* number - the number of times to execute the given closure
-* closure - the closure to execute.
+* number - the number of times to execute the given closure
+* closure - the closure to execute.
### _upto(numeric numberFrom, numeric numberTo, function closure) : void ###
-Iterates from this number up to the given number, inclusive, incrementing by one each time. Each number is passed through to the closure.
+Iterates from this number up to the given number, inclusive, incrementing by one each time. Each number is passed through to the closure.
-* numberFrom - the number to start at
-* numberTo - the number to go to
-* closure - the closure to call with the current count.
+* numberFrom - the number to start at
+* numberTo - the number to go to
+* closure - the closure to call with the current count.
## IO ##
-Functions for working with input/output
+Functions for working with input/output
### _fileLineEach(any file, function handler) : void ###
-Read a file and call the closure on each line. Works on either a file ob or path
+Read a file and call the closure on each line. Works on either a file ob or path
-* file - the file to load
-* handler - closure to take the input
+* file - the file to load
+* handler - closure to take the input
## Concurrency ##
@@ -133,24 +133,24 @@ that need to be instantiated to interact with the Java concurrency libraries.
### _eachParallel(any data, function closure, [numeric numberOfThreads=5]) : void ###
-Do each iteration in it's own thread, and then join it all back again at the end.
+Do each iteration in it's own thread, and then join it all back again at the end.
-* data - the array/struct to perform a closure on
-* closure - the closure to pass through the elements from data to.
-* numberOfThreads - number of threads to use in the thread pool for processing. (Only needed if you aren't using _withPool())
+* data - the array/struct to perform a closure on
+* closure - the closure to pass through the elements from data to.
+* numberOfThreads - number of threads to use in the thread pool for processing. (Only needed if you aren't using _withPool())
### _thread(function closure) : any ###
-Run the closure in a thread. Must be run inside a _withPool() block to set up the ExecutorService, and close it off at the end. For example:<br/> _withPool( 10, function() {<br/> _thread(function() { ... });<br/> _thread(function() { ... });<br/> }); <br/> Return an instance of java.util.concurrent.Future to give you control over the closure, and/or retrieve the value returned from the closure.
+Run the closure in a thread. Must be run inside a _withPool() block to set up the ExecutorService, and close it off at the end. For example:<br/> _withPool( 10, function() {<br/> _thread(function() { ... });<br/> _thread(function() { ... });<br/> }); <br/> Return an instance of java.util.concurrent.Future to give you control over the closure, and/or retrieve the value returned from the closure.
-* closure - the closure to call asynchronously
+* closure - the closure to call asynchronously
### _withPool(numeric numberOfThreads, function closure) : void ###
-This function allows you to share the underlying ExecutorService with multiple concurrent methods.<br/> For example, this shares a threadpool of 10 threads across multiple _eachParrallel calls:<br/> _withPool( 10, function() {<br/> _eachParrallel(array, function() { ... });<br/> _eachParrallel(array, function() { ... });<br/> _eachParrallel(array, function() { ... });<br/> });
+This function allows you to share the underlying ExecutorService with multiple concurrent methods.<br/> For example, this shares a threadpool of 10 threads across multiple _eachParrallel calls:<br/> _withPool( 10, function() {<br/> _eachParrallel(array, function() { ... });<br/> _eachParrallel(array, function() { ... });<br/> _eachParrallel(array, function() { ... });<br/> });
-* numberOfThreads - the number of threads to use in the thread pool for processing.
-* closure - the closure that contains the calls to other concurrent library functions.
+* numberOfThreads - the number of threads to use in the thread pool for processing.
+* closure - the closure that contains the calls to other concurrent library functions.
Contributions
View
2  sesame/functions.cfm
@@ -18,7 +18,7 @@
--->
<cfscript>
/**
- * Curry a function from left to right.
+ * Curry a function from left to right. Currying is creating a wrapper function where you set a constant value for one or more of the arguments of the function being wrapped. If you curry the function: `function (a,b,c)` with values `[4,2]`, then your wrapper will accept one argument (`c`), and always pass 4 for `a` and 2 for `b`.
* @func the function/closure you want to curry
* @args the array of arguments you wish to curry with.
*/
Please sign in to comment.
Something went wrong with that request. Please try again.