A zip function in javascript using .reduce
.
See Tom MacWright's post making juice with reduce
/ foldl
.
See also _.zip
and d3.zip
for alternative implementations and sample usage.
defmodule BitString.Example do | |
import BitString | |
defbitstring data_frame do | |
_ :: 1 | |
stream_id :: 31 | |
flags :: 8 | |
length :: 24 | |
_ :: 1 | |
_ :: 7 |
defmodule NumbersInput do | |
def start do | |
IO.stream(:stdio, :line) | |
|> Stream.flat_map(&tokenize/1) | |
|> Stream.take_while(&(&1 > -1)) | |
end | |
defp tokenize(line) do | |
line | |
|> String.split(" ") |
''' | |
Created on Feb 8, 2015 | |
@author: David Ray | |
''' | |
import numpy as np | |
from nupic.encoders.scalar import ScalarEncoder as ScalarEncoder | |
from nupic.algorithms.CLAClassifier import CLAClassifier as CLAClassifier |
defmodule HammingBench do | |
use Benchfella | |
use Bitwise | |
@n Stream.repeatedly(fn -> Enum.random [0, 1] end) | |
|> Enum.take(100_000) | |
|> Enum.join | |
|> String.to_integer(2) | |
bench "CharlesO" do |
# Markdown syntax highlight config for MC (MidnigntCommander) | |
# (not full, but usable) | |
# | |
# https://gist.github.com/rb2/1f6b23ea5ea848c75a8c | |
# | |
# Authors: | |
# Ruslan Brest, http://rb.labtodo.com, 2013 | |
# | |
# Usage: | |
# |
# Natural Language Toolkit: WordNet | |
# | |
# Copyright (C) 2001-2013 NLTK Project | |
# Author: Steven Bethard <Steven.Bethard@colorado.edu> | |
# Steven Bird <stevenbird1@gmail.com> | |
# Edward Loper <edloper@gradient.cis.upenn.edu> | |
# Nitin Madnani <nmadnani@ets.org> | |
# URL: <http://www.nltk.org/> | |
# For license information, see LICENSE.TXT | |
from __future__ import print_function, unicode_literals |
A zip function in javascript using .reduce
.
See Tom MacWright's post making juice with reduce
/ foldl
.
See also _.zip
and d3.zip
for alternative implementations and sample usage.
jQuery(document).ready(function($) { | |
$('#nav-toggle').sidr({ | |
name: 'sidr-right', | |
side: 'right', | |
source: '#menu-short, .search-form, .site-title' | |
}); | |
}); |
Based on tests on my machine (2013 MacBook Pro, 2.6 GHz i7, 16 GB RAM) generated by https://github.com/pragdave/map_performance
Elixir v1.0.4
class BiDict(object): | |
''' | |
Maps both directions: key->value and value->key | |
Requires both keys and values are unique. If you pass duplication, | |
then key/value be overwritten and you get not what expected. | |
''' | |
origin = {} # counters the {key->key} case | |
bidict = {} |