def matches
import bend-kit-router@0.2.0.0/router.bend as Routerimport Base
138def matches(pat: List<&2, Segment>, got: List<&2, String>) -> Bool:
139 match pat got:
140 case Nil{} Nil{}:
141 True{}
142 case Literal{p} <> pt g <> gt:
143 continue(String.eq(p, g), u => matches(pt, gt))
144 case Parameter{name} <> pt +g <> gt:
145 continue(Bool.not(String.is_empty(g)), u => matches(pt, gt))
146 case _ _:
147 False{}