summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/elm/Util')
-rw-r--r--src/shared/elm/Util/Array.elm18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/shared/elm/Util/Array.elm b/src/shared/elm/Util/Array.elm
index 362c924..26d13f6 100644
--- a/src/shared/elm/Util/Array.elm
+++ b/src/shared/elm/Util/Array.elm
@@ -6,6 +6,7 @@ module Util.Array exposing
indexed_search
)
+import List
import Array
update : (
@@ -36,5 +37,18 @@ filter_first fun array =
indexed_search : (t -> Bool) -> (Array.Array t) -> (Maybe (Int, t))
indexed_search fun array =
- -- TODO
- Nothing
+ (List.foldl
+ (\v res ->
+ (
+ case res of
+ (Just e) -> res
+ Nothing ->
+ let (index, value) = v in
+ if (fun value)
+ then (Just v)
+ else Nothing
+ )
+ )
+ Nothing
+ (Array.toIndexedList array)
+ )