Post Reply 
RPL mini-challenge: Create an anti-Identity Matrix
05-13-2018, 08:58 PM
Post: #29
RE: RPL mini-challenge: Create an anti-Identity Matrix
(05-13-2018 10:27 AM)pier4r Wrote:  
Code:

@ Idea: create N-1 rows of the form 0 1 1 .. 1 with as many 1 as N
@ add an ending 0
@ compact it in a matrix
@0.18 seconds
\<< 1. 29.
  START 
    0. 1. 30. NDUPN DROP
  NEXT 
  0. 
  30. DUP 2. \->LIST \->ARRY
\>>

Nice one! No need to ROLLD anything, 0 followed by 30 ones will shift the position of the 0 on every row. Brilliant! (and faster!)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL mini-challenge: Create an anti-Identity Matrix - Claudio L. - 05-13-2018 08:58 PM



User(s) browsing this thread: 13 Guest(s)