Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- conway :: Integer -> [Integer]
- conway 1 = [1]
- conway x = conway_start_line $ conway (x-1) --ghost x
- where
- conway_count :: Integer -> Integer -> [Integer] -> [Integer]
- conway_count num c [] = [c,num]
- conway_count num c (n:ns) -- Numero da trovare, count, (primo:altri)
- | num == n = conway_count num (c+1) ns
- | otherwise = c : (num : (conway_count n 1 ns))
- --
- conway_start_line :: [Integer] -> [Integer]
- conway_start_line (n:ns)= conway_count n 1 ns --Avvia la sequenza
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement