@@ -125,13 +125,13 @@ end
125125# 3. Callback: takes arguments Dictionary × Number of elements matched
126126#
127127function matcher (val:: Any )
128- function literal_matcher (data, bindings, ctx, next )
128+ function literal_matcher (next, data, bindings, ctx)
129129 ! isempty (data) && isequal (car (data), val) ? next (bindings, 1 ) : nothing
130130 end
131131end
132132
133133function matcher (slot:: Slot )
134- function slot_matcher (data, bindings, ctx, next )
134+ function slot_matcher (next, data, bindings, ctx)
135135 isempty (data) && return
136136 val = get (bindings, slot. name, nothing )
137137 if val != = nothing
@@ -175,7 +175,7 @@ function trymatchexpr(data, value, n)
175175end
176176
177177function matcher (segment:: Segment )
178- function segment_matcher (data, bindings, ctx, success )
178+ function segment_matcher (success, data, bindings, ctx)
179179 val = get (bindings, segment. name, nothing )
180180
181181 if val != = nothing
204204
205205function matcher (term:: Term )
206206 matchers = (matcher (operation (term)), map (matcher, arguments (term))... ,)
207- function term_matcher (data, bindings, ctx, success )
207+ function term_matcher (success, data, bindings, ctx)
208208
209209 isempty (data) && return nothing
210210 ! (car (data) isa Term) && return nothing
@@ -216,8 +216,9 @@ function matcher(term::Term)
216216 end
217217 return nothing
218218 end
219- res = car (matchers′)(term, bindings′, ctx,
220- (b, n) -> loop (drop_n (term, n), b, cdr (matchers′)))
219+ car (matchers′)(term, bindings′, ctx) do b, n
220+ loop (drop_n (term, n), b, cdr (matchers′))
221+ end
221222 end
222223
223224 loop (car (data), bindings, matchers) # Try to eat exactly one term
0 commit comments