Skip to content

Instantly share code, notes, and snippets.

@telephon
telephon / flop-event.scd
Last active November 7, 2017 07:18
completely flopping dictionaries might be more efficient after all

( var flop = { |dict, keys| var values, size; keys = keys ?? { dict.keys.asArray }; // in terms of performance, this is the main bottleneck values = keys.collect { |x| dict.at(x) }; // and this. values = values.flop: size = values.first.size; values.collect { |xs| var each = dict.copy;

@telephon
telephon / dice-unicode
Last active November 6, 2017 11:59
unicode test for scide
these should be dice: ⚂⚁
if not, there is something wrong with you.
@telephon
telephon / stitching functions
Last active July 6, 2017 19:58
These functions are possible ways of stitching one array into another. This models variants of a possible future Pbindef behaviour
// the groups of inserted items are kept as arrays for easier reading
// eventually we use something like the insertAll function to embed them instead
(
var insertAll;
insertAll = { |i, list, insertedList|
j = (i - 1).clip(0, list.size - 1);
list[0..j] ++ insertedList ++ list[j+1..]
};