Skip to content

Instantly share code, notes, and snippets.

View StefanKarpinski's full-sized avatar

Stefan Karpinski StefanKarpinski

View GitHub Profile
jewelry jewwlry 1.0
jewelry jewlwry 1.0
jewelry jewlwery 0.875
jewelry jewlwer 1.0
jewelry jewls 0.7142857142857143
jewelry jewlry 0.8571428571428571
jewelry jewlrey 1.0
jewelry jewllery 0.875
jewelry jewlewry 0.875
jewelry jewleryjust 0.6363636363636364
jewelry jewwlry 1.0
jewelry jewlwry 1.0
jewelry jewlwery 0.875
jewelry jewlwer 1.0
jewelry jewls 0.7142857142857143
jewelry jewlry 0.8571428571428571
jewelry jewlrey 1.0
jewelry jewllery 0.875
jewelry jewlewry 0.875
jewelry jewleryjust 0.6363636363636364
julia> b = 1
1
julia> 0b
0
julia> quality(x,a::Rational) = log(den(a),1/abs(x-a))
julia> function maxquality(x,n)
Q = -Inf
for k = 1:n
a = rational(x,1/2^k)
if a == x break end
q = quality(x,a)
if isfinite(q) && Q < q
Q = q
#load ("debug.jl")
const BALANCED = int8(0)
const LEFT = int8(1)
const RIGHT = int8(2)
abstract Avl{K, V}
type Sortmap{K, V} # <: .... ?
root :: Avl{K, V}
test_type sort_fn log_size size *sort \sort /sort 3sort +sort ~sort =sort !sort
[1,] Int64 "sort!" 17 131072 0.006040 0.004262 0.004221 0.004217 0.004263 0.004335 0.004316 NA
[2,] Int64 "mergesort!" 17 131072 0.013253 0.006057 0.005364 0.005582 0.005319 0.005359 0.005337 NA
[3,] Int64 "timsort!" 17 131072 0.022508 0.003652 0.000391 0.001081 0.001012 0.001006 0.000792 NA
[4,] Float64 "sort!" 17 131072 0.013119 0.004842 0.008454 0.003728 0.005308 0.006597 0.005358 NA
[5,] Float64 "mergesort!" 17 131072 0.029234 0.016607 0.008275 0.008506 0.008043 0.016176 0.007970 NA
[6,] Float64 "timsort!" 17 131072 0.031171 0.000929 0.000719 0.001449 0.001065 0.019995 0.000718 NA
[7,] "String[5]" "sort!" 17 131072 0.860883 0.965052 0.52
julia> quote
for i in 1:n
x[i] ~ Bernoulli(p)
end
p ~ Beta(alpha, beta)
alpha = 1.0
beta = 1.0
end
quote # line 2:
type DataVec{T} <: AbstractDataVec{T}
data::Vector{T}
na::BitVector
# Sanity check that new data values and missingness metadata match
function DataVec(data::Vector{T}, na::BitVector)
if length(data) != length(na)
error("data and NA vectors not the same length!")
end
new(data,na)
abstract Path
@unix_only begin
const separator = "/"
const separator_regex = r"/+"
end
@windows_only begin
const separator = "\\"
const separator_regex = r"[/\\]"
end
splitpath => path to array of parts
joinpath => array of parts to path
parsepath(path) => (dir,base,ext)
parsepath(path,ext) => (dir,base,ext)
parsepath(path,regex) => (dir,base,ext)
stdpath(path) => standardize path, removing extraneous dots
abspath(path) => make absolute, relative to current dir
realpath(path) => resolve all symlinks