This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use RangeChunk; | |
iter compress(array, trutharray) { | |
for (i,j) in zip(array, trutharray) { | |
if j { | |
yield i; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use RangeChunk; | |
use Time; | |
iter dropwhile(array, function) { | |
var iterable = array; | |
var barrier = false; | |
for i in iterable { | |
if function(i){ | |
barrier = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use RangeChunk; | |
use Time; | |
iter filter(array, function) { | |
for i in array { | |
if function(i) { | |
yield i; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use RangeChunk; | |
use Time; | |
// serial | |
iter starmap(array, function) { | |
var iterable = array; // I know that I don't need to copy "array" to new variable "iterable" | |
for i in iterable { | |
yield function((...i)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this method would be super cool in databases for example in a world without GROUP BY sql command :D | |
use Set; | |
use List; | |
use RangeChunk; | |
// takes iterable of object or any stuff | |
// function is the thing that is common between multiple | |
// of some objects in iterable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc notAdd(a: int, b: int) { | |
return (a + b , a + b); | |
} | |
proc notMul(a: int, b: int) { | |
return (a*b , a*b); | |
} | |
var h = [notAdd, notMul, notAdd, notMul, notAdd]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer