Merge branch master
Conflicts: main.hs
This commit is contained in:
commit
6658a2bc39
@ -13,9 +13,9 @@ parseDiceware x = map (last . split ' ') $ lines x
|
|||||||
-- Lookup word with dice index
|
-- Lookup word with dice index
|
||||||
readDiceware :: Diceware -> Int -> String
|
readDiceware :: Diceware -> Int -> String
|
||||||
readDiceware d n = show n ++ " -> " ++
|
readDiceware d n = show n ++ " -> " ++
|
||||||
case (undice n) of
|
case (undice n) of
|
||||||
Just x -> d !! x
|
Just x -> d !! x
|
||||||
Nothing -> "Does not exist"
|
Nothing -> "Does not exist"
|
||||||
|
|
||||||
-- Lookup word with linear index
|
-- Lookup word with linear index
|
||||||
readDiceware' :: Diceware -> Int -> String
|
readDiceware' :: Diceware -> Int -> String
|
||||||
@ -25,4 +25,4 @@ readDiceware' d n = d !! n
|
|||||||
-- Ex. undice 11121 == Just 6
|
-- Ex. undice 11121 == Just 6
|
||||||
undice :: Int -> Maybe Int
|
undice :: Int -> Maybe Int
|
||||||
undice n = elemIndex n . filter
|
undice n = elemIndex n . filter
|
||||||
(null . (intersect "0789") . show) $ [11111..66666]
|
(null . (intersect "0789") . show) $ [11111..66666]
|
||||||
|
@ -5,7 +5,6 @@ module Alea.List where
|
|||||||
split :: (Eq a) => a -> [a] -> [[a]]
|
split :: (Eq a) => a -> [a] -> [[a]]
|
||||||
split _ [] = [[]]
|
split _ [] = [[]]
|
||||||
split delim (c:cs)
|
split delim (c:cs)
|
||||||
| c == delim = [] : rest
|
| c == delim = [] : rest
|
||||||
| otherwise = (c : head rest) : tail rest
|
| otherwise = (c : head rest) : tail rest
|
||||||
where
|
where rest = split delim cs
|
||||||
rest = split delim cs
|
|
||||||
|
@ -15,7 +15,7 @@ Example usage:
|
|||||||
$ alea
|
$ alea
|
||||||
doso epurai usci selve dirupo bs
|
doso epurai usci selve dirupo bs
|
||||||
|
|
||||||
$ alea --phrases 3 --phraselength 8
|
$ alea -p 3 -l 8
|
||||||
sturai sapone ripeto leghi osasse fori terme oserai
|
sturai sapone ripeto leghi osasse fori terme oserai
|
||||||
carta getto osiamo banale figura smilzi celibe gigli
|
carta getto osiamo banale figura smilzi celibe gigli
|
||||||
porvi rs traini dotati aureo solito malato gelate
|
porvi rs traini dotati aureo solito malato gelate
|
||||||
|
Loading…
Reference in New Issue
Block a user