Saturday, October 2, 2021

sisyphus.R

life <- function( luck=10 , ... ) {
  if ( runif(1) > 1/(luck+1.001) ) {
    cat( "push stone uphill... " )   
  } else {
    cat( "\nstone rolls to bottom\n" )
  }
  life( luck , ... )
}

Or maybe you prefer a life with less hard labor, and with more philosophy:

life <- function( luck=10 , ... ) {
  if (runif(1)>
1/(luck+1.001)){cat("?")}else{cat("\n")}
  life( luck , ... )
}
 

life()

Either way, R replies with wisdom:

Error: evaluation nested too deeply


Suitable for framing?


 

No comments:

Post a Comment