codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
import Char main = putStrLn $ digitList 6 digitList n = unlines . map dashify . halfMap reverse $ explode where explode = reverse . take n . iterate tail . map intToDigit . reverse $ [1..n] halfMap f [] = [] halfMap f (x:xs) = f x : halfMapDud f xs halfMapDud f [] = [] halfMapDud f (x:xs) = x : halfMap f xs dashify [] = [] dashify (x:[]) = x:[] dashify (x:xx:xs) = x:'-':dashify (xx:xs)
Private
[
?
]
Run code
Submit