view src/requests.tp @ 17:566960135ea1

Small bit of cleanup now that the string escaping bug is fixed.
author Mike Pavone <pavone@retrodev.com>
date Fri, 09 Aug 2013 04:31:14 -0700
parents cb5108f62f93
children a0e66161bde0
line wrap: on
line source

#{
	evalRequest <- :args {
		#{
			id <- "a"
			arguments <- args
			string <- {
				temp <- ""//arguments fold: "" with: :acc el {acc . el}
				"id" . id . "arguments" . temp
			}
		}
	}

	guessRequest <- :id :prog {
		#{
			string <- {
				//remove the second escaped quote, it will compile.
				idStr <- "\"id\":\"" . id . "\""
				progStr <- "\"program\":\"" . prog . "\""
				"{" . idStr . "," . progStr . "}"
			}
		}
	}

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