5 return {fromCode : function(c) { return String.fromCharCode(c); },
6 toCode : function(c) { return c.charCodeAt(0); },
7 toUpper : function(c) { return c.toUpperCase(); },
8 toLower : function(c) { return c.toLowerCase(); },
9 toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },
10 toLocaleLower : function(c) { return c.toLocaleLowerCase(); }
14var Maybe = function() {
15 function consMaybe(x) { return function(xs) {
16 if (x[0] === "Just") return ["Cons", x[1], xs];
20 function fromMaybe(b) { return function(m) {
21 if (m[0] === "Just") return m[1];
25 function mapCons(f) { return function(y) { return function(xs) {
27 if (x[0] === "Just") return ["Cons", x[1], xs];
32 function maybe(b) { return function(f) { return function(m) {
33 if (m[0] === "Just") return f(m[1]);
39 return {Just : function(x) { return ["Just",x]; },
40 Nothing : ["Nothing"],
41 catMaybes : List.foldr(consMaybe)(["Nil"]),
42 isJust : function(m) { return m[0] === "Just"; },
43 isNothing : function(m) { return m[0] === "Nothing"; },
44 fromMaybe : fromMaybe,
45 consMaybe : consMaybe,
46 mapMaybe : function(f) { return List.foldr(mapCons(f))(["Nil"]); },
52var String = function() {
54 function append(s1) { return function(s2) {
58 function map(f) { return function(s) {
59 for (var i = s.length; i--; ) { s[i] = f(s[i]); }
63 function intercalate(sep) { return function(ss) {
64 return Value.listToArray(ss).join(sep);
67 function intersperse(sep) { return function(s) {
68 return s.split("").join(sep);
72 function foldl(f) { return function(b) { return function(s) {
74 for (var i = 0, len = s.length; i < len; ++i) { acc = f(s[i])(acc); }
79 function foldr(f) { return function(b) { return function(s) {
81 for (var i = s.length; i--; ) { acc = f(s[i])(acc); }
87 function concatMap(f) { return function(s) {
89 for (var i = a.length; i--; ) { a[i] = f(a[i]); }
94 function forall(pred) { return function(s) {
95 for (var i = s.length; i--; ) { if (!pred(s[i])) {return false}; }
99 function exists(pred) { return function(s) {
100 for (var i = s.length; i--; ) { if (pred(s[i])) {return true}; }
105 return {cons : append,
107 head : function(s) { return s[0]; },
108 last : function(s) { return s[s.length-1]; },
109 tail : function(s) { return s.slice(1); },
110 length : function(s) { return s.length; },
112 intercalate : intercalate,
113 intersperse : intersperse,
114 reverse : function(s) { return s.split("").reverse().join(""); },
115 toLower : function(s) { return s.toLowerCase(); },
116 toUpper : function(s) { return s.toUpperCase(); },
119 concat : function(ss) { return Value.listToArray(ss).join(""); },
120 concatMap : concatMap,
126 toText : Value.toText,
127 properEscape : Value.properEscape
131return {String: {toText:Value.toText, properEscape:Value.properEscape},
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list