Skip to content

Commit

Permalink
Added Ord Cell instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Izaakwltn authored and eliaslfox committed Sep 25, 2023
1 parent c45f3fe commit 95a7b92
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/cell.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
(define (== c1 c2)
(== (read c1) (read c2))))

(define-instance (Ord :a => Ord (Cell :a))
(define (<=> c1 c2)
(match (<=> (read c1) (read c2))
((LT) LT)
((GT) GT)
((EQ) EQ))))

(define-instance (Num :a => Num (Cell :a))
(define (+ c1 c2)
(new (+ (read c1) (read c2))))
Expand Down

0 comments on commit 95a7b92

Please sign in to comment.