Skip to content

Comment on Show HN: While the world builds AI Agents, I'm just building calculatorsparent

Comments

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

You 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?

I'm just showing that a more accessible language like Python has a repl with a ratio type.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.