amuletml / amulet

An ML-like functional programming language
https://amulet.works/
BSD 3-Clause "New" or "Revised" License
328 stars 16 forks source link

Integral mod #282

Open Lignum opened 4 years ago

Lignum commented 4 years ago

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

lc9er commented 3 years ago

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 '%.'.

SquidDev commented 3 years ago

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 3 years ago

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.

SquidDev commented 3 years ago

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.