From 9d57545533e21aa685925bb6e0649a249311eb87 Mon Sep 17 00:00:00 2001 From: sforman Date: Fri, 28 Jul 2023 15:04:35 -0700 Subject: [PATCH] A start on Joy types. --- implementations/Elm/src/Joy.elm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 implementations/Elm/src/Joy.elm diff --git a/implementations/Elm/src/Joy.elm b/implementations/Elm/src/Joy.elm new file mode 100644 index 0000000..5d5c641 --- /dev/null +++ b/implementations/Elm/src/Joy.elm @@ -0,0 +1,25 @@ +module Joy exposing (joyTermToString) + + +type JoyType + = Symbol String + | Integer Int + | JoyList (List JoyType) + | JoyTrue + | JoyFalse + + +joyTermToString : JoyType -> String +joyTermToString term = + case term of + Symbol name -> + name + Integer n -> + String.fromInt n + JoyTrue -> + "true" + JoyFalse -> + "false" + JoyList list -> + "[" ++ (String.join " " (List.map joyTermToString list)) ++ "]" +