示例#1
0
	def call(self, args):
		self.ensure_args(args, 2)
		self.ensure_arg_type(args, 1, ast.slist)
		return ast.slist([args[0]] + args[1].lst)
示例#2
0
	def call(self, args):
		def reducef(x, y):
			self.ensure_type(y, ast.slist)
			return x + y.lst
		return ast.slist(functools.reduce(reducef, args, []))
示例#3
0
	def call(self, args):
		self.ensure_args(args, 1)
		self.ensure_arg_type(args, 0, ast.slist)
		if len(args[0].lst) == 0:
			raise(runtime_error("cdr: empty list"))
		return ast.slist(args[0].lst[1:])