3 ms·
Heh, I hated writing arithmetic in lisp even when I used it fulltime with paredit. Fortunately, many languages have a rational type, even Python, which might b
by hombre_fatal 2y ago
Heh, I hated writing arithmetic in lisp even when I used it fulltime with paredit.
Fortunately, many languages have a rational type, even Python, which might be more ergonomic even if ratio literals aren't supported:
$ python
from fractions import Fraction as f
f(1, 2) + f(1, 8) + f(1, 8)
# 3/4
- neilv 2y agoYou didn't like the parentheses and prefix operator syntax? Syntax-wise, you could use Racket (or another Scheme, with a little more difficulty) to make a very thin layer over normal Scheme, and package it into a program called `calc`, like this: user@computer:~$ calc > 1/2 + 1/8 + 1/8 $1 = 3/4 > Or do you want a bigger library of off-the-shelf numeric tools, like Python, Julia, or R?
- hombre_fatal 2y agoI'm just showing that a more accessible language like Python has a repl with a ratio type.