我怎样才能构建一个块!包含parens?
How can I construct a block! containing parens?
我有一个像[x y]
这样的词块,我想制作一个[x: (x) y: (y)]
的词块
这不太行得通:
>> b: [x y]
== [x y]
>> collect [foreach w b [keep to-set-word w keep to-paren w]]
== [x: x y: y]
keep
在收集参数值时依赖于 append
操作,因此 paren!
参数将看到附加的每个包含值,而不是整个 paren 系列(与任何其他 any-block!
类型)。为了将 paren 系列附加为单个值,请使用 keep/only
(然后将在内部使用 append/only
)。
>> b: [x y]
== [x y]
>> collect [foreach w b [keep to-set-word w keep/only to-paren w]]
== [x: (x) y: (y)]
我有一个像[x y]
这样的词块,我想制作一个[x: (x) y: (y)]
这不太行得通:
>> b: [x y]
== [x y]
>> collect [foreach w b [keep to-set-word w keep to-paren w]]
== [x: x y: y]
keep
在收集参数值时依赖于 append
操作,因此 paren!
参数将看到附加的每个包含值,而不是整个 paren 系列(与任何其他 any-block!
类型)。为了将 paren 系列附加为单个值,请使用 keep/only
(然后将在内部使用 append/only
)。
>> b: [x y]
== [x y]
>> collect [foreach w b [keep to-set-word w keep/only to-paren w]]
== [x: (x) y: (y)]