Mercurial > repos > icfp2013
annotate src/requests.tp @ 21:a4ac42c69285
cleanup.
author | William Morgan <bill@mrgn.org> |
---|---|
date | Fri, 09 Aug 2013 15:53:53 -0700 |
parents | 92db3d1e8809 |
children | a4837071b73d |
rev | line source |
---|---|
10
79c1db5e7ebd
sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff
changeset
|
1 #{ |
18 | 2 |
20 | 3 strJoin <- :str arr { |
4 acc <- "" | |
5 arr foreach: :i el { | |
6 if: i = 0 { | |
7 acc <- (string: el) | |
8 } else: { | |
9 acc <- acc . ", " . (string: el) | |
10 } | |
11 } | |
12 acc | |
13 //arr fold: "" with: :acc el {acc . el} | |
14 } | |
15 | |
18 | 16 quote <- :str { |
17 "\"" . str . "\"" | |
18 } | |
19 | |
19
5a025e6c6f89
simple parallel requests limit test
William Morgan <bill@mrgn.org>
parents:
18
diff
changeset
|
20 evalRequest <- :id args { |
12
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
21 #{ |
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
22 string <- { |
20 | 23 idStr <- (quote: "id") . ":" . (quote: id) |
24 argsStr <- (quote: "arguments") . ":" . (quote: (strJoin: "," args)) | |
18 | 25 "{" . idStr . "," . argsStr . "}" |
12
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
26 } |
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
27 } |
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
28 } |
10
79c1db5e7ebd
sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff
changeset
|
29 |
15
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
30 guessRequest <- :id :prog { |
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
31 #{ |
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
32 string <- { |
17
566960135ea1
Small bit of cleanup now that the string escaping bug is fixed.
Mike Pavone <pavone@retrodev.com>
parents:
16
diff
changeset
|
33 idStr <- "\"id\":\"" . id . "\"" |
566960135ea1
Small bit of cleanup now that the string escaping bug is fixed.
Mike Pavone <pavone@retrodev.com>
parents:
16
diff
changeset
|
34 progStr <- "\"program\":\"" . prog . "\"" |
566960135ea1
Small bit of cleanup now that the string escaping bug is fixed.
Mike Pavone <pavone@retrodev.com>
parents:
16
diff
changeset
|
35 "{" . idStr . "," . progStr . "}" |
15
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
36 } |
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
37 } |
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
38 } |
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
39 |
12
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
40 main <- { |
20 | 41 print: ((evalRequest: "someId" #[1 2i64 3i64]) string) . "\n" |
15
18ec9131f594
one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents:
14
diff
changeset
|
42 print: ((guessRequest: "someId" "someProg") string) . "\n" |
12
7d8b8f82cbef
Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents:
10
diff
changeset
|
43 } |
10
79c1db5e7ebd
sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff
changeset
|
44 } |