Weird not & modBy result


#1

So I’m working through the Elm track on Exercism using Elm 0.19. I encountered the strangest thing while solving the Leap exercise.

I have the following functions, which I expect to be equivalent:

f1 : Int -> Bool
f1 year =
    modBy 3 year /= 0

f2 : Int -> Bool
f2 year =
    not (modBy 3 year == 0)

However, this test shows that they’re not:

Expect.equal (Leap.f1 1) (Leap.f2 1)

The output is:

True
╷
│ Expect.equal
╵
1

I don’t even know what that 1 is doing there, since both functions return Bool?

I’m sure I’m missing something obvious, can someone explain the behaviour I’m seeing?

Thanks!


#2

This is a known bug that will be fixed in the next release:


closed #3

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.