Skip to content

Instantly share code, notes, and snippets.

@jacquesattack
Created November 4, 2016 19:58
Show Gist options
  • Save jacquesattack/5b4d5df95351e5aa49971173ec548b03 to your computer and use it in GitHub Desktop.
Save jacquesattack/5b4d5df95351e5aa49971173ec548b03 to your computer and use it in GitHub Desktop.
#
add = function(a,b,add_func="add_func"){
add_func(a,b)
}
# 0,1 with addition mod 2
add_func = function(a,b){
(a + b) %% 2
}
add(0,1)
add(1,1)
#
add_func = function(a,b){
(a + b) %% 3
}
require(data.table)
n = 9
l = rep(list(0:1), n)
d = data.table(expand.grid(l))
add(d[1],d[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment