kopia lustrzana https://github.com/backface/turtlestitch
new library: Frequency Distribution Analysis, separated from "Bigger Data"
rodzic
2e4f52f40a
commit
9cb98f849a
|
@ -1,5 +1,8 @@
|
|||
# Snap<em>!</em> (BYOB) History
|
||||
|
||||
###2018-11-02
|
||||
* new library: Frequency Distribution Analysis, separated from "Bigger Data"
|
||||
|
||||
## v4.2.2.4
|
||||
###2018-10-29
|
||||
* Blocks: fixed #2234 (display all reachable local variables in drop-down menu)
|
||||
|
|
|
@ -18,6 +18,7 @@ animation_module.xml Animation glide, grow and rotate using easing functions.
|
|||
pixel_module.xml Pixels manipulate costumes pixel-wise.
|
||||
audioComp_module.xml Audio Comp analyze, manipulate and generate sound samples.
|
||||
atomic_HOFs_module.xml "Bigger" Data [EXPERIMENTAL] crunch large lists very fast
|
||||
frequency_distribution_module.xml Frequency Distribution Analysis [EXPERIMENTAL] analyze data for frequency distribution
|
||||
make-variables.xml create variables in program declare global or sprite-local variables in a script
|
||||
json.xml Deal with JSON data Turn JSON strings into lists with the listify block, then retrieve data out of them by using the value at key block.
|
||||
parallel_module.xml Parallelization Run several scripts in parallel and wait until all are done.
|
||||
|
|
|
@ -1 +1 @@
|
|||
<blocks app="Snap! 4.2, http://snap.berkeley.edu" version="1"><block-definition s="$flash map %'fn' over %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicMap(fn, data);</l></block><list><block var="fn"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash keep %'test' from %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicKeep(fn, data);</l></block><list><block var="test"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash combine %'fn' with %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicCombine(fn, data);</l></block><list><block var="fn"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash sort %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%predRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicSort(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition><block-definition s="$flash reverse %'list'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>return new List(list.asArray().slice().reverse());</l></block><list><block var="list"/></list></block></block></script></block-definition><block-definition s="$flash analyze %'data'" type="reporter" category="lists"><comment x="0" y="0" w="149" collapsed="false">returns a frequency analysis of the argument list, represented as a two-column table, where the first column contains the unique values and the second column their occurrences</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>var dict = new Map(),
 result = [],
 data = list.asArray(),
 len = data.length,
 i;
for (i = 0; i < len; i += 1) {
 if (dict.has(data[i])) {
 dict.set(data[i], dict.get(data[i]) + 1);
 } else {
 dict.set(data[i], 1);
 }
}
dict.forEach(function (value, key) {
 result.push(new List([key, value]));
});
return new List(result);</l></block><list><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash group %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicGroup(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition></blocks>
|
||||
<blocks app="Snap! 4.2, http://snap.berkeley.edu" version="1"><block-definition s="$flash map %'fn' over %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicMap(fn, data);</l></block><list><block var="fn"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash keep %'test' from %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicKeep(fn, data);</l></block><list><block var="test"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash combine %'fn' with %'data'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>fn</l><l>data</l><l>proc</l></list><l>return proc.reportAtomicCombine(fn, data);</l></block><list><block var="fn"/><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash sort %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%predRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicSort(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition><block-definition s="$flash reverse %'list'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>return new List(list.asArray().slice().reverse());</l></block><list><block var="list"/></list></block></block></script></block-definition></blocks>
|
|
@ -0,0 +1 @@
|
|||
<blocks app="Snap! 4.2, http://snap.berkeley.edu" version="1"><block-definition s="$flash analyze %'data'" type="reporter" category="lists"><comment x="0" y="0" w="149" collapsed="false">returns a frequency analysis of the argument list, represented as a two-column table, where the first column contains the unique values and the second column their occurrences</comment><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>list</l></list><l>var dict = new Map(),
 result = [],
 data = list.asArray(),
 len = data.length,
 i;
for (i = 0; i < len; i += 1) {
 if (dict.has(data[i])) {
 dict.set(data[i], dict.get(data[i]) + 1);
 } else {
 dict.set(data[i], 1);
 }
}
dict.forEach(function (value, key) {
 result.push(new List([key, value]));
});
return new List(result);</l></block><list><block var="data"/></list></block></block></script></block-definition><block-definition s="$flash group %'data' by %'fn'" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>data</l><l>fn</l><l>proc</l></list><l>return proc.reportAtomicGroup(data, fn);</l></block><list><block var="data"/><block var="fn"/></list></block></block></script></block-definition></blocks>
|
Ładowanie…
Reference in New Issue