From 477579b5e8c7297efefc1ccabf8ead7c024ac4dc Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 29 Jan 2022 23:51:02 +0200 Subject: Add repr, testing example --- src/main.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/main.hs b/src/main.hs index 0f0aeb8..e14e5ac 100644 --- a/src/main.hs +++ b/src/main.hs @@ -200,6 +200,10 @@ interpretWord state@LState {lDefs = defs, lDict = dict, lSource = source, lPhras let (LSymbol "]" : stack') = stack (body, _ : newStack) = break (== LSymbol "[") stack' in pure $ state {lStack = LPhrase (reverse body) : newStack} + "repr" -> + let (word : stack') = stack + reprStr = reprWord word $> map LChar .> LPhrase + in pure $ state {lStack = reprStr : stack'} "pop" -> let (LPhrase phrase : stack') = stack (first : rest) = phrase -- cgit v1.3