New Feature: Literal Picking With TUPLE!

The ability to embed quotes in TUPLE!s/PATH!s/CHAIN!s affords some interesting abilities.

It's not always clear what those abilities should actually be. However, one case seemed pretty clear, so I went ahead with it...

>> a: <something>

>> m: to map! []
== &[map! []]

>> m.(a): 304
== 304

>> m.'(a): 1020
== 1020

>> m
== &[map! [
    <something> 304
    (a) 1020
]]

>> m.'(a)
== 1020

Pretty cool. Note that you can't do this with "literal SET-XXX" because the CHAIN! scans "above" the TUPLE!. So m.(a): is a CHAIN! of [m.(a) _].

If you wanted to actually put (a): in the map, you can't use this trick. You have to do it the "hard way":

 m.('(a):): <whatever>
2 Likes

Note that in Red, you would have to do m/(quote (a)) (their QUOTE is Ren-C's THE, since they don't bother to "waste" the word QUOTE on an operator for transforming a to 'a since only WORD! and PATH! can be quoted)...

But...

red>> m/(quote (a)): 1020
*** Script Error: cannot access paren! in path m/(quote (a)):

Which is their way of telling you that you can't use lists as map keys (because they don't have immutability to apply to make sure that the key hashes consistently, they'd have to make a copy, and that "costs too much"...) :roll_eyes: