Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将a/b块内部更改为a/c(甚至可能a)
a/b
a/c
a
我这样做的正常方法是change:
change
test: [a/b] change test/1 'c
但它只改变了第一部分,a即c:
c
>> test == [c/b]
无法访问路径test/2:
test/2
>> reduce [test/1 test/2] == [a/b none]
这里有两点需要注意:
首先,path!是一个系列,所以在这种情况下,是一个嵌套系列。必须实际访问第一个元素内的第二个元素:
path!
>> test: [a/b] test/1/2 == b
其次,使用系列的属性,使它们表现得像指针并访问next元素,而不是直接访问它:
next
>> next test/1 == b
于是代码变成了:
>> change next test/1 'c test == [a/c]