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
# If I could design my own language, it would look something like this. | |
# | |
# + Indentation matters instead of curly braces. | |
# + Nothing but | |
# - Functions | |
# - Lists | |
# + Predefined types | |
# - Number = | |
# + = (Number) | |
# - = (Number) |
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
class SimpleSheet | |
# Returns object where each property | |
# represent the index in the array | |
@indices: (columnNames) -> | |
result = {} | |
result[name] = i for i, name of columnNames | |
result | |
constructor: (@gsheet) -> | |
range = @gsheet.getDataRange() |
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
reduce = (input, iterator, memo) -> | |
if input.length == 0 | |
memo | |
else | |
reduce(input.slice(1), iterator, iterator(memo, input[0])) | |
sum = (input) -> | |
reduce(input, (memo, item) -> | |
memo += item | |
memo |