Scientific Calculator
silentmatt/strings
String functions: join and explode
Tagged:
var join = function(list, sep) {
// foldl(function(partial, item) { concat(partial, sep, item) }, map(string, list)) or ""
string:join(list, sep);
};
var explode = (s) -> map(:(), s);
2 Comments
var explode = function(s) {
map(string . :[], map(number, string(s)))
};
Why don't use map(string . :[], string(s)) ? I think it works.
map(function() { alert(@[0]) }, string("abc"));
function map works on both string and list
Sign in to leave a comment