NB. Let u be the function, n the grouping size of y,
   BoxScanConjunction =: 2 : 0
:
>u~&.>/(|.n<\y),<x
)

   1 +/@:+ BoxScanConjunction _4 i.4
10

   1 +/@:+ BoxScanConjunction _4 i.16
1198


   NB. show beheading integers x and groups of 4 characters y
   (i.14) ([ }.@:[ smoutput@:;) BoxScanConjunction _4 Alpha_j_
+-------------------------------+----+
|0 1 2 3 4 5 6 7 8 9 10 11 12 13|ABCD|
+-------------------------------+----+
+-----------------------------+----+
|1 2 3 4 5 6 7 8 9 10 11 12 13|EFGH|
+-----------------------------+----+
...
+--------+----+
|11 12 13|stuv|
+--------+----+
+-----+----+
|12 13|wxyz|
+-----+----+
13


Pascal reminded me to rotate the boxes of y.

*'Pascal Jasmin' via Programming*programming at jsoftware.com<mailto:programming%40forums.jsoftware.com?Subject=Re%3A%20%5BJprogramming%5D%20Modifying%20x%20inside%20Infix&In-Reply-To=%3C1755917659.2548844.1417573502691.JavaMail.yahoo%40jws10069.mail.ne1.yahoo.com%3E>
/Wed Dec 3 02:25:02 UTC 2014/

 * Previous message:[Jprogramming] Modifying x inside Infix
   <http://jsoftware.com/pipermail/programming/2014-December/040436.html>
 * Next message:[Jprogramming] Modifying x inside Infix
   <http://jsoftware.com/pipermail/programming/2014-December/040438.html>
 * *Messages sorted by:*[ date ]
   <http://jsoftware.com/pipermail/programming/2014-December/date.html#40437>[
   thread ]
   <http://jsoftware.com/pipermail/programming/2014-December/thread.html#40437>[
   subject ]
   
<http://jsoftware.com/pipermail/programming/2014-December/subject.html#40437>[
   author ]
   <http://jsoftware.com/pipermail/programming/2014-December/author.html#40437>

------------------------------------------------------------------------

If you use your x as y, and y as x, then one argument has length 4 while the 
other length 1, and producing a length 1 result, then it fits the requirement 
for boxscan.

boxscan =: ((&.>)/)(>@:)

1 (, <)~  |. <"1 i.4 4
┌───────────┬─────────┬───────┬───────┬─┐
│12 13 14 15│8 9 10 11│4 5 6 7│0 1 2 3│1│
└───────────┴─────────┴───────┴───────┴─┘

+/@:+ boxscan 1 (, <)~ {: |. <"1 i.4 4
10


+/@:+ boxscan 1 (, <)~  |. <"1 i.4 4
1198

----- Original Message -----
From: Jon Hough <jghough at outlook.com  
<http://jsoftware.com/mailman/listinfo/programming>>
To: "programming at jsoftware.com  <http://jsoftware.com/mailman/listinfo/programming>" 
<programming at jsoftware.com  <http://jsoftware.com/mailman/listinfo/programming>>
Cc:
Sent: Tuesday, December 2, 2014 9:09 PM

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to