1. Pypy
  2. Untitled project
  3. lang-scheme

Commits

Jürgen Bömmels  committed 2f31b68

Bugfix, apply evaluated it's argument twice.

  • Participants
  • Parent commits 046b82d
  • Branches default

Comments (0)

Files changed (3)

File scheme/object.py

View file
     w_iter = w_list
     while w_iter is not w_nil:
         if not isinstance(w_iter, W_Pair):
-            raise WrongArg(w_list, "List")
+            raise WrongArgType(w_list, "List")
         lst.append(w_iter.car)
         w_iter = w_iter.cdr
 

File scheme/procedure.py

View file
         W_Number, W_Real, W_Integer, W_List, W_Character, W_Vector, \
         Body, W_Procedure, W_String, W_Promise, plst2lst, w_undefined, \
         SchemeSyntaxError, SchemeQuit, WrongArgType, WrongArgsNumber, \
-        w_nil, w_true, w_false
+        w_nil, w_true, w_false, lst2plst
 
 ##
 # operations
             #print w_lst.to_repr(), "is not a list"
             raise WrongArgType(w_lst, "List")
 
-        return w_procedure.call_tr(ctx, w_lst)
+        return w_procedure.procedure_tr(ctx, lst2plst(w_lst))
 
 class Quit(W_Procedure):
     _symbol_name = "quit"

File scheme/test/test_eval.py

View file
     assert w_result.to_number() == 64
 
     assert eval_(ctx, "(apply + '())").to_number() == 0
+
+    w_result = eval_(ctx, "(apply list '((+ 2 3) (* 3 4)))")
+    assert w_result.equal(parse_("((+ 2 3) (* 3 4))"))
+    
     py.test.raises(WrongArgsNumber, eval_, ctx, "(apply 1)")
     py.test.raises(WrongArgType, eval_, ctx, "(apply 1 '(1))")
     py.test.raises(WrongArgType, eval_, ctx, "(apply + 42)")