josephus
::
Int
->
Int
->
Int
josephus n m
=
josephus_helper
[
0
..
(
n
-
1
)
]
m
-
1
where
josephus_helper
[
a
]
m
' = a
josephus_helper (a:as) m'
|
m
' == 0 = josephus_helper as m-1
| otherwise = josephus_helper (as++[a]) m'
-
1