@@ -5,7 +5,7 @@ import Prelude
55import Control.Monad.Eff (Eff )
66import Control.Monad.Eff.Console (log , CONSOLE )
77
8- import Data.Array (range , foldM , unzip , zip , zipWithA , zipWith , intersectBy , intersect , (\\), deleteBy , delete , unionBy , union , nubBy , nub , groupBy , group' , group , span , dropWhile , drop , takeWhile , take , sortBy , sort , catMaybes , mapMaybe , filterM , filter , concat , concatMap , reverse , alterAt , modifyAt , updateAt , deleteAt , insertAt , findLastIndex , findIndex , elemLastIndex , elemIndex , (!!), uncons , init , tail , last , head , insertBy , insert , snoc , (:), length , null , singleton , fromFoldable )
8+ import Data.Array (range , foldM , unzip , zip , zipWithA , zipWith , intersectBy , intersect , (\\), deleteBy , delete , unionBy , union , nubBy , nub , groupBy , group' , group , span , dropWhile , drop , takeWhile , take , sortBy , sort , catMaybes , mapMaybe , mapWithIndex , filterM , filter , concat , concatMap , reverse , alterAt , modifyAt , updateAt , deleteAt , insertAt , findLastIndex , findIndex , elemLastIndex , elemIndex , (!!), uncons , init , tail , last , head , insertBy , insert , snoc , (:), length , null , singleton , fromFoldable )
99import Data.Foldable (for_ , foldMapDefaultR , class Foldable , all )
1010import Data.Maybe (Maybe (..), isNothing , fromJust )
1111import Data.Tuple (Tuple (..))
@@ -201,6 +201,9 @@ testArray = do
201201 log " catMaybe should take an array of Maybe values and throw out Nothings"
202202 assert $ catMaybes [Nothing , Just 2 , Nothing , Just 4 ] == [2 , 4 ]
203203
204+ log " mapWithIndex applies a function with an index for every element"
205+ assert $ mapWithIndex (\i x -> x - i) [9 ,8 ,7 ,6 ,5 ] == [9 ,7 ,5 ,3 ,1 ]
206+
204207 log " sort should reorder a list into ascending order based on the result of compare"
205208 assert $ sort [1 , 3 , 2 , 5 , 6 , 4 ] == [1 , 2 , 3 , 4 , 5 , 6 ]
206209
0 commit comments