Logo

Programming-Idioms

History of Idiom 76 > diff from v54 to v55

Edit summary for version 55 by leif:
[Haskell] Use imports

Version 54

2019-09-26, 16:12:18

Version 55

2019-09-26, 21:16:36

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Extra Keywords
int radix
Extra Keywords
int radix
Imports
Imports
import Numeric (showIntAtBase)
import Data.Char (intToDigit)
Code
s x = Numeric.showIntAtBase 2 Data.Char.intToDigit x ""
Code
s x = showIntAtBase 2 intToDigit x ""