module Joy exposing (doit, JoyDict)
import Bitwise
-import Dict exposing (Dict)
+import Dict exposing (Dict, get)
import Result exposing (andThen)
import String exposing (replace, words)
Err msg ->
if "Unknown word." == msg then
-- Look up word in dictionary.
- Err ("Unknown word: " ++ symbol)
+ case get symbol dict of
+ Just definition ->
+ Ok (stack, definition ++ expression, dict)
+ Nothing ->
+ Err ("Unknown word: " ++ symbol)
else
Err msg
Ok (stack0, expression0) -> Ok (stack0, expression0, dict)