fix factorial example
This commit is contained in:
parent
7b6d18bc6a
commit
4a89ccd5d1
3 changed files with 8 additions and 5 deletions
|
|
@ -3,8 +3,8 @@
|
|||
position: relative;
|
||||
}
|
||||
.editor.unknown {
|
||||
border: 1px dashed dodgerblue;
|
||||
display: inline-block;
|
||||
/* border: 1px dashed dodgerblue;
|
||||
display: inline-block; */
|
||||
}
|
||||
.editor.error, .editor.unknown.error {
|
||||
border: 1px solid red;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { useEffect, useRef, type ReactNode, type KeyboardEvent, useState } from "react";
|
||||
|
||||
import "./Input.css";
|
||||
import { focusPrevElement, focusNextElement, setRightMostCaretPosition } from "../../util/dom_trickery";
|
||||
|
||||
import "./Input.css";
|
||||
|
||||
interface InputProps {
|
||||
placeholder: string;
|
||||
text: string;
|
||||
|
|
|
|||
|
|
@ -107,19 +107,21 @@ export function deepEvalCall(s: CallBlockState, env: DynamicEnvironment): DeepEv
|
|||
}
|
||||
}
|
||||
export function deepEvalLet(s: LetInBlockState, env: DynamicEnvironment): DeepEvalResultLet {
|
||||
let valueResult;
|
||||
const valueEnv = {
|
||||
names: trie.insert(env.names)(s.name)({
|
||||
// dirty: we introduce indirection to enable recursion
|
||||
recursive: true,
|
||||
i: () => {
|
||||
try {
|
||||
return { val: valueResult.val };
|
||||
return valueResult;
|
||||
} catch (e) {
|
||||
return { err: e };
|
||||
}
|
||||
},
|
||||
}),
|
||||
};
|
||||
const valueResult = deepEvalExpr(s.value, valueEnv);
|
||||
valueResult = deepEvalExpr(s.value, valueEnv);
|
||||
const innerEnv = {
|
||||
names: trie.insert(env.names)(s.name)({i: valueResult.val}),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue