Skip to content

Can compare handle literal square root? #4

@a1exsh

Description

@a1exsh

Hi! First of all, thanks for putting your time into this project — I've found it extremely pleasant to work with so far! :-)

Now to my question. I'd like to print a table, sorted by a column where among numerical values like whole or rational numbers, occasionally a square root of a literal 2 would appear. For that to work (it doesn't currently) the generic comparison of such literals has to be supported. Is that feasible?

Currently:

(compare 2 3)
=> -1

(compare (literal-number 2) (literal-number 3))
=> -1
(compare 1 (sqrt (literal-number 2)))
Execution error (ClassCastException) at (REPL:1).
null

(compare (sqrt (literal-number 2)) (sqrt (literal-number 3)))
Execution error (ClassCastException) at (REPL:1).
null

E.g. a naïve approach could take the literal under the root and compare it to the other hand side, squared (or square both sides in case of the sqrt-to-sqrt comparison). How deeps is this rabbit hole after all? :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions