diff --git a/src/App.tsx b/src/App.tsx index 98b215a..9329df2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,7 +3,7 @@ import './App.css'; import { GlobalContext } from './GlobalContext'; import { ExprBlock, type ExprBlockState } from './ExprBlock'; import { extendedEnv } from './EnvContext'; -import { biggerExample, initialEditorState, lambda2Params, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations"; +import { biggerExample, higherOrder, initialEditorState, lambda2Params, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations"; import { evalEditorBlock } from "./eval"; const commands: [string, string[], string][] = [ @@ -15,11 +15,12 @@ const commands: [string, string[], string][] = [ ]; const examples: [string, ExprBlockState][] = [ - ["empty editor", initialEditorState], - ["push to list", nonEmptyEditorState], + ["empty editor" , initialEditorState ], + ["push to list" , nonEmptyEditorState ], ["function w/ 4 params", tripleFunctionCallEditorState], - ["bigger example", biggerExample], - ["lambda 2 params", lambda2Params], + ["bigger example" , biggerExample ], + ["lambda 2 params" , lambda2Params ], + ["higher order" , higherOrder ], ]; type AppState = { diff --git a/src/configurations.ts b/src/configurations.ts index 05bff68..dbf73b0 100644 --- a/src/configurations.ts +++ b/src/configurations.ts @@ -126,4 +126,6 @@ export const lambda2Params: ExprBlockState = { } } } -}; \ No newline at end of file +}; + +export const higherOrder: ExprBlockState = {"kind":"let","inner":{"kind":"call","fn":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"myBinaryApply","value":{"kind":"name"},"focus":false},"input":{"kind":"input","text":"1","value":{"kind":"literal","type":"Int"},"focus":false}},"input":{"kind":"input","text":"2","value":{"kind":"literal","type":"Int"},"focus":false}},"input":{"kind":"input","text":"addInt","value":{"kind":"name"},"focus":true}},"name":"myBinaryApply","value":{"kind":"lambda","paramName":"x","expr":{"kind":"lambda","paramName":"y","expr":{"kind":"lambda","paramName":"fn","expr":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"fn","value":{"kind":"name"},"focus":false},"input":{"kind":"input","text":"a","value":{"kind":"text"},"focus":false}},"input":{"kind":"input","text":"b","value":{"kind":"text"},"focus":true}}}}}}; \ No newline at end of file