Hacker News new | past | comments | ask | show | jobs | submit login

That's definitely pathological, but not from a "small function" point of view. xor_it is simple unnecessary to write and xor_them is just a fold on xor_it. This is undue multiplication of names.

    _ = require 'underscore'
    xor_them = (them) -> _.reduce(them, (a,b) -> a^b)
Or better

    import Data.Bits (xor)

    xor_them :: Bits a => [a] -> a
    xor_them = foldl1 xor



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: