Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@macro("parald")
def tmac2(ETname, *tree):
return HyList((HyInteger(9), ) + tree)
@macro("test")
def tmac(ETname, *tree):
""" Turn an expression into a list """
return HyList(tree)
@macro("defn")
@macro("defun")
def defn_macro(name, *body):
return HyExpression([HySymbol("def"),
name, HyExpression([HySymbol("fn")] + list(body))])
@macro("unless")
def unless_macro(test, *body):
return HyExpression([
HySymbol('if'),
test,
HySymbol('None'),
HyExpression([HySymbol("do")] + list(body)),
])
@macro("ideas")
def ideas_macro(ETname):
return HyExpression([HySymbol('print'),
HyString(r"""
@macro("when")
def when_macro(test, *body):
return HyExpression([
HySymbol('if'),
test,
HyExpression([HySymbol("do")] + list(body)),
])
@macro("post_route")
def post_route_macro(*tree):
return router(tree, rkwargs=HyList([HyString("POST")]))
@macro("rest")
def rest_macro(lst):
return HyExpression([HySymbol('slice'),
lst,
HyInteger(1)])
@macro("_>>")
def threading_tail_macro(head, *rest):
ret = head
for node in rest:
if not isinstance(node, HyExpression):
nnode = HyExpression([node])
nnode.replace(node)
node = nnode
node.append(ret)
ret = node
return ret
@macro("first")
def first_macro(lst):
return HyExpression([HySymbol('get'),
lst,
HyInteger(0)])