[:y has the important function of signaling domain error.
Henry Rich
On 7/19/2022 2:35 PM, 'Pascal Jasmin' via Programming wrote:
I'll add that the fairly recent change of u@n being a constant verb for n is
very positive.
Of the approaches I suggested for defining the adverb, the first I prefer.
expecting an adverb to always return a verb is more user friendly than deciding
for them.
(>:@1) 3
2
is good behaviour if the user passes 1 as adverb parameter to (>:@)
1 (>:@)
:@1
Returning a constant verb when provided with a constant or "dynamic" ambivalent
(monad+dyad flexibility) execution when provided with a verb is design that will result
in fewer edge cases (bugs) when combined with other adverbs that expect, or more
importantly, return verbs that tend to be expected by other modifiers.
So. polymorphic return word types from a modifier are design deficient compared
to single word types return. Especially considering that a constant verb
provides a user intuitive way of obtaining the constant result with the
flexibility of using any verb to create a word phrase that can be further
processed by modifiers with fewer assumptions about word types.
On a side note, if [:y returned y, there would be additional flexibility in
constructing the polymorphic modifier in the form (where ti is ` but turns nouns
into gerunds) of {{([: ti >: ti u)(`:6)}}
On Tuesday, July 19, 2022 at 12:26:47 p.m. EDT, 'Pascal Jasmin' via Programming
<programm...@jsoftware.com> wrote:
some options,
if you want your adverb to always produce a verb:
1 (>:@)
:@1
1 (>:@) 4
2 NB. increment on constant of 1 (u/m parameter)
+: (>:@) 4
9 NB. increment after applying u (double) to y
if you want "polymorphism" in your adverb to return noun result or verb
depending on u or m,
isNoun =: (0 = 4!:0 ::0:)@:<
1 {{if. isNoun 'u' do. >: m else. >:@u end.}}
2
+ {{if. isNoun 'u' do. >: m else. >:@u end.}}
:@+
2 + {{if. isNoun 'u' do. >: m else. >:@u end.}}3
6
On Monday, July 18, 2022 at 04:03:40 a.m. EDT, Jacques Bailhache
<jacques.bailha...@gmail.com> wrote:
I define an adverb which gives the successor of its argument :
advsuc =: 1 : '>: u'
1 advsuc
2
Then I define an adverb which applies its argument to 1 :
applyto1 =: 1 : '1 u'
Then I apply it to the adverbial successor :
advsuc applyto1
advsuc applyto1
Why isn't it evaluated to 2 ?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
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