NB. generate a bingo card, I've omitted field width 3 formatting. (;/'BINGO'),<"0 CARD=:(1 15 p. i.5) + }. (3 :'5?15')^:(<6)'' +--+--+--+--+--+ |B |I |N |G |O | +--+--+--+--+--+ |6 |8 |1 |14|3 | +--+--+--+--+--+ |27|19|18|23|20| +--+--+--+--+--+ |36|43|41|33|38| +--+--+--+--+--+ |56|47|49|53|60| +--+--+--+--+--+ |61|71|75|62|66| +--+--+--+--+--+
NB. study the pieces (;/'BINGO') +-+-+-+-+-+ |B|I|N|G|O| +-+-+-+-+-+ (1 15 p. i.5) NB. evaluate polynomial 1 + 15*y 1 16 31 46 61 NB. deal, 6 times. NB. 1st row is fill because the verb executed 0 times. (3 :'5?15')^:(<6)'' 0 0 0 0 0 14 9 7 4 6 3 4 13 7 11 3 6 8 7 13 2 11 10 5 9 8 7 2 14 11 NB. beheading the matrix removes the fill. }. (3 :'5?15')^:(<6)'' 14 13 10 3 12 13 7 2 5 4 13 4 2 6 8 12 6 14 11 3 11 5 14 7 1 NB. alternatively, (3 :'5?15')^:(>:i.5)'' 5 8 2 13 7 0 8 11 10 1 7 14 11 12 13 9 8 10 14 1 6 5 3 1 10 NB. the sum (1 15 p. i.5) + the matrix NB. maps items to items, which are NB. scalars + rows NB. which is again mapped item to item NB. because + has rank 0 NB. see http://code.jsoftware.com/wiki/Vocabulary/Agreement NB. deal is within an explicit verb to ensure it is re-evaluated
Date: Thu, 22 Feb 2018 06:24:01 -0500 From: Nick S<[email protected]> To: Jsoftware Programming forum<[email protected]> Subject: [Jprogramming] deal duplicates? Message-ID: <CA+2d-ZyMEFBc1JO6vPkqDoHRZsaXFvgue+qztCFL_JEA0_tq=g...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" I am trying to print a bingo card. The expression I am using is simple. My result is unexpected: |:((<' B '),(<' I '),(< ' N '),(<' G '),(<' O ')),. 3&": L:0 <"0(1 16 31 46 61)+(5?15),.(5?15),.(5?15),.(5?15),.(5?15)
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
