_.flow(
_.castArray,
_.partial(_.at, _, ['[0].id', '[0]']),
_.spread(put)
)
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
var filter = function (xs, p) { | |
return xs.reduce(function (results, v) { | |
return results.concat(p(v) ? [v] : []); | |
}, []); | |
}; | |
var map = function (xs, f) { | |
return xs.reduce(function (results, v) { | |
return results.concat([f(v)]); | |
}, []); |
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
foo.py select-column.py X | |
values = [ | |
[1, 10, 20, 30, 40], | |
[2, 10, 21, 31, 41], | |
[3, 11, 22, 32, 42], | |
[4, 10, 23, 33, 43], | |
] | |
def matches_10(row): | |
return row[1] == 10 |
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
from itertools import groupby | |
values = [ | |
['1', 'r1', '100'], | |
['1', 'r2', '100'], | |
['1', 'r3', '105'], | |
['1', 'c1', '100'] | |
] | |
def grouping_factor(row): |
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
def group_by(values, grouping_factor): | |
results = {} | |
for value in values: | |
key = grouping_factor(value) | |
if key in results: | |
results[key].append(value) | |
else: | |
results[key] = [value] |
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
print "hello world" | |
""" This is a multi-line comment... no it's not | |
int main() { | |
return 0; | |
} | |
""" | |
def main(): | |
return 0 |
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
type Person(name: string) = | |
member this.GetName () = name | |
type Employee(name: string, id: int) = | |
inherit Person(name) | |
member this.GetId () = id | |
member val Id = id with get, set |
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
function Unstyled() { | |
this.append = function (other) { | |
return other; | |
}; | |
this.empty = function () { | |
return new Unstyled(); | |
}; | |
this.$addLesserStyle = function (style, value) { |
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
myPlusCommutes : (n : Nat) -> (m : Nat) -> n + m = m + n | |
myPlusCommutes Z Z = Refl | |
myPlusCommutes Z (S k) = rewrite plusZeroRightNeutral (S k) in Refl | |
myPlusCommutes (S k) Z = rewrite plusZeroRightNeutral (S k) in Refl | |
myPlusCommutes (S k) (S j) = | |
cong {f=S} (rewrite sym (plusSuccRightSucc k j) in (rewrite myPlusCommutes k j in (rewrite plusSuccRightSucc j k in Refl))) |