Skip to content

Instantly share code, notes, and snippets.

@yurivish
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurivish/9947301 to your computer and use it in GitHub Desktop.
Save yurivish/9947301 to your computer and use it in GitHub Desktop.
xs =: (i: 10) % 10
ys =: (i: 20) % 10
grid =: ys j./ xs
in =: 4 > |
out =: 1 - in
trim =: (* in) + (_ * out)
iter =: trim @ (+ *:)
require 'viewmat'
viewmat grid iter^:1000 grid
@yurivish
Copy link
Author

yurivish commented Apr 3, 2014

len =: -@- NB. Monadic minus composed with dyadic minus. Usage: x len y

Alternate formulation: [: - - or [: | -

And now you can define

r =: [ + ([: i. len)

which is equal x + the range from 0 to (x len y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment