From 868d1cbd6eb4bb3249555071645bf5fd633923c9 Mon Sep 17 00:00:00 2001 From: Paul Tagliamonte Date: Sun, 16 Dec 2012 14:57:39 -0500 Subject: [PATCH] cute little test. still fscked. --- hy/lang/expression.py | 8 ++++++++ test.py | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test.py diff --git a/hy/lang/expression.py b/hy/lang/expression.py index 65fe734..7f61455 100644 --- a/hy/lang/expression.py +++ b/hy/lang/expression.py @@ -20,3 +20,11 @@ class HYExpression(list, HYObject): "function": fn, "args": args } + + def __call__(self, *args, **kwargs): + things = [] + fn = self.get_invocation()['function'] + for child in self.get_children(): + things.append(child()) + + return self.namespace[fn](*things) diff --git a/test.py b/test.py new file mode 100644 index 0000000..7313eac --- /dev/null +++ b/test.py @@ -0,0 +1,11 @@ +from hy.compiler.modfaker import forge_module +from hy.lex.tokenize import tokenize + + +m = forge_module( + 'test', + 'test.hy', + tokenize('(def two (+ 1 1))') +) + +print m.two