Hacker News new | ask | show | jobs
by kgwgk 2017 days ago
The lambda thing may be useful. Sometimes I was tempted to do something like this

  > f <- function(expr) eval(substitute( function(x) expr ))
  
  > sapply(1:4, f({ a <- x^2 ; b <- x^3 ; a+b }))
  [1]  2 12 36 80
but I'm not sure it would have worked well. The new syntax is of course also more flexible.
1 comments

I've literally written something similar 4 times in the last month, I hate having to load the temp function to be sure the next line runs. This is such a useful addition.