it's not a big deal.
a generic polymorphic replacement to @ is:
>: {{if. isNoun 'v' do. u n else. u@v end.}}3
4
1 >: 2 : 'if. isNoun ''v'' do. u n else. u@v end.' + 3
5
but I think forming trains in form of ([: u n) as an escape when using (`:6)
formation (more flexible than "real forks")
[: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
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
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
An adverb only evaluates once it is given a noun/verb left argument.
(adverb adverb) is a form of speech that doesn’t get evaluated,
just like verbal trains (verb verb verb)
Put another way: what shall 'u' be in advsuc when you say
'advsuc applyto1'? 'u' always comes in from the left
but there
In an adverb definition, u refers to a verb (or noun).
I hope this helps,
--
Raul
On Mon, Jul 18, 2022 at 4:03 AM Jacques Bailhache
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
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