Hacker News new | ask | show | jobs
by avmich 1686 days ago
For calculator problems like that, I use J:

   */ 0.03 24 30
21.6

   1e6 %~ (10e12 * 8) % */ 30 24 3600
30.8642

Usually requires some massaging, but still takes seconds.

1 comments

While APL dialects are very nice for this sort of thing, they generally don't understand units of measure or know about physical constants; you have to put those into them yourself. Here are some of my recent units(1) queries:

    141 pounds force 30 mm  # in joules
    1160/4
    log(3)/3/(log(2)/2)  # how much more efficient is one-hot ternary than one-hot binary?
    5V 7 μs / 7.3 A
    .0117% half avogadro mol / 1.251e9 years / (potassium+chlorine)g  # how radioactive is lite salt?
    3.27$/gallon  # in $/liter
    sqrt(2 2000 electronvolt/electronmass)
    18.8 foot pounds force # in joules
    163$/(7.9 g/cc * 1500 mm 3000 mm 3.2 mm)  # cold rolled steel price is higher than steel sold by weight
    m3/4 / 15 cfh
    2 pi sqrt(200 um / gravity)