the case for CC -> (u C0 v) C1 : adverb result which will end with u C0 v C1 u2
after u2 gets passed is:
as a starting point, we have to look at how bad your proposal is.
The only reasonable application is creating the hook ([. ].) due to the
duplicate binding. Theoretically, there could be separate conjunctions that
have switch/case tables that use u v as codes for what to emit, or conjunctions
that read some global state to produce emissions, but such sillyness should be
the domain of verbs, or at least a single conjunction that does something so
sophisticated.
H =: 2 : 'u v'
provides an easier to type shortcut for the only application compared to ([.
].) or {{u v }}. The latter is faster to type out of the 2. A great power of
J is the power to create anonymous functions simply that provide direct context
instead of a name. So {{u v}} might be preferred to H_z_ if you don't use H
enough to know what it is.
To address Raul's good post about how easy hooks and trains are to produce with
modifiers
My core problem with the old trains is that they are focused on making easy
train formation a tiny bit easier at the expense of confusion, while ignoring
the relatively tedious aspect of processing modifiers (need to be quoted) and
enhancing adverb/modifier trains
I'll repost a link to my templating system
http://www.jsoftware.com/pipermail/programming/2020-September/056558.html
and add an extra definition that leverages the templating system (missing
aatrain definition provided if any interest) for a fork
F =: ((jt '4: 3: 2:') Jxp aatrain.
which returns adverbs until the template is full (3 terms provided)
+ - * F NB. returns fork of items in order.
+ - *
* + - 9: F NB. 9: replaces low number template item with high template item...
defers first binding to last
+ - *
- + 'u' * F NB. same but will generate a final adverb
+ - *
'v `u ` *' bb F NB. bb cuts on ` can be used to return conjunction that will
fill train.
2 : 'v u *'
- '+ ` ` *' bb F NB. empty box alternative to deferring binding
+ - *
'+ ` @ ` *' bb F NB. useable to build bound conjunctions as well.
+@*
1 = 2 | ] F F (#~ H) i.5 NB. F F will make 5 length train. All of the
parameters could be deferred. (#~ H) adds select hook
1 3
The point being that building trains from modifiers where parameters can be
provided in any order, and any "prebound state" is a solved problem. Hooks are
especially easy with a conjunction, and wasting CC on having a single
application of making a hook conjunction is wasting the most powerful modifier
train component.
The other point is that if you want to create trains with modifiers (what old
stuff does), you want to create modifiers, and the more you have, the more you
will want to combine them. Being able to combine them elegantly with a minimum
of parentheses is a benefit to having a large arsenal of modifiers.
I started my original rant, before I knew there were [. ]. ]:, and I have since
found workarounds for my gripes.
modifier trains are awesome, but were limited to one floating parameter.
CA train is perfect. Now opens up having 2 parameters in modifier train, as
long as C heads it.
the ACA train allows for a sane AC (C ending modifier train) interpretation
with a ]: as A2. It also allows the C to be in the middle, and if you prefer
uA(Cv)A to uA(C(vA)) then its just ]: tricks
+ ((/\) (@ /) (@])) =
+/\@(=@])/
+ (]: (@ ]:) /\) =
+@(=/)\
+ (]: (@ ]:) (/\)) =
+@(=/\)
extra parentheses burden over single modifiers, but its possible to write any
modifier train with 2 floating bindings (ie conj)! Hooray, Ken's brilliance is
restored :)
You know what's better than modifier trains with a limit of 2 floating
parameters? 3 or more.
The recommended C C train would allow that 3rd parameter, but it can get messy
with (C C) C.
On Tuesday, September 28, 2021, 02:33:17 p.m. EDT, Henry Rich
<[email protected]> wrote:
The argument for (C0 C1) -> conj (u C0 v) (u C1 v) looks pretty strong
to me, especially as it allows modifier trains to use special code in
hooks. And, it's backward compatible. I will implement that unless
someone can see a reason not to.
I see no equally-good way to create a verb fork with 3 input verbs. It
is possible to create conjunctions that consume operands and return a
modifier, thus allowing more than 2 operands in the final result; but
the resulting code doesn't look like J at all. We will need a lot more
thought and consensus before we go down that path.
Henry Rich
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm