Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a1 = 2 to 5
- var aos = [
- "bob",
- "carol",
- "ted",
- "alice"
- ]
- ---
- {
- lastElement: a1 reduce (e,a) -> e,
- firstElement: a1 reduce (e,a) -> a,
- initializedAccumulator: a1 reduce (e,a=0) -> a,
- sumElements: a1 reduce (e,a) -> a + e,
- concatElements: a1 reduce (e,a="") -> a ++ e,
- stackElements: a1 reduce (e,a=[]) -> e >> a,
- concatStrings: aos reduce (e,a) -> a ++ "," ++ e,
- reverseConcat: aos reduce (e,a) -> e ++ "," ++ a,
- }
Advertisement
Add Comment
Please, Sign In to add comment