OSDN Git Service
(root)
/
joypy
/
Thun.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eb8b282
)
dup
author
sforman
<sforman@hushmail.com>
Sat, 29 Jul 2023 16:22:26 +0000
(09:22 -0700)
committer
sforman
<sforman@hushmail.com>
Sat, 29 Jul 2023 16:22:26 +0000
(09:22 -0700)
implementations/Elm/src/Joy.elm
patch
|
blob
|
history
diff --git
a/implementations/Elm/src/Joy.elm
b/implementations/Elm/src/Joy.elm
index
da79796
..
c25b8aa
100644
(file)
--- a/
implementations/Elm/src/Joy.elm
+++ b/
implementations/Elm/src/Joy.elm
@@
-45,6
+45,7
@@
joy_eval symbol stack expression =
"clear" -> Ok ([], expression)
"concat" -> joy_concat stack expression
"cons" -> joy_cons stack expression
+ "dup" -> joy_dup stack expression
_ -> Err ("Unknown word: " ++ symbol)
@@
-80,6
+81,12
@@
joy_cons stack expression =
Err msg -> Err msg
+joy_dup : JList -> JList -> Result String (JList, JList)
+joy_dup stack expression =
+ case pop_any(stack) of
+ Ok (a, s0) -> Ok ((a :: stack), expression)
+ Err msg -> Err msg
+
push_int : Int -> JList -> JList
push_int i stack = (JoyInt i) :: stack