Skip to content

Commit a774b36

Browse files
committed
Started preview implementation
1 parent cd2feb6 commit a774b36

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

preview_example.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"method": "preview",
3+
"params": {
4+
"response":"Sin[a x + b]"
5+
}
6+
}

preview_function.wl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
PreviewFunction[response_] := Module[{tolerance, correctQ, error},
3+
Print["Running Preview Function"];
4+
result = response;
5+
Print["Results"];
6+
Print[result];
7+
<|
8+
"command" -> "preview",
9+
"result" -> <|
10+
"preview" -> <|
11+
"message" -> result
12+
|>
13+
|>
14+
|>
15+
];
16+
17+
18+
evalQuestionIO = Function[
19+
Module[{jsonData, result},
20+
jsonData = Import[#1, "JSON"] //. List :> Association;
21+
requestData = jsonData["params"];
22+
response = requestData["response"];
23+
Print["Evaluating Response Against Answer"];
24+
result = PreviewFunction[response];
25+
Print["Response"];
26+
Print[result];
27+
Export[#2, result, "JSON", "Compact" -> True]
28+
]
29+
];
30+
31+
argv = Rest[$ScriptCommandLine];
32+
evalQuestionIO[argv[[1]], argv[[2]]]

0 commit comments

Comments
 (0)