{-# Language ViewPatterns #-} module Code (powerfulArray) where powerfulArray :: Int -> [Int] powerfulArray 0 = [] powerfulArray (pred -> n) = arrayN ++ 2^n : arrayN where arrayN = powerfulArray n
- {-# Language ViewPatterns #-}
- module Code (powerfulArray) where
- powerfulArray :: Int -> [Int]
- powerfulArray 0 = []
powerfulArray (pred -> n) = powerfulArray n ++ 2^n : powerfulArray n- powerfulArray (pred -> n) = arrayN ++ 2^n : arrayN
- where arrayN = powerfulArray n
Fundamentals
from itertools import chain numberprint = lambda n: int(''.join([str(x) for x in chain(range(1,n+1), range(n-1,0,-1))]))
numberprint=lambda n: int(''.join(str(x) for x in (list(range(1, n+1)) + list(range(n-1, 0, -1)))))- from itertools import chain
- numberprint = lambda n: int(''.join([str(x) for x in chain(range(1,n+1), range(n-1,0,-1))]))