{{ message }}

Instantly share code, notes, and snippets.

# getzdan

Created Dec 29, 2017
Jupyter notebook on EM-like algorithm for inference on a Poisson mixture model
View PoissonEM Next.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Oct 30, 2017
BreakAt iterator definition
View breakat.jl
 import Base.Iterators: start, next, done, eltype, iteratoreltype, iteratorsize, SizeUnknown struct BreakAt{P,I} pred::P itr::I end breakat(pred, itr) = BreakAt(pred, itr) @inline start(b::BreakAt) = start_breakat(b.pred, b.itr)
Created May 9, 2017
a quick method for generating grid of matrix subscripts
View f6.jl
 function f6(xs, ys) lx, ly = length(xs), length(ys) lxly = lx*ly res = Array{Base.promote_eltype(xs, ys), 2}(lxly, 2) ind = 1 while ind<=lxly @inbounds for x in xs res[ind] = x ind += 1 end
Created Dec 9, 2015
A non-breaking Julia control-flow change to separate the One language from mortal languages, doomed to die
View forchange.md

### A non-breaking Julia control-flow change to separate the One language from mortal languages, doomed to die

From a design patterns and DRY perspective it seems `for` loops together with the `break` statement are serving as a useful `try`/`catch` mechanism for non-error situations. A common pattern defines a variable before a `for` loop and tries to discern, using said variable, the circumstances of exiting the `for` loop. Leveraging the embedded mental construct of `try`/`catch` blocks, we can simplify this repeating pattern and make it easier and more readable.

The syntax can look as follows:

``````for ...(loop vars here)...
...(local vars here)...
...
``````