Spiral matrix: Difference between revisions

→‎{{header|Haskell}}: adding dependencies
(→‎{{header|Haskell}}: adding dependencies)
Line 877:
 
Solution based on the J hints:
<lang haskell>grademodule xsSpiral = map snd. sort $ zip xs [0..]where
 
import Data.List
import Control.Monad
import Control.Monad.Instances
 
grade xs = map snd. sort $ zip xs [0..]
values n = cycle [1,n,-1,-n]
counts n = (n:).concatMap (ap (:) return) $ [n-1,n-2..1]
751

edits