[e-lang] Guard-based pattern expansions

Mark S. Miller markm at cs.jhu.edu
Fri Apr 28 03:36:15 EDT 2006


Here are the guard-based pattern expansions in 0.8.36h. The first group are 
the problematic ones, since their guards contain non-DeepFrozen values. If we 
require guards to be DeepFrozen, then we must find some other expansion for 
the patterns on the right hand side. The second group is fine as is, and is 
provided just as a reminder.


__Bind is used to expand
    'bind foo'  to  '_ :__Bind[foo__Resolver]'

__Extract is used to expand
    '["k" => p            ] | r'  to  '[p, r] :__Extract["k"]'
    '["k" => p default {e}] | r'  to  '[p, r] :__Extract["k", fn {e}]'
    '["k" => p       := e ] | r'  to  '[p, r] :__Extract.depr("k", e)'
The ":=" syntax in a map-pattern is deprecated, and therefore so is the last
expansion above.

__MatchBind is used to expand
    'foo`$x at y`'  to  '[y] :__MatchBind[foo__quasiParser.matchMaker("${0}@{0}"),
                                       [x]]'
__SuchThat is used to expand
    'p ? e'  to  '[p, :__SuchThat[e]] :__SuchThat'
Assuming we get rid of the such-that pattern for E as well as Kernel-E, this
expansion is deprecated.





__VarSlot is used to expand
    'var x'     to  '&x :__VarSlot'
    'var x :G'  to  '&x :__VarSlot[G]'

__SplitList is used to expand
    '[p0, ..., pn_1] + r'  to  '[p0, ..., pn_1, r] :__SplitList[n]'

__Empty is used with __Extract to expand
    '["k" => p]'  to  '[p, :__Empty] :__Extract["k"]'

-- 
Text by me above is hereby placed in the public domain

     Cheers,
     --MarkM



More information about the e-lang mailing list