Mercurial > urweb
comparison lib/js/urweb.js @ 1061:e8a35d710ab9
Context globals; ctype functions
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 08 Dec 2009 10:46:50 -0500 |
parents | eaba663fd6aa |
children | e81434513720 |
comparison
equal
deleted
inserted
replaced
1060:6f4f8b9c5023 | 1061:e8a35d710ab9 |
---|---|
20 function times(x, y) { return x * y; } | 20 function times(x, y) { return x * y; } |
21 function div(x, y) { return x / y; } | 21 function div(x, y) { return x / y; } |
22 function mod(x, y) { return x % y; } | 22 function mod(x, y) { return x % y; } |
23 function lt(x, y) { return x < y; } | 23 function lt(x, y) { return x < y; } |
24 function le(x, y) { return x <= y; } | 24 function le(x, y) { return x <= y; } |
25 | |
26 // Characters | |
27 | |
28 function isLower(c) { return c >= 'a' && c <= 'z'; } | |
29 function isUpper(c) { return c >= 'A' && c <= 'Z'; } | |
30 function isAlpha(c) { return isLower(c) || isUpper(c); } | |
31 function isDigit(c) { return c >= '0' && c <= '9'; } | |
32 function isAlnum(c) { return isAlpha(c) || isDigit(c); } | |
33 function isBlank(c) { return c == ' ' || c == '\t'; } | |
34 function isSpace(c) { return isBlank(c) || c == '\r' || c == '\n'; } | |
35 function isXdigit(c) { return isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } | |
36 function toLower(c) { return c.toLowercase(); } | |
37 function toUpper(c) { return c.toUppercase(); } | |
38 | |
25 | 39 |
26 // Lists | 40 // Lists |
27 | 41 |
28 function cons(v, ls) { | 42 function cons(v, ls) { |
29 return { next : ls, data : v }; | 43 return { next : ls, data : v }; |