gerund and non-gerund solution,

Y =: 1 : '(m&{::@:])'

  (( 0 Y 0 Y) apply 1 Y )  (+:`*:;i.5) 
0 2 4 6 8 
  (( 0 Y 0 Y) apply 1 Y )  ((;: '+: *:');i.5) 
0 2 4 6 8 


trickier for dyadic

'2&' (1 Y apply~ [ , ] 0 Y 0 Y)  ((;: '+ *:');i.5) 
2 3 4 5 6

 

________________________________
From: Joe Bogner <[email protected]>
To: [email protected] 
Sent: Thursday, January 29, 2015 1:20 PM
Subject: [Jprogramming] conjunction in tacit verb


Is it possible to define f tacitly?

f=: 3 : '({.@:>@:{.y)`:0 (>@:}.y)'
f (+:`*:;i.5)

0 2 4 6 8

It's meant to take the first gerund from a box that contains a list of
gerunds and data to operate on

It's an odd circumstance that needed it. I could probably rework the
logic but now I'm curious if it can be done

Some things I tried:

a=:(+:`*:;i.5)

f1=:{.@:>@:{.
   f1 a
┌──┐
│+:│
└──┘

f2=:>@:}.
  f2 a
0 1 2 3 4


Tried various version of combining f1 and f2 to no avail

This works:

   g`:0 f2 a [ g=. f1 a
0 2 4 6 8

I'm thinking there might be a way to do it without the assignment?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to