[Jprogramming] Pad Arrays for XORing
Jon Hough
jghough at outlook.com
Thu Dec 4 00:56:53 UTC 2014
If I want to XOR two arrays (~:), I run into a problem if the two arrays are of different length.
So before XORing I use my "pad" dyadic verb which pads zeros onto the front of the right argument (which is assumed to be the shorter array).
pad =: ((#&0)@:(([: # [) - ([: # ]))) , ]
I imagine this problem is common, so is there a standard verb to do this? I think my verb is not the most elegant, and it has the deficiency of assuming the right argument is the shorter.
More information about the Programming
mailing list