Sigrid Keydana, Trivadis
2017/06/07
-- get sth from stdin and print "hello, <x>"
getLine >>= putStrLn . ("hello " ++)
# this would be it...
readline() %>% (function(name) paste0("hello ", name))
-- find the max value of a list, take its logarithm and make it negative
dostuff xs = negate . log . maximum $ xs
# this is purrr compose
dostuff <- compose(function(x) -x, log, max)
-- a function that adds 1 to its argument
plus1 = (+1)
# this would be purrr's partial
plus1 <- partial(`+`,1)
some things are very hard to do / not implemented: see State of the Haskell ecosystem (continuously updated)
… right what R is great at!
Demo time!