spoiling quiz with answer already, neat short fork. zoom =: [ # #"1
----- Original Message ----- From: 'Pascal Jasmin' via Programming <[email protected]> To: Programming forum <[email protected]> Cc: Sent: Wednesday, July 16, 2014 6:08:28 PM Subject: [Jprogramming] a zoom function (doubling points accross rows and columns) there are too many ways to write this function, and there is probably a way that is better than what I could think of. #. inv dfh &> ' 'cut 'FF 81 BD A5 A5 BD 81 FF' 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 zoom =: ([ * ({.,{:)@:$@:]) $ [:, ([, [ * {:@:$@:]) $"1 #"1 2 zoom #. inv dfh &> ' 'cut 'FF 81 BD A5 A5 BD 81 FF' 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 for every cell in original, a 2x2 copy of that cell is made. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
