annotate src/requests.tp @ 20:92db3d1e8809

strJoin finally works.
author William Morgan <bill@mrgn.org>
date Fri, 09 Aug 2013 15:52:16 -0700
parents 5a025e6c6f89
children a4ac42c69285
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
79c1db5e7ebd sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff changeset
1 #{
18
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
2
20
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
3 strJoin <- :str arr {
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
4 //head <- arr.get(0)
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
5 //tail <- arr.
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
6 print: "go\n"
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
7 //print: (string: (arr length))
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
8 acc <- ""
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
9 arr foreach: :i el {
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
10 print: (string: i) . " " . (string: el) . "\n"
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
11 if: i = 0 {
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
12 acc <- (string: el)
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
13 } else: {
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
14 acc <- acc . ", " . (string: el)
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
15 }
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
16 }
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
17 print: "stop\n"
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
18 acc
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
19 //arr fold: "" with: :acc el {acc . el}
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
20 }
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
21
18
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
22 quote <- :str {
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
23 "\"" . str . "\""
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
24 }
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
25
19
5a025e6c6f89 simple parallel requests limit test
William Morgan <bill@mrgn.org>
parents: 18
diff changeset
26 evalRequest <- :id args {
12
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 string <- {
20
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
29 idStr <- (quote: "id") . ":" . (quote: id)
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
30 argsStr <- (quote: "arguments") . ":" . (quote: (strJoin: "," args))
18
a0e66161bde0 for bug investigation
William Morgan <bill@mrgn.org>
parents: 17
diff changeset
31 "{" . idStr . "," . argsStr . "}"
12
7d8b8f82cbef Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents: 10
diff changeset
32 }
7d8b8f82cbef Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents: 10
diff changeset
33 }
7d8b8f82cbef Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents: 10
diff changeset
34 }
10
79c1db5e7ebd sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff changeset
35
15
18ec9131f594 one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
36 guessRequest <- :id :prog {
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 string <- {
17
566960135ea1 Small bit of cleanup now that the string escaping bug is fixed.
Mike Pavone <pavone@retrodev.com>
parents: 16
diff changeset
39 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
40 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
41 "{" . idStr . "," . progStr . "}"
15
18ec9131f594 one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
42 }
18ec9131f594 one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
43 }
18ec9131f594 one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
44 }
18ec9131f594 one more compiler bug for mike.
William Morgan <bill@mrgn.org>
parents: 14
diff changeset
45
12
7d8b8f82cbef Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents: 10
diff changeset
46 main <- {
20
92db3d1e8809 strJoin finally works.
William Morgan <bill@mrgn.org>
parents: 19
diff changeset
47 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
48 print: ((guessRequest: "someId" "someProg") string) . "\n"
12
7d8b8f82cbef Help Bill work around some compiler bugs
Mike Pavone <pavone@retrodev.com>
parents: 10
diff changeset
49 }
10
79c1db5e7ebd sending broken file for mike to check error
William Morgan <bill@mrgn.org>
parents:
diff changeset
50 }