Feb. 1st, 2017

Fact

Feb. 1st, 2017 12:53 am
xacid: (Default)
Read more... )

  val main = "(x -> y -> z -> y * ( x + y * z))"
  println(showAndEval(main, 1, 2, 10))

  val fact =
    """
      | let
      |   fact = x ->
      |     if(x)
      |       x * (fact (x - 1))
      |     else 1
      | in fact 20
    """.stripMargin

  println(showAndEval(fact))
}

//Success(( x -> y -> z -> y * ( x + y * z ) ) 1 2 10 = 42)
//Success(let fact = x -> if(x) x * ( fact ( x - 1 ) ) else 1 in fact 20  = 2432902008176640000)

Profile

xacid: (Default)
xacid

August 2017

S M T W T F S
  123 45
67891011 12
13 141516171819
20212223242526
2728293031  

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 19th, 2017 05:04 pm
Powered by Dreamwidth Studios