Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Integral mod #282

Open
Lignum opened this issue May 1, 2020 · 4 comments
Open

Integral mod #282

Lignum opened this issue May 1, 2020 · 4 comments
Labels
enhancement Standard Library Issues relating to the standard library and prelude

Comments

@Lignum
Copy link
Contributor

Lignum commented May 1, 2020

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

@SquidDev SquidDev added enhancement Standard Library Issues relating to the standard library and prelude labels Feb 27, 2021
@lc9er
Copy link

lc9er commented Jul 12, 2021

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 added a commit that referenced this issue Jul 13, 2021
@SquidDev
Copy link
Member

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
Copy link

lc9er commented Jul 14, 2021

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
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Standard Library Issues relating to the standard library and prelude
Projects
None yet
Development

No branches or pull requests

3 participants