mirror of
https://github.com/janet-lang/janet
synced 2024-12-29 18:00:26 +00:00
boot.janet, compare*, light formatting
Since those represent code, they should get backticks.
This commit is contained in:
parent
7c8f5ef811
commit
53400ecac1
@ -731,11 +731,11 @@
|
|||||||
## Polymorphic comparisons
|
## Polymorphic comparisons
|
||||||
|
|
||||||
(defn compare
|
(defn compare
|
||||||
`Polymorphic compare. Returns -1, 0, 1 for x < y, x = y, x > y respectively.
|
``Polymorphic compare. Returns -1, 0, 1 for x < y, x = y, x > y respectively.
|
||||||
Differs from the primitive comparators in that it first checks to
|
Differs from the primitive comparators in that it first checks to
|
||||||
see whether either x or y implement a 'compare' method which can
|
see whether either x or y implement a `compare` method which can
|
||||||
compare x and y. If so it uses that compare method. If not, it
|
compare x and y. If so, it uses that compare method. If not, it
|
||||||
delegates to the primitive comparators.`
|
delegates to the primitive comparators.``
|
||||||
[x y]
|
[x y]
|
||||||
(or
|
(or
|
||||||
(when-let [f (get x :compare)] (f x y))
|
(when-let [f (get x :compare)] (f x y))
|
||||||
@ -753,27 +753,27 @@
|
|||||||
r)
|
r)
|
||||||
|
|
||||||
(defn compare=
|
(defn compare=
|
||||||
"Equivalent of '=' but using compare function instead of primitive comparator"
|
``Equivalent of `=` but using compare function instead of primitive comparator.``
|
||||||
[& xs]
|
[& xs]
|
||||||
(compare-reduce = xs))
|
(compare-reduce = xs))
|
||||||
|
|
||||||
(defn compare<
|
(defn compare<
|
||||||
"Equivalent of '<' but using compare function instead of primitive comparator"
|
``Equivalent of `<` but using compare function instead of primitive comparator.``
|
||||||
[& xs]
|
[& xs]
|
||||||
(compare-reduce < xs))
|
(compare-reduce < xs))
|
||||||
|
|
||||||
(defn compare<=
|
(defn compare<=
|
||||||
"Equivalent of '<=' but using compare function instead of primitive comparator"
|
``Equivalent of `<=` but using compare function instead of primitive comparator.``
|
||||||
[& xs]
|
[& xs]
|
||||||
(compare-reduce <= xs))
|
(compare-reduce <= xs))
|
||||||
|
|
||||||
(defn compare>
|
(defn compare>
|
||||||
"Equivalent of '>' but using compare function instead of primitive comparator"
|
``Equivalent of `>` but using compare function instead of primitive comparator.``
|
||||||
[& xs]
|
[& xs]
|
||||||
(compare-reduce > xs))
|
(compare-reduce > xs))
|
||||||
|
|
||||||
(defn compare>=
|
(defn compare>=
|
||||||
"Equivalent of '>=' but using compare function instead of primitive comparator"
|
``Equivalent of `>=` but using compare function instead of primitive comparator.``
|
||||||
[& xs]
|
[& xs]
|
||||||
(compare-reduce >= xs))
|
(compare-reduce >= xs))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user