Skip to content
Raine Virta edited this page May 26, 2015 · 25 revisions

Ramda vs. LiveScript

Ramda functions and corresponding LiveScript idioms and syntax.

Most are used as predicates for filter or with map.

Ramda LiveScript
not (not)
nth(0) (.0)
prop('name') (.name)
add(1) (+ 1)
add(__, '!') (+ '!')
gt(__, 2) (> 2)
contains(__, xs) (in xs)
pipe(length, gt(__, 2)) (.length > 2)
isNil (~= null)
complement(isNil) (!~= null)
match(/foo/) (is /foo/)
replace('a', '') (- 'a')
join(',') (* ',')
split(',') (/ ',')
to-upper (.to-upper-case!)
compose(g, f) g << f or g . f
pipe(f, g) f >> g
bind(console.log, console) console~log
range(1, 6) [1 to 5]
merge(a, b) a <<< b[1]

1: Not same but reasonably close

Clone this wiki locally