diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-01-29 19:46:38 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-01-30 07:27:13 -0500 |
commit | 83230afa51fd1ec6a1e224baeac59bd4be4eb0d4 (patch) | |
tree | 7a8dbfecb488a3846c47374a849379c8d7aba1dc /js/utils.js | |
parent | 4f13f9d0cefb7abedcca87a52a021356288594e5 (diff) |
js: Clean up packageCount function.
* js/utils.js (guix.add): New function.
* js/controllers/packages.js (guix.packages.controller.packageCount):
Reimplement.
Diffstat (limited to 'js/utils.js')
-rw-r--r-- | js/utils.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/js/utils.js b/js/utils.js index c44ee23..cfaa7fd 100644 --- a/js/utils.js +++ b/js/utils.js @@ -17,6 +17,13 @@ var guix = {}; +// Here is a perfect example of why Scheme is better than JavaScript: +// + is an operator, not a function. So if I want to, say, compute +// the sum of an array of numbers, I need to write a wrapper function. +guix.add = function(x, y) { + return x + y; +}; + guix.clamp = function(n, min, max) { return Math.max(Math.min(n, max), min); }; |