Skip to content

Instantly share code, notes, and snippets.

local function groupby(func, seq)
local t = {}
for _, val in ipairs(seq) do
local key = func(val)
t[key] = t[key] or {}
t[key][#t[key] + 1] = val
end
return t
end
# Extend `dask.compute` to work on nested data structures.
from toolz import concat
from dask import compute
def _flatten_compute(vals):
if isinstance(vals, list):
inner = list(concat(map(_flatten_compute, vals)))
return ['list', len(inner)] + inner
elif isinstance(vals, dict):
inner = []
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eriknw
eriknw / LICENSE.txt
Last active January 19, 2019 13:54
Jupyter Notebook "goto" demo
Copyright (c) 2018 Erik Welch
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
a. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
b. Redistributions in binary form must reproduce the above copyright
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eriknw
eriknw / GraphBLAS_prefix_scans.ipynb
Created June 28, 2021 17:53
GraphBLAS prefix scan
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.