Post History
Haskell, 62 bytes (\n->(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")) No import needed. It just uses standard Prelude functions. scanl(*)1$cycle[5,2] will give you the infinit...
Answer
#5: Post edited
# Haskell, 56 bytes- ```
(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")- ```
No import needed.- ```
- scanl(*)1$cycle[5,2]
- ```
- will give you the infinite list of [1,5,10,50...]. With
- ```
- length$takeWhile(/=n)"IVXLCDM"
- ```
- you will get the index of the element you would like to look up.
- If you set
- ```haskell
- n='V'
- ```
- the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
- # Haskell, 62 bytes
- ```
- (\n->(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM"))
- ```
- No import needed. It just uses standard Prelude functions.
- ```
- scanl(*)1$cycle[5,2]
- ```
- will give you the infinite list of [1,5,10,50...]. With
- ```
- length$takeWhile(/=n)"IVXLCDM"
- ```
- you will get the index of the element you would like to look up.
- If you set
- ```haskell
- n='V'
- ```
- the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
#4: Post edited
- # Haskell, 56 bytes
- ```
- (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
- ```
- ```
- scanl(*)1$cycle[5,2]
- ```
- will give you the infinite list of [1,5,10,50...]. With
- ```
- length$takeWhile(/=n)"IVXLCDM"
- ```
- you will get the index of the element you would like to look up.
- If you set
- ```haskell
- n='V'
- ```
- the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
- # Haskell, 56 bytes
- ```
- (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
- ```
- No import needed.
- ```
- scanl(*)1$cycle[5,2]
- ```
- will give you the infinite list of [1,5,10,50...]. With
- ```
- length$takeWhile(/=n)"IVXLCDM"
- ```
- you will get the index of the element you would like to look up.
- If you set
- ```haskell
- n='V'
- ```
- the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.
#3: Post edited
- # Haskell, 56 bytes
```haskell- (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
- ```
- If you set
- ```haskell
- n='V'
- ```
you'll get 5.
- # Haskell, 56 bytes
- ```
- (scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")
- ```
- ```
- scanl(*)1$cycle[5,2]
- ```
- will give you the infinite list of [1,5,10,50...]. With
- ```
- length$takeWhile(/=n)"IVXLCDM"
- ```
- you will get the index of the element you would like to look up.
- If you set
- ```haskell
- n='V'
- ```
- the length part will be 1, and the index 1 means the 2nd element, so you'll get 5.