From 8a9fd5ebfedfb57456f5057b2f78944d688648cc Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Fri, 6 Jun 2025 15:30:13 +0200 Subject: [PATCH] add example --- src/component/app/App.tsx | 3 ++- src/component/app/configurations.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/component/app/App.tsx b/src/component/app/App.tsx index f59c569..954b1ea 100644 --- a/src/component/app/App.tsx +++ b/src/component/app/App.tsx @@ -6,7 +6,7 @@ import { ExprBlock, type ExprBlockState } from '../expr/ExprBlock'; import { TypeInfoBlock } from '../other/Type'; import { Value } from '../other/Value'; import { actionShortcuts } from './actions'; -import { biggerExample, dynamic, emptySet, factorial, higherOrder, higherOrder2Params, inc, initialEditorState, lambda2Params, nonEmptyEditorState, pushBool, setOfListOfBool, tripleFunctionCallEditorState } from "./configurations"; +import { biggerExample, dynamic, emptySet, factorial, higherOrder, higherOrder2Params, inc, initialEditorState, lambda2Params, nonEmptyEditorState, pushBool, setOfListOfBool, transform, tripleFunctionCallEditorState } from "./configurations"; import { extendedEnv } from './environment'; import './App.css'; @@ -25,6 +25,7 @@ const examples: [string, ExprBlockState][] = [ ["factorial" , factorial ], ["set of list of bool" , setOfListOfBool ], ["dynamic" , dynamic ], + ["transform" , transform ], ]; type AppState = { diff --git a/src/component/app/configurations.ts b/src/component/app/configurations.ts index f688d10..2271264 100644 --- a/src/component/app/configurations.ts +++ b/src/component/app/configurations.ts @@ -147,4 +147,6 @@ export const factorial: ExprBlockState = {"kind":"let","name":"factorial","focus export const setOfListOfBool: ExprBlockState = {"kind":"call","fn":{"kind":"input","text":"set.emptySet","value":{"kind":"name"},"focus":false},"input":{"kind":"call","fn":{"kind":"input","text":"compareLists","value":{"kind":"name"}},"input":{"kind":"input","text":"compareDoubles","value":{"kind":"name"}}}}; -export const dynamic: ExprBlockState = {"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"addInt","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"input","text":"getInst","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"newDynamic","value":{"kind":"name"}},"input":{"kind":"input","text":"52","value":{"kind":"literal","type":"Int"}}},"input":{"kind":"input","text":"Int","value":{"kind":"name"}}}}},"input":{"kind":"input","text":"1","value":{"kind":"literal","type":"Int"}}}; \ No newline at end of file +export const dynamic: ExprBlockState = {"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"addInt","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"input","text":"getInst","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"newDynamic","value":{"kind":"name"}},"input":{"kind":"input","text":"52","value":{"kind":"literal","type":"Int"}}},"input":{"kind":"input","text":"Int","value":{"kind":"name"}}}}},"input":{"kind":"input","text":"1","value":{"kind":"literal","type":"Int"}}}; + +export const transform: ExprBlockState = {"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"transform","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"input","text":"newLiteral","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"newDynamic","value":{"kind":"name"}},"input":{"kind":"input","text":"42","value":{"kind":"literal","type":"Int"}}},"input":{"kind":"input","text":"Int","value":{"kind":"name"}}}}},"input":{"kind":"call","fn":{"kind":"input","text":"newLiteral","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"newDynamic","value":{"kind":"name"}},"input":{"kind":"call","fn":{"kind":"input","text":"addInt","value":{"kind":"name"}},"input":{"kind":"input","text":"1","value":{"kind":"literal","type":"Int"}}}},"input":{"kind":"call","fn":{"kind":"call","fn":{"kind":"input","text":"fnType","value":{"kind":"name"}},"input":{"kind":"lambda","paramName":"_","focus":true,"expr":{"kind":"input","text":"Int","value":{"kind":"name"}}}},"input":{"kind":"lambda","paramName":"_","focus":true,"expr":{"kind":"input","text":"Int","value":{"kind":"name"}}}}}}}; \ No newline at end of file