Mercurial > urweb
annotate tests/dlist.ur @ 1893:9a1097954188
compileC: Link libraries in the right order
This is needed, at least on recent Ubuntu, to fix this linker error
when compiling any Ur/Web application:
ld: /tmp/webapp.o: undefined reference to symbol 'uw_write'
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
src/compiler.sml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
author | Anders Kaseorg <andersk@mit.edu> |
---|---|
date | Thu, 21 Nov 2013 14:32:11 -0500 |
parents | 20c083327364 |
children |
rev | line source |
---|---|
adamc@601 | 1 datatype dlist = Nil | Cons of string * source dlist |
adamc@601 | 2 |
adamc@601 | 3 fun delist dl = |
adamc@601 | 4 case dl of |
adamc@601 | 5 Nil => <xml>[]</xml> |
adamc@604 | 6 | Cons (x, s) => <xml>{[x]} :: ({delistSource s})</xml> |
adamc@601 | 7 |
adamc@601 | 8 and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml> |
adamc@601 | 9 |
adamc@601 | 10 fun main () : transaction page = |
adamc@601 | 11 ns <- source Nil; |
adamc@601 | 12 s <- source ns; |
adamc@601 | 13 tb <- source ""; |
adamc@601 | 14 return <xml><body> |
adamc@601 | 15 <dyn signal={s <- signal s; return (delistSource s)}/><br/> |
adamc@601 | 16 <br/> |
adamc@601 | 17 <ctextbox source={tb}/> |
adamc@601 | 18 <button value="Add" onclick={hd <- get tb; |
adamc@601 | 19 tl <- get s; |
adamc@601 | 20 s' <- source (Cons (hd, tl)); |
adamc@601 | 21 set s s'}/> |
adamc@603 | 22 <button value="Reset" onclick={set s ns}/> |
adamc@601 | 23 </body></xml> |