remove progn in favor of do
This commit is contained in:
parent
66c1f38fcc
commit
33e0b4b3db
@ -289,10 +289,10 @@ conditional expression.
|
||||
{1: 2, 3: 6, 9: 18, 5: 10, 7: 14}
|
||||
|
||||
|
||||
do / progn
|
||||
do
|
||||
----------
|
||||
|
||||
``do`` and `progn` are used to evaluate each of their arguments and return the
|
||||
``do`` is used to evaluate each of its arguments and return the
|
||||
last one. Return values from every other than the last argument are discarded.
|
||||
It can be used in ``lambda`` or ``list-comp`` to perform more complex logic as
|
||||
shown in one of the following examples.
|
||||
|
@ -748,8 +748,7 @@ class HyASTCompiler(object):
|
||||
return ret
|
||||
|
||||
@builds("do")
|
||||
@builds("progn")
|
||||
def compile_progn(self, expression):
|
||||
def compile_do(self, expression):
|
||||
expression.pop(0)
|
||||
return self._compile_branch(expression)
|
||||
|
||||
@ -2371,7 +2370,7 @@ class HyASTCompiler(object):
|
||||
|
||||
@builds("eval_and_compile")
|
||||
def compile_eval_and_compile(self, expression):
|
||||
expression[0] = HySymbol("progn")
|
||||
expression[0] = HySymbol("do")
|
||||
hy.importer.hy_eval(expression,
|
||||
compile_time_ns(self.module_name),
|
||||
self.module_name)
|
||||
@ -2380,7 +2379,7 @@ class HyASTCompiler(object):
|
||||
|
||||
@builds("eval_when_compile")
|
||||
def compile_eval_when_compile(self, expression):
|
||||
expression[0] = HySymbol("progn")
|
||||
expression[0] = HySymbol("do")
|
||||
hy.importer.hy_eval(expression,
|
||||
compile_time_ns(self.module_name),
|
||||
self.module_name)
|
||||
|
@ -7,7 +7,7 @@
|
||||
{"methods" ~methods})]]
|
||||
(with-decorator deco
|
||||
(defn ~name ~params
|
||||
(progn ~@code)))))
|
||||
(do ~@code)))))
|
||||
|
||||
;; Some macro examples
|
||||
(defmacro route [name path params &rest code]
|
||||
|
Loading…
x
Reference in New Issue
Block a user