Mercurial > repos > icfp2013
comparison src/requests.tp @ 18:a0e66161bde0
for bug investigation
author | William Morgan <bill@mrgn.org> |
---|---|
date | Fri, 09 Aug 2013 12:55:38 -0700 |
parents | 566960135ea1 |
children | 5a025e6c6f89 |
comparison
equal
deleted
inserted
replaced
17:566960135ea1 | 18:a0e66161bde0 |
---|---|
1 #{ | 1 #{ |
2 evalRequest <- :args { | 2 |
3 quote <- :str { | |
4 "\"" . str . "\"" | |
5 } | |
6 | |
7 evalRequest <- :_id args { | |
3 #{ | 8 #{ |
4 id <- "a" | 9 id <- _id |
5 arguments <- args | |
6 string <- { | 10 string <- { |
7 temp <- ""//arguments fold: "" with: :acc el {acc . el} | 11 // idStr <- id// method not implemented |
8 "id" . id . "arguments" . temp | 12 // idStr <- _id//method not implemented |
13 // idStr <- "a"//good | |
14 // idStr <- quote("id") . quote(id)//segfault | |
15 // idStr <- "\"id\":\"" . id . "\""// method not implemented | |
16 // argsStr <- ""//arguments fold: "" with: :acc el {acc . el} | |
17 argsStr <- "b" | |
18 "{" . idStr . "," . argsStr . "}" | |
9 } | 19 } |
10 } | 20 } |
11 } | 21 } |
12 | 22 |
13 guessRequest <- :id :prog { | 23 guessRequest <- :id :prog { |
14 #{ | 24 #{ |
15 string <- { | 25 string <- { |
16 //remove the second escaped quote, it will compile. | |
17 idStr <- "\"id\":\"" . id . "\"" | 26 idStr <- "\"id\":\"" . id . "\"" |
18 progStr <- "\"program\":\"" . prog . "\"" | 27 progStr <- "\"program\":\"" . prog . "\"" |
19 "{" . idStr . "," . progStr . "}" | 28 "{" . idStr . "," . progStr . "}" |
20 } | 29 } |
21 } | 30 } |
22 } | 31 } |
23 | 32 |
24 main <- { | 33 main <- { |
25 //print: ((evalRequest: #[1 2 3]) string) | 34 print: ((evalRequest: #[1 2 3]) string) . "\n" |
26 print: ((guessRequest: "someId" "someProg") string) . "\n" | 35 print: ((guessRequest: "someId" "someProg") string) . "\n" |
27 } | 36 } |
28 } | 37 } |