view src/requests.tp @ 19:5a025e6c6f89

simple parallel requests limit test
author William Morgan <bill@mrgn.org>
date Fri, 09 Aug 2013 13:53:45 -0700
parents a0e66161bde0
children 92db3d1e8809
line wrap: on
line source

#{

	quote <- :str {
		"\"" . str . "\"" 
	}

	evalRequest <- :id args {
		#{
//			id <- _id
			string <- {
// 				idStr <- "a"//good
				idStr <- quote("id") . quote(id)//segfault
//				idStr <- "\"id\":\"" . id . "\""// method not implemented
//				argsStr <- ""//arguments fold: "" with: :acc el {acc . el}
				argsStr <- "b"
				"{" . idStr . "," . argsStr . "}"
			}
		}
	}

	guessRequest <- :id :prog {
		#{
			string <- {
				idStr <- "\"id\":\"" . id . "\""
				progStr <- "\"program\":\"" . prog . "\""
				"{" . idStr . "," . progStr . "}"
			}
		}
	}

	main <- {
		print: ((evalRequest: "someId" #[1 2 3]) string) . "\n"
		print: ((guessRequest: "someId" "someProg") string) . "\n"
	}
}