Skip to content

Instantly share code, notes, and snippets.

View StefanKarpinski's full-sized avatar

Stefan Karpinski StefanKarpinski

View GitHub Profile
#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}
julia> b = 1
1
julia> 0b
0
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
perl1 2 4.38690185546875e-05
perl2 2 2.78949737548828e-05
perl1 2 2.09808349609375e-05
perl2 2 1.97887420654297e-05
perl1 2 2.00271606445312e-05
perl2 2 2.09808349609375e-05
perl1 2 2.09808349609375e-05
perl2 2 2.09808349609375e-05
perl1 2 1.9073486328125e-05
perl2 2 2.00271606445312e-05
using DataFrames, Gadfly
exl = readtable("excellent.csv", names=[:variant,:digits,:time])
agg = aggregate(groupby(exl,[:variant,:digits]), median)
agg = agg[sortperm(agg[:variant], by=first, rev=true),:]
rel = join(
agg[agg[:variant].!="julia3",:],
agg[agg[:variant].=="julia3",:],
on=:digits, kind=:left
)
using Compat
function julia1(k)
for n = 10^(k-1):10^k-1
front = n*(10^k + n)
root = floor(Int,sqrt(front))
for t = root-2:root+2
back = t * (t - 1)
length(string(t)) > k && break
use Time::HiRes qw(time);
sub perl1 {
my $k = $_[0];
foreach my $n (10**($k-1) .. 10**($k)-1) {
my $front = $n * (10**$k + $n);
my $root = int(sqrt($front));
foreach my $t ($root-2 .. $root+2) {
my $back = $t * ($t - 1);
Precedence: list
Mailing-list: list julia-users@googlegroups.com; contact julia-users+owners@googlegroups.com
List-ID: <julia-users.googlegroups.com>
X-Google-Group-Id: 756090033396
List-Post: <http://groups.google.com/group/julia-users/post>, <mailto:julia-users@googlegroups.com>
List-Help: <http://groups.google.com/support/>, <mailto:julia-users+help@googlegroups.com>
List-Archive: <http://groups.google.com/group/julia-users
Sender: julia-users@googlegroups.com
List-Subscribe: <http://groups.google.com/group/julia-users/subscribe>, <mailto:julia-users+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+756090033396+unsubscribe@googlegroups.com>,
@StefanKarpinski
StefanKarpinski / threadzmq.c
Created April 8, 2014 02:26
thread communication with ZMQ
// gcc -shared -fPIC -I$JULIAHOME/usr/include -L$JULIAHOME/usr/lib -lzmq -luv -o libthreadzmq.so threadzmq.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include <zmq.h>
#include <uv.h>