Comments (5)
This is awesome, thank you, great work on numbat!! (I think we can close this issue, thank you so much!!!)
from insect.
This is an excellent idea, thank you very much. And I have good news. I am currently working on a complete rewrite on Insect. One of the key new features is that users are able to define units on their own (see unit
keyword below, and ignore the additional dimension
definition for now... this might not be mandatory in the future). I translated your pseudo Insect code to actual Insect-new code:
And this program correctly prints what you expected:
500.000000 workday
300.000000 workday
5.000000 FTE
(yeah, I need to work on the output formatting)
The bad news is that this new version is quite far from feature parity with the current version, so this will take some time until I can release it.
In the meantime, we could certainly think about introducing this to the current version somehow, but hard-coding those units (e.g. workday = 8 workhours
) seems a bit strange.
from insect.
Hi! Thank you, these are great news regarding the rewrite!! (note about the custom dimensions, sympy seems to have a similar separation between units and their underlying dimensions... and yes, I also think that workhours are best represented in a different dimension than regular time).
In the meantime, a minimal change would be to only introduce a single, hardcoded dummy unit, either workhour
or workday
. This would enable all of the above calculations without hardcoding any country- or project-dependant stuff. This change would add a single line of code, similar to Q.workhour ==> ["workhour", "workhours", "manhour", "manhours"]
, right? Would you accept this as PR - or be so kind to implement it yourself, since I have never programmed in purescript yet?
thank you and best regards, Johannes
from insect.
In the meantime, a minimal change would be to only introduce a single, hardcoded dummy unit, either
workhour
orworkday
. This would enable all of the above calculations without hardcoding any country- or project-dependant stuff.
I don't think that works. We do have "dummy" units like this, see: #136 (comment). We could abuse e.g. piece
to mean "workhour". But then this happens:
That is correct, but we can not convert to workdays, because that is not a proper unit:
result ➞ workday
= 4000 piece
As a workaround, you can do
result / workday
= 500
which yields the desired result. But it's a bit unsatisfactory.
This change would add a single line of code, similar to
Q.workhour ==> ["workhour", "workhours", "manhour", "manhours"]
, right?
There is a bit more work involved in a dependency: https://github.com/sharkdp/purescript-quantities — but following what we do for e.g. "piece" or "person" should work.
from insect.
@johannesjh You can now play with this online: https://numbat.dev/ (I added your code as an example Numbat program here: https://github.com/sharkdp/numbat/blob/master/examples/workhours.nbt)
from insect.
Related Issues (20)
- Generate linux binaries for armhf and arm64 HOT 1
- Insect shows errors if `xdgBasedir.data` or any of its parents don't exist HOT 6
- [cli] Change unconventional behavior of Ctrl-C HOT 2
- Document .insectrc
- Use insectrc in non-interactive operation HOT 1
- Add optional precision argument to round() HOT 6
- `insect` command accepts commands such as quit (both as argument and from stdin) HOT 1
- Support underscores as separators HOT 4
- `copy`/`cp` doesn't seem to work on Wayland
- Output error when input to factorial is not a non-negative integer HOT 2
- Allow repeated factorial HOT 1
- Unit 'knot' is not documented HOT 1
- Variadic functions HOT 4
- Support for Oersted: unit of auxiliary magnetic field strength H HOT 15
- Support for Planck units and Stoney units. HOT 8
- Error making a simple division HOT 2
- The results are not accurate: `10^18 + 1 = 1000000000000000000` HOT 1
- Convert output to Standard Scientific Notation HOT 2
- Insect giving incorrect result! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insect.