Post Reply 
RPL mini-challenge: Create an anti-Identity Matrix
05-13-2018, 10:27 AM (This post was last modified: 05-13-2018 10:32 AM by pier4r.)
Post: #20
RE: RPL mini-challenge: Create an anti-Identity Matrix
OK thanks to Claudio I discovered that \->ARRY is pretty flexible (I did not know, therefore I was in love with AXL) and thanks to 3298 with his idea (see, comments! I likely had ignored his code without comments) it gets even faster.

I'd say that the merit is 60% the observation of 3298, 25% the properly picked commands by Claudio, 15% my luck combining and testing things while ranting about comments.

Fixed values, but not difficult to modify with variables.
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
\>>

For example with absence of comments or discussions I - I speak only for myself - will never bother to use code that is difficult to decode without copying it and debugging it. Unless getting a similar solution by myself (or via google) is harder.

I picked the code of Claudio only because I got a similar solution by myself, and therefore I could "decode" it, plus David commented on it that was 0.3 seconds and added interest on it. Otherwise I wouldn't have checked it.


edit: next step. using additional list processing commands, like listExt.

Wikis are great, Contribute :)
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 - pier4r - 05-13-2018 10:27 AM



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