view tests/jscomp.ur @ 972:733f67bb64e7

Functions working with interpretation
author Adam Chlipala <adamc@hcoop.net>
date Tue, 22 Sep 2009 13:27:47 -0400
parents c22e524a6dd3
children e30c2409c9d0
line wrap: on
line source
fun main () =
    s <- source "";
    f <- source (plus 1); 

    return <xml><body>
      <ctextbox source={s}/><br/><br/>

      Function: <button value="+1" onclick={set f (plus 1)}/>
      <button value="*3" onclick={set f (times 3)}/><br/><br/>

      <button value="Echo" onclick={s <- get s; alert s}/>
      <button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/>
      <button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/>
      <button value="f" onclick={s <- get s; f <- get f; alert (show (f (readError s)))}/>
    </body></xml>