Ah, so like what I was saying about get $not/even? being such that you can't tell if NOT is an object.
But it's ambiguous to the reader, not to the system, right?
My policy of requiring the leading slash when the first element is a function helps a little bit.
In fact, if you use leading slash you don't need to use slashes to mention functions you want to run (I imagine you couldn't use them at all!)
/lib.append ; clearly lib.append has to be FRAME! (or antiform FRAME!)
vs
/lib/append ; makes it look like two function applications, illegal
So that would fix it up, I think... once you are into function composition mode, your picks from objects would be done with tuples, because the previous slash internal to the path would imply the execution.
Ren-C already has it, just not in this brief a notation. Called CHAIN (to be renamed, likely to CASCADE). From the tests to make sure function derivations combine correctly:
add-one: func [x] [return x + 1]
mp-ad-ad: chain [:multiply, :add-one, :add-one]
assert [202 = (mp-ad-ad 10 20)]
sub-one: specialize :subtract [value2: 1]
mp-normal: chain [:mp-ad-ad, :sub-one, :sub-one]
assert [200 = (mp-normal 10 20)]
So it will be nifty to have the shorter way to write it. But you'll still want the longer version if you're defining your functions inline (using the new slash rules and string delimiter here, just to start trying it out...)
/collect-text: redescribe [
-{Evaluate body, and return block of values collected via KEEP function.
Returns all values as a single spaced TEXT!
Individual KEEPed blocks get UNSPACED.}-
] cascade [
adapt get $collect [
body: compose [
/keep: adapt specialize get $keep [
line: null
part: null
][
value: maybe unspaced value
]
(as group! body)
]
]
get $spaced
specialize get $else [branch: [copy ""]]
]
CHAIN has had the first function run as the first argument, and people have asked for it to be in the other order...where the pipeline has the last function first in the list. Maybe this new short notation will make them happy enough. I like the "first called function first" in the longer form.
While I expect foo.
to act like get $foo
I am finding myself liking writing the GET out long form better most of the time.
We could make the function generators allow taking @foo
and doing the lookup themselves:
specialize @else [branch: [copy ""]]
I don't hate that, though it makes their interface less orthogonal just to avoid writing:
specialize else. [branch: [copy ""]]
Though we could have different meanings. else.
gives you a FRAME! antiform and could mean "treat function anonymously, don't put a symbol in it" and @else
could mean "I'm passing in a symbol for you to look up yourself, so the symbol is meaningful, embed it in the result".
Ah, so many degrees of freedom.