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

Units symbol not registered in CLJS #13

Closed
zikajk opened this issue Feb 27, 2024 · 4 comments
Closed

Units symbol not registered in CLJS #13

zikajk opened this issue Feb 27, 2024 · 4 comments

Comments

@zikajk
Copy link

zikajk commented Feb 27, 2024

My existing code doesn't work in CLJS after updating from "2023.12.15" to "2024.02.27".
b/to-edn doesn't recognize unit symbols properly.
Screenshot 2024-02-27 at 10 43 18

@2food
Copy link
Contributor

2food commented Feb 29, 2024

Hi @zikajk. Sorry about that. I've had some trouble with getting the cljs implementation working right. But I think I've got it right in the latest release "2024.02.29". Could you give that a try and see if it works for you?

@zikajk
Copy link
Author

zikajk commented Mar 5, 2024

Hi @2food, it looks good, thank you.
I had to optimize some code to check on new type broch.numbers/JSRatio and so far no problems.
What would be the recommended way to display JSRatio as a string ("#.#######") in your opinion?

@zikajk
Copy link
Author

zikajk commented Mar 5, 2024

I tried to use b/boxed on jsRation but I have some issues
No protocol method IQuantity.number defined for type broch.numbers/JSRatio: 82000000/707107

@2food
Copy link
Contributor

2food commented Apr 3, 2024

Hi @zikajk ,

What would be the recommended way to display JSRatio as a string ("#.#######") in your opinion?
I think the default way "1/3" is often fine, but you can truncate it to a float with broch.number/js-ratio->number as well.

I tried to use b/boxed on jsRation but I have some issues
No protocol method IQuantity.number defined for type broch.numbers/JSRatio: 82000000/707107

From the error it looks like you're calling b/boxed on a JSRatio rather than on a quantity. Most functions in broch.core can take numbers in place of quantities, but I see that this is not the case for JSRatio as it's not a "normal" number. So this is a bug, I'll fix it to include JSRatios in the next release.

Thanks for your comments and sorry for the very late response.

@2food 2food closed this as completed Apr 3, 2024
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

No branches or pull requests

2 participants