https://github.com/tfausak/exercism-solutions/blob/master/haskell/binary/Binary.hs
module Binary
( toDecimal
) where
import Data.List (foldl')
toDecimal :: String -> Int
toDecimal = convert fromBinary 2 where
fromBinary = fromEnum . ('1' ==)
convert :: (Char -> Int) -> Int -> String -> Int
convert fromBase radix string = foldl' accumulate 0 values where
values = map fromBase string
accumulate number digit = number * radix + digit
https://github.com/AaronLasseigne/exercism-answers/blob/master/clojure/binary/binary.clj
(ns binary)
(defn- bit->int [bit]
(if (= bit \1) 1 0))
(defn- binary->decimal [shift bit]
(bit-shift-left bit shift))
(defn to-decimal [binary]
(->> binary
(map bit->int)
(reverse)
(map-indexed binary->decimal)
(reduce +)))