Skip to content

Commit 2294b7b

Browse files
committed
Add operator form of MapAt
1 parent 067ffda commit 2294b7b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mathics/builtin/structure.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,16 @@ class MapAt(Builtin):
547547
Use negative position in an association:
548548
>> MapAt[f, <|"a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4|>, -3]
549549
= {a -> 1, b -> f[2], c -> 3, d -> 4}
550+
551+
Use the operator form of MapAt:
552+
>> MapAt[f, 1][{a, b, c, d}]
553+
= {f[a], b, c, d}
550554
"""
551555

556+
rules = {
557+
"MapAt[f_, pos_][expr_]": "MapAt[f, expr, pos]",
558+
}
559+
552560
def apply(self, f, expr, n, evaluation, options={}):
553561
"MapAt[f_, expr_, n_Integer]"
554562
i = n.get_int_value()

0 commit comments

Comments
 (0)