| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-27 10:31:16 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-27 10:31:16 +0200 | 
| commit | 2c9b2af9ac011a871c5c02d3e2258fca73a98880 (patch) | |
| tree | 653db3959f444f1065f05658650c6ec81863d627 /elm/battlemap/src/Util | |
| parent | 33e57128d48a012533c42635f52037fcdedd4c56 (diff) | |
Splits client and server into two repositories.
Diffstat (limited to 'elm/battlemap/src/Util')
| -rw-r--r-- | elm/battlemap/src/Util/Array.elm | 14 | ||||
| -rw-r--r-- | elm/battlemap/src/Util/List.elm | 12 | 
2 files changed, 26 insertions, 0 deletions
| diff --git a/elm/battlemap/src/Util/Array.elm b/elm/battlemap/src/Util/Array.elm new file mode 100644 index 0000000..8088244 --- /dev/null +++ b/elm/battlemap/src/Util/Array.elm @@ -0,0 +1,14 @@ +module Util.Array exposing (update) + +import Array + +update : ( +      Int -> +      ((Maybe t) -> (Maybe t)) -> +      (Array t) -> +      (Array t) +   ) +update index fun array = +   case (fun (Array.get index array)) of +      Nothing -> array +      (Just e) -> (Array.set index e array) diff --git a/elm/battlemap/src/Util/List.elm b/elm/battlemap/src/Util/List.elm new file mode 100644 index 0000000..c4db397 --- /dev/null +++ b/elm/battlemap/src/Util/List.elm @@ -0,0 +1,12 @@ +module Util.List exposing (pop) + +import List + +pop : List a -> (Maybe (a, List a)) +pop l = +   case +      ((List.head l), (List.tail l)) +   of +      (Nothing, _) -> Nothing +      (_ , Nothing) -> Nothing +      ((Just head), (Just tail)) -> (Just (head, tail)) | 


