fix on comments for pull request
This commit is contained in:
parent
848cf6e2ff
commit
ba4a974be9
|
@ -7,6 +7,7 @@ describe("reducer using mathjs parse", () => {
|
||||||
// Reducer.parse is called by Reducer.eval
|
// Reducer.parse is called by Reducer.eval
|
||||||
// See https://mathjs.org/docs/expressions/syntax.html
|
// See https://mathjs.org/docs/expressions/syntax.html
|
||||||
// See https://mathjs.org/docs/reference/functions.html
|
// See https://mathjs.org/docs/reference/functions.html
|
||||||
|
// Those tests show that we are converting mathjs parse tree to what we need
|
||||||
|
|
||||||
describe("expressions", () => {
|
describe("expressions", () => {
|
||||||
test("1", () => expectParseToBe("1", "Ok(1)"))
|
test("1", () => expectParseToBe("1", "Ok(1)"))
|
||||||
|
@ -49,8 +50,6 @@ describe("eval", () => {
|
||||||
// TODO more built ins
|
// TODO more built ins
|
||||||
})
|
})
|
||||||
describe("arrays", () => {
|
describe("arrays", () => {
|
||||||
//Note. () is a empty list in Lisp
|
|
||||||
// The only builtin structure in Lisp is list
|
|
||||||
test("empty array", () => expectEvalToBe( "[]", "Ok([])"))
|
test("empty array", () => expectEvalToBe( "[]", "Ok([])"))
|
||||||
test("[1, 2, 3]", () => expectEvalToBe( "[1, 2, 3]", "Ok([1, 2, 3])"))
|
test("[1, 2, 3]", () => expectEvalToBe( "[1, 2, 3]", "Ok([1, 2, 3])"))
|
||||||
test("['hello', 'world']", () => expectEvalToBe( "['hello', 'world']", "Ok(['hello', 'world'])"))
|
test("['hello', 'world']", () => expectEvalToBe( "['hello', 'world']", "Ok(['hello', 'world'])"))
|
||||||
|
|
|
@ -4,4 +4,4 @@ type codeTreeValue = CTV.codeTreeValue
|
||||||
|
|
||||||
type rec codeTree =
|
type rec codeTree =
|
||||||
| CtList(list<codeTree>) // A list to map-reduce
|
| CtList(list<codeTree>) // A list to map-reduce
|
||||||
| CtValue(codeTreeValue) // Irreducable built-in value. Reducer should not know the internals. External libraries are responsible
|
| CtValue(codeTreeValue) // Irreducible built-in value. Reducer should not know the internals. External libraries are responsible
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Irreducable values. Reducer does not know about those. Only used for external calls
|
Irreducible values. Reducer does not know about those. Only used for external calls
|
||||||
This is a configuration to to make external calls of those types
|
This is a configuration to to make external calls of those types
|
||||||
*/
|
*/
|
||||||
module AE = Reducer_Extra_Array
|
module AE = Reducer_Extra_Array
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Rerr = Reducer_Error
|
||||||
|
|
||||||
type reducerError = Rerr.reducerError
|
type reducerError = Rerr.reducerError
|
||||||
|
|
||||||
type rec node = {
|
type node = {
|
||||||
"type": string,
|
"type": string,
|
||||||
"isNode": bool,
|
"isNode": bool,
|
||||||
"comment": string
|
"comment": string
|
||||||
|
|
|
@ -9,18 +9,6 @@ type codeTree = CTT.codeTree
|
||||||
type codeTreeValue = CTV.codeTreeValue
|
type codeTreeValue = CTV.codeTreeValue
|
||||||
type reducerError = Rerr.reducerError
|
type reducerError = Rerr.reducerError
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// AccessorNode
|
|
||||||
// AssignmentNode
|
|
||||||
// BlockNode
|
|
||||||
// ConditionalNode
|
|
||||||
// FunctionAssignmentNode
|
|
||||||
// IndexNode
|
|
||||||
// ObjectNode
|
|
||||||
// RangeNode
|
|
||||||
// RelationalNode
|
|
||||||
// SymbolNode
|
|
||||||
|
|
||||||
let rec fromNode =
|
let rec fromNode =
|
||||||
(mjnode: MJ.node): result<codeTree, reducerError> =>
|
(mjnode: MJ.node): result<codeTree, reducerError> =>
|
||||||
MJ.castNodeType(mjnode) -> Result.flatMap(typedMjNode => {
|
MJ.castNodeType(mjnode) -> Result.flatMap(typedMjNode => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user