Instantly share code, notes, and snippets.

# yurivish/Mandelbrot Last active Aug 29, 2015

 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
Owner Author

### yurivish commented Apr 3, 2014

 Grid: r =: i. % <: NB. Constructs a range of n elements from 0 to 1 g =: [: |: j./ NB. A dyadic function that takes (r x) g (r y) and constructs a 2d grid on [0, 1] * [0, 1]
Owner Author

### yurivish commented Apr 3, 2014

 len =: -/ |. NB. Subtract the right index from the left index by reversing the list and inserting a minus. Better: len =: }. - {. NB. Subtract the second from the first
Owner Author

### yurivish commented Apr 3, 2014

 r =: {. + ([: i. len) NB. For (x y) passed in, return the range x + i. len x (this leaves out the endpoint)
Owner 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)