adding in thingers.

This commit is contained in:
Paul R. Tagliamonte 2013-03-05 22:08:53 -05:00
parent f950717e5a
commit da234b1d8f
3 changed files with 15 additions and 1 deletions

View File

@ -21,9 +21,10 @@
from hy.errors import HyError from hy.errors import HyError
from hy.models.expression import HyExpression from hy.models.expression import HyExpression
from hy.models.symbol import HySymbol
from hy.models.integer import HyInteger from hy.models.integer import HyInteger
from hy.models.string import HyString from hy.models.string import HyString
from hy.models.symbol import HySymbol
from hy.models.list import HyList
import ast import ast
@ -169,6 +170,14 @@ class HyASTCompiler(object):
col_offset=expression.start_column, col_offset=expression.start_column,
targets=[name], value=what) targets=[name], value=what)
@builds(HyList)
def compile_list(self, expr):
return ast.List(
elts=[self.compile(x) for x in expr],
ctx=ast.Load(),
lineno=expr.start_line,
col_offset=expr.start_column)
@builds("fn") @builds("fn")
def compile_fn_expression(self, expression): def compile_fn_expression(self, expression):
expression.pop(0) # fn expression.pop(0) # fn

View File

@ -2,3 +2,4 @@
import hy import hy
from .native_tests.math import * from .native_tests.math import *
from .native_tests.language import *

View File

@ -0,0 +1,4 @@
;
(def test_lists (fn []
(assert (= [1 2 3 4] (+ [1 2] [3 4])))))