on master help sign in
Hopefully fix'd conflict
a61faefChristian Widera
libraries/Array.elm−16
@@ -133,18 +133,10 @@ get = Native.Array.get
133 getMaybe 2 (A.fromList [3,2,1]) == Just 2
133 getMaybe 2 (A.fromList [3,2,1]) == Just 2
134 getMaybe 5 (A.fromList [3,2,1]) == Nothing
134 getMaybe 5 (A.fromList [3,2,1]) == Nothing
135-}
135-}
136−<<<<<<< HEAD
137getMaybe : Int -> Array a -> Maybe a
136getMaybe : Int -> Array a -> Maybe a
138getMaybe i array = if Native.Array.length array > i
137getMaybe i array = if Native.Array.length array > i
139 then Just (Native.Array.get i array)
138 then Just (Native.Array.get i array)
140 else Nothing
139 else Nothing
141−=======
142−safeGet : Int -> Array a -> Maybe a
143−safeGet i array =
144− if i < Native.Array.length array
145− then Just (Native.Array.get i array)
146− else Nothing
147−>>>>>>> dev
148
140
149{-| Get the element at the index. If the index is out of range, the given default
141{-| Get the element at the index. If the index is out of range, the given default
150element is returned.
142element is returned.
@@ -152,17 +144,9 @@ element is returned.
152 getSafe 0 2 (A.fromList [3,2,1]) == 1
144 getSafe 0 2 (A.fromList [3,2,1]) == 1
153 getSafe 0 5 (A.fromList [3,2,1]) == 0
145 getSafe 0 5 (A.fromList [3,2,1]) == 0
154-}
146-}
155−<<<<<<< HEAD
156getSafe : a -> Int -> Array a -> a
147getSafe : a -> Int -> Array a -> a
157getSafe default i array = if Native.Array.length array > i
148getSafe default i array = if Native.Array.length array > i
158 then Native.Array.get i array else default
149 then Native.Array.get i array else default
159−=======
160−getWithDefault : a -> Int -> Array a -> a
161−getWithDefault default i array =
162− if i < Native.Array.length array
163− then Native.Array.get i array
164− else default
165−>>>>>>> dev
166
150
167{-| Set the element at the index. Returns the updated array, or if the index is
151{-| Set the element at the index. Returns the updated array, or if the index is
168out of range, the unaltered array.
152out of range, the unaltered array.