Skip to content

Commit

Permalink
improve match code generation
Browse files Browse the repository at this point in the history
no need for the ## predicates, plus the compiler understands the
regular ones.
  • Loading branch information
vyzo committed Apr 14, 2024
1 parent 5393028 commit f3c613d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/gerbil/core/match.ss
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ package: gerbil/core
((cons: hd tl)
(with-syntax (($hd (genident 'hd))
($tl (genident 'tl)))
['if #'(##pair? target)
['if #'(pair? target)
(let ((hd-pat (stx-e #'hd))
(tl-pat (stx-e #'tl)))
(cond
Expand All @@ -315,12 +315,12 @@ package: gerbil/core
E)])))
E]))
((null:)
['if #'(##null? target) K E])
['if #'(null? target) K E])
((splice: hd rest)
(generate-splice tgt #'hd #'rest K E))
((box: pat)
(with-syntax (($tgt (genident 'e)))
['if #'(##box? target)
['if #'(box? target)
['let #'(($tgt (##unbox target)))
(generate1 #'$tgt #'pat K E)]
E]))
Expand All @@ -337,13 +337,13 @@ package: gerbil/core
(syntax-case #'body ()
((simple: body)
(with-syntax ((len (stx-length #'body)))
['if #'(##vector? target)
['if #'(vector? target)
['if #'(##fx= (##vector-length target) len)
(generate-simple-vector tgt #'body 0 K E)
E]
E]))
((list: body)
['if #'(##vector? target)
['if #'(vector? target)
(generate-list-vector tgt #'body 'vector->list K E)
E])))
((struct: info body)
Expand Down

0 comments on commit f3c613d

Please sign in to comment.