File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
mathics/builtin/functional Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -179,9 +179,22 @@ def callback(level):
179179 Map $f$ onto each element (denoted by 'level' here) at this level.
180180 With exception for expr as Association, which is mapped on values only.
181181 """
182- if is_association and level .has_form ("Rule" , 2 ):
182+ # TODO: This special behavior applies when the whole expression
183+ # is of the form Association[__(Rule|RuleDelayed)], i.e., when
184+ # the expression is a well-formatted Association expression.
185+ # For example,
186+ # `Map[F, Association[a->1,b->2, NotARule]`
187+ # produces in WMA
188+ # `Association[F[a->1], F[b->2], F[NotARule]`
189+ # instead of
190+ # `Association[a->F[1], b->F[2], F[NotARule]`]
191+ #
192+ # Fixing this would require a different implementation of this eval_ method.
193+ #
194+
195+ if is_association and level .has_form (("Rule" , "RuleDeyaled" ), 2 ):
183196 return Expression (
184- SymbolRule ,
197+ level . get_head () ,
185198 level .elements [0 ],
186199 Expression (f , level .elements [1 ]),
187200 )
You can’t perform that action at this time.
0 commit comments