amuletml/amulet

Integral mod

Opened this issue · 4 comments

There's modf in lua/math.ml, but no binding to Lua's % operator.

lc9er commented

I (think) I see the same thing. When I try to use it, I get

`> 10 % 3
=stdin[1:1 ..1:2]: error (E2001)

1 │ 10 % 3
│ ^^
Couldn't match actual type int
with the type expected by the context, 'cat 'b 'c
=stdin[1:6 ..1:6]: error (E2001)

1 │ 10 % 3
│ ^
Couldn't match actual type int
with the type expected by the context, 'cat 'a 'b

The following message has a detailed explanation: 2001.
Try ':explain 2001' to see it.`

Same if I make the numbers floats or try to use '%.'.

I've added an integer float function (5 `mod` 2). Not sure of a good name for a float-based one though, unless we make it a type class.

lc9er commented

I've added an integer float function (5 `mod` 2). Not sure of a good name for a float-based one though, unless we make it a type class.

Thanks for looking into this, SquidDev. Should that change be in the nightly build? I tried pulling it, but it wasn't there.

Looks like our nightly build is having some issues. I'll have a look and see what I can do.

Thanks for mentioning this - I'm not very good at keeping an eye on that job.