Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
971:c22e524a6dd3 | 972:733f67bb64e7 |
---|---|
1 fun main () = | 1 fun main () = |
2 s <- source ""; | 2 s <- source ""; |
3 f <- source (plus 1); | |
3 | 4 |
4 return <xml><body> | 5 return <xml><body> |
5 <ctextbox source={s}/><br/> | 6 <ctextbox source={s}/><br/><br/> |
7 | |
8 Function: <button value="+1" onclick={set f (plus 1)}/> | |
9 <button value="*3" onclick={set f (times 3)}/><br/><br/> | |
6 | 10 |
7 <button value="Echo" onclick={s <- get s; alert s}/> | 11 <button value="Echo" onclick={s <- get s; alert s}/> |
8 <button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/> | 12 <button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/> |
9 <button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/> | 13 <button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/> |
14 <button value="f" onclick={s <- get s; f <- get f; alert (show (f (readError s)))}/> | |
10 </body></xml> | 15 </body></xml> |