Skip to content

Instantly share code, notes, and snippets.

Yuri yurivish

Block or report user

Report or block yurivish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Treap.getindex.llvm
code:
function Base.getindex{K}(t::TreapNode{K}, index::Int)
1 <= index <= t.size || throw(KeyError(key))
while t.left.size != index - 1
if index <= t.left.size
t = t.left
else
index = index - t.left.size - 1
t = t.right
@yurivish
yurivish / Treap.jl
Last active Aug 29, 2015
A Julia implementation of a treap (v6; in progress)
View Treap.jl
import Base: isempty, start, next, done, length, getindex, minimum, maximum, search, show
export Treap, TreapNode
type TreapNode{K}
priority::Float64
size::Int
key::K
left::TreapNode{K}
right::TreapNode{K}
@yurivish
yurivish / gist:10085175
Last active Aug 29, 2015
Artistic design with fractal matrices
View gist:10085175
NB. http://link.springer.com/article/10.1007%2FBF01908446#page-2
iter =: monad : '(2 * 0 1 { $ +/~y) $, +/~y'
m =: 2 3 $ 0 _4 1 1 _3 2
NB. random matrix with entries from _10 to 10:
NB. m =: 2 3 $ (? 6 $ 20) - 10
viewmat iter^:4 m
View Mandelbrot
xs =: (i: 10) % 10
ys =: (i: 20) % 10
grid =: ys j./ xs
in =: 4 > |
out =: 1 - in
trim =: (* in) + (_ * out)
iter =: trim @ (+ *:)
require 'viewmat'
You can’t perform that action at this time.