Skip to content

Conversation

@dgr
Copy link
Contributor

@dgr dgr commented Jan 10, 2025

Add tests for:

  • quot
  • rem
  • mod

Also adds a file called portability.cljc in which we can add various portability functions.

Comment on lines +3 to +5
(defn big-int? [n]
(and (integer? n)
(not (int? n))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want a reader conditional here, right? If CLJ, use instance?, otherwise, use the generic check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but that makes it very specific to JVM. The doc strings say that int? returns true for a fixed-width integer, whereas integer? returns true for all integers, whether fixed with or big. So, I figured this would be slightly more portable than a direct class check using instance?.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I hear you. I was just wondering about the odds that there's an integer among Clojure dialects which isn't int? and which isn't a big int. 🤔 Maybe not worth considering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that and decided we could cross that bridge later. It's easy enough to rewrite at that time.

@jeaye jeaye merged commit 2c1eb3e into jank-lang:main Jan 10, 2025
2 checks passed
@jeaye
Copy link
Member

jeaye commented Jan 10, 2025

Nice work! 💪

@dgr dgr deleted the dgr-quot-rem-mod branch January 10, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants