Skip to content

Instantly share code, notes, and snippets.

View fsrc's full-sized avatar

Fredrik Andersson fsrc

View GitHub Profile
@fsrc
fsrc / main.fal
Created August 3, 2011 07:19
Made up fantasy language FAL
# 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)
@fsrc
fsrc / simple_sheet.coffee
Created September 26, 2012 22:49
CoffeeScript wrap up values within function objects? Kind of currying?
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()
@fsrc
fsrc / reduce.coffee
Created April 24, 2014 11:42
Reduce-example
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