Another question: is where a way to have a subseries of a bigger one in a static way ?
Example:
a: [a b c d e f g h]
The subseries should be:
b: [d e]
But [d e] are just part of "A"
So if you change the B: to "[z e]"
>>> a
= [a b c z e f g h]
>> a: [a b c d e f g h]
== [a b c d e f g h]
>> b: reduce [at a 4 2]
== [[d e f g h] 2]
>> head change/part b/1 [z e] b/2
== [a b c z e f g h]
>> a: [a b c d e f g h]
== [a b c d e f g h]
>> subseries: 4x2
== 4x2
>> head change/part at a subseries/x [z e] subseries/y
== [a b c z e f g h]
@nedzadarek If you consider pnly figures, then almost. In addition, optional set-word may also precede the block
view [box draw [b: box 10x10 50x50 c: circle 30x30 30]]
view [box draw [[b: box 10x10 50x50][c: circle 30x30 30]]]
view [box draw [[[[[[[b: box 10x10 50x50]]] circle 30x30 30]]]]]
view [box draw [b: [box 10x10 50x50]]]
view [box draw [b: [b2: box 10x10 50x50]]]
view [box draw [b: b2: b3: box 10x10 50x50]]
view [box draw [b:]]
So, it is more like
<draw-command>: (<command> <arguments> | '['<command> <arguments>']')
<draw-expression>: <set-word>* <draw-command>
<draw>: <draw-expression>*
apply
, but you can use tricks similar to the above one.
Well, thanks, I was just imaging if there where a simple way to load code words/values at the current program execution position. So, it FOO expected X and Y then something like
(I assume "<" mean: "insert the result of the code between parens at this point")
FOO <(BAR)
Print "A"
Would be interpreted like
FOO 1 2
Print "A"
>> foo: func [x y][x + y]
== func [x y][x + y]
>> bar: does [[1 2]]
== func [][[1 2]]
>> compose [foo (bar)]
== [foo 1 2]
>> do compose [foo (bar)]
== 3
Macros is not what you want, I guess. They can't operate on values that are presented at run-time (i.e. you can't evaluate function bar
, because it doesn't exist yet).#do [bar: [1 2]]
#macro ['< paren!] func [start end][
get in preprocessor/exec start/2/1
]
probe expand [
foo <(bar)
foo #do keep [[1 2]]
]
>> apply: func [function data][do compose reduce [function quote (data)]]
== func [function data][do compose reduce [function quote (data)]]
>> apply 'reverse/part [[a b c d] 2]
== [b a c d]