style fixups, unbreaking print
This commit is contained in:
parent
bce14c18a4
commit
2b908254ac
@ -107,6 +107,14 @@ class HyASTCompiler(object):
|
|||||||
lineno=expr.start_line,
|
lineno=expr.start_line,
|
||||||
col_offset=expr.start_column)
|
col_offset=expr.start_column)
|
||||||
|
|
||||||
|
@builds("print")
|
||||||
|
def compile_print_expression(self, expr):
|
||||||
|
expr.pop(0) # print
|
||||||
|
return ast.Print(
|
||||||
|
dest=None,
|
||||||
|
values=[self.compile(x) for x in expr],
|
||||||
|
nl=True)
|
||||||
|
|
||||||
@builds("assert")
|
@builds("assert")
|
||||||
def compile_assert_expression(self, expr):
|
def compile_assert_expression(self, expr):
|
||||||
expr.pop(0) # assert
|
expr.pop(0) # assert
|
||||||
@ -170,7 +178,7 @@ class HyASTCompiler(object):
|
|||||||
ctx=ast.Load())
|
ctx=ast.Load())
|
||||||
|
|
||||||
@builds("assoc")
|
@builds("assoc")
|
||||||
def compile_index_expression(self, expr):
|
def compile_assoc_expression(self, expr):
|
||||||
expr.pop(0) # assoc
|
expr.pop(0) # assoc
|
||||||
# (assoc foo bar baz) => foo[bar] = baz
|
# (assoc foo bar baz) => foo[bar] = baz
|
||||||
target = expr.pop(0)
|
target = expr.pop(0)
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
<div class = 'popover' >
|
<div class = 'popover' >
|
||||||
<div class = 'focus' >
|
<div class = 'focus' >
|
||||||
<div class = 'repl' >
|
<div class = 'repl' >
|
||||||
<textarea id = 'repl-input' class = 'repl-pane repl-left' >
|
<textarea id = 'repl-input' class = 'repl-pane repl-left' >
|
||||||
|
; This is an example of some of the things that Hy can do
|
||||||
|
|
||||||
|
(defn hello-world [who] (print (.join ", " ["Hello" who])))
|
||||||
|
|
||||||
|
(hello-world "Paul")
|
||||||
|
; Hello, Paul!
|
||||||
</textarea>
|
</textarea>
|
||||||
<pre id = 'repl-output' class = 'repl-pane repl-right' ></pre>
|
<pre id = 'repl-output' class = 'repl-pane repl-right' ></pre>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user