Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support +inf.0 -inf.0 +nan.0 -nan.0 #166

Merged
merged 6 commits into from
Feb 11, 2024
Merged

Conversation

wmedrano
Copy link
Contributor

Required storing a "next" token since +inf.0 was being parsed as 2 tokens: + and inf.0.

Seems like this behavior is used to make creating addition functions easy like:

(define x 1234)
+x => function that adds 1234.

Comment on lines 178 to 183
_ => {
self.depth -= 1;
let res = self.format_with_cycles(val, f);
self.depth += 1;
res
}
Copy link
Owner

Choose a reason for hiding this comment

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

I'm having some trouble following this change - what was the purpose here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redid this part, I think this is cleaner. I can also revert back to having to separate but similar functions.

  • High level: format_with_cycles and top_level_format_with cycles seem to be very similar (difference) so tried to unify.
  • Previously reviewed approach: Reused one of the functions when the special cases didn't match. But this means the depth was artificially increased a level. Probably doesn't matter but tried to keep the depth anyways.
  • New approach - Pass an enum specifying which behavior to use.

Copy link
Owner

Choose a reason for hiding this comment

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

got it, I understand, I haven't looked at some of these functions in a long time 😄

@mattwparas mattwparas merged commit 95bb74a into mattwparas:master Feb 11, 2024
3 checks passed
@wmedrano wmedrano deleted the inf branch February 11, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants