From 68104a810240c51699781d33a8b7b87516c1dafd Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Sat, 17 May 2025 12:13:44 +0200 Subject: [PATCH] add example + only show scrollbars in Chrome when necessary --- src/App.css | 2 +- src/App.tsx | 3 ++- src/configurations.ts | 51 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/App.css b/src/App.css index f4787b2..05564f1 100644 --- a/src/App.css +++ b/src/App.css @@ -24,7 +24,7 @@ nav { main { grid-area: content; - overflow: scroll; + overflow: auto; } aside { diff --git a/src/App.tsx b/src/App.tsx index 86fa7d7..94867e6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,7 +3,7 @@ import './App.css'; import { CommandContext } from './CommandContext'; import { Editor, type EditorState } from './Editor'; import { extendedEnv } from './EnvContext'; -import { biggerExample, initialEditorState, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations"; +import { biggerExample, initialEditorState, lambda2Params, nonEmptyEditorState, tripleFunctionCallEditorState } from "./configurations"; import { evalEditorBlock } from "./eval"; const commands: [string, string[], string][] = [ @@ -19,6 +19,7 @@ const examples: [string, EditorState][] = [ ["push to list", nonEmptyEditorState], ["function w/ 4 params", tripleFunctionCallEditorState], ["bigger example", biggerExample], + ["lambda 2 params", lambda2Params], ]; type AppState = { diff --git a/src/configurations.ts b/src/configurations.ts index eda6120..0f5362c 100644 --- a/src/configurations.ts +++ b/src/configurations.ts @@ -252,4 +252,55 @@ export const biggerExample: EditorState = { } } } +}; + +export const lambda2Params: EditorState = { + "kind": "let", + "inner": { + "kind": "input", + "text": "", + "value": { + "kind": "text" + }, + "focus": false + }, + "name": "myAddInt", + "value": { + "kind": "lambda", + "paramName": "x", + "expr": { + "kind": "lambda", + "paramName": "y", + "expr": { + "kind": "call", + "fn": { + "kind": "call", + "fn": { + "kind": "input", + "text": "addInt", + "value": { + "kind": "name" + }, + "focus": false + }, + "input": { + "kind": "input", + "text": "x", + "value": { + "kind": "name" + }, + "focus": false + } + }, + "input": { + "kind": "input", + "text": "y", + "value": { + "kind": "name" + }, + "focus": false + } + } + } + } }; \ No newline at end of file