diff src/variables.cc @ 7531:c9a476b1e664

correctly set ans for cs-lists and simplify printing them
author John W. Eaton <jwe@octave.org>
date Tue, 26 Feb 2008 02:16:32 -0500
parents 0fa079d04772
children 84122fb29c75
line wrap: on
line diff
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -1886,10 +1886,20 @@
 
   if (val.is_defined ())
     {
-      symbol_table::varref (ans) = val;
-
-      if (print)
-	val.print_with_name (octave_stdout, ans);
+      if (val.is_cs_list ())
+	{
+	  octave_value_list lst = val.list_value ();
+
+	  for (octave_idx_type i = 0; i < lst.length (); i++)
+	    bind_ans (lst(i), print);
+	}
+      else
+	{
+	  symbol_table::varref (ans) = val;
+
+	  if (print)
+	    val.print_with_name (octave_stdout, ans);
+	}
     }
 }