Skip to content
Subhajit Sahu edited this page Jan 24, 2021 · 5 revisions

Get n-bit parity. 📰 📘

Similar: count, parity.


parity x n
-- x: an Int
-- n: number of bits (1)
import Bit exposing (..)

parity 7 1
-- 1 (1,1,1 ⇒ 1)

parity 5 1
-- 0 (1,0,1 ⇒ 0)

parity 8 2
-- 2 (10,00 ⇒ 10)

parity 63 4
-- 12 (11,1111 ⇒ 1100)


References

Clone this wiki locally