slack1
2021-10-16 10:52:13

How does one find the source code for Racket’s quotient/remainder ?


slack1
2021-10-16 10:52:23

I’ve had poor luck searching through the Github repo


laurent.orseau
2021-10-16 11:39:21

In drracket, type it in the definitions, then right click on it, and Open defining file (iirc)


laurent.orseau
2021-10-16 11:40:50

That won’t work if it’s one of the rare primitives defined in non racket code though. that shouldn’t apply to quotient/remainder though


soegaard2
2021-10-16 12:10:41

I think it could me using gmp.


soegaard2
2021-10-16 12:13:31

At least in Racker BC. In Racket CS it might be a Chez Scheme primitively.


laurent.orseau
2021-10-16 12:58:45

Ah indeed, there’s not such “Open defining file” for this one, which is a tell that it’s a primitive indeed.


laurent.orseau
2021-10-16 12:59:35

laurent.orseau
2021-10-16 13:03:01

that’s for BC though, still looking for CS’ variant


laurent.orseau
2021-10-16 13:04:01

soegaard2
2021-10-16 14:36:22

Wait … that just calls #%$quotient-remainder. But where is that defined?


laurent.orseau
2021-10-16 15:02:38

My guess is it’s c code


laurent.orseau
2021-10-16 15:03:53

but I can’t find it. Somewhere inside Chez maybe? (isn’t it entirely embedded inside Racket though? I have no idea)



gmauer
2021-10-17 03:52:14

when I have an array arr what is the best way to check if an index is in bounds? Surely it can’t be as complex as doing array-shape and running a bunch of if comparisons