Skip to content

Commit

Permalink
add an additional example
Browse files Browse the repository at this point in the history
  • Loading branch information
yihozhang committed Aug 18, 2023
1 parent 9317372 commit 8cd4717
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/container-rebuild.egg
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,26 @@
;; rebuilding creates (MyVec v2)
(check (= (MyVec v1) (MyVec v2)))
(pop)

(push)
(datatype Math
(Add i64 i64)
(Expensive :cost 100))

(sort MathVec (Vec Math))

(let myvec (vec-of (Expensive)))
(let cheapvec (vec-of (Add 1 2)))

(function VecContainer (MathVec) Math)

(let myvecontainer (VecContainer cheapvec))


(union myvecontainer (Expensive))

;; (vec-push (vec-empty) (VecContainer (vec-push (vec-empty) (Add 1 2))))
;; should have cost 4
(extract myvec 0)

(pop)

0 comments on commit 8cd4717

Please sign in to comment.