Permalink
Browse files

Started work on Higher Order Functions Talk

Created the first example, DoOp for parameterized functions

Signed-off-by: Tim Henderson <tim.tadh@gmail.com>
  • Loading branch information...
1 parent 786045b commit e8b90594bee7b8369abc22846a5da4f49f3654c1 @timtadh timtadh committed Oct 26, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 20111026 Higher Order Functions/ex/paramterized/simple.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Author: Tim Henderson
+# Email: tim.tadh@hackthology.com
+# This file is in the Public Domain
+
+def add(a, b): return a + b
+def sub(a, b): return a - b
+def mul(a, b): return a * b
+def div(a, b): return a / b
+
+def DoOp(f, a, b): return f(a,b)
+
+print DoOp(add, 1, 2)
+

0 comments on commit e8b9059

Please sign in to comment.