[GAP Forum] Input stream inside a function

Laurent Bartholdi laurent.bartholdi at gmail.com
Fri Apr 18 11:45:15 BST 2008


Dear Anvita,
This is because a is a local variable, and Read() only has access to global
variables.
If you need such a construct, try

F := function(a)
  __A_GLOBAL_NAME_THAT_IS_NOT_USED := a;
  Read(InputTextString("b:=__A_GLOBAL_NAME_THAT_IS_NOT_USED;"));
  return b;
end;

note however that b will also be a global variable.

Best, Laurent
-- 
Laurent Bartholdi \ laurent.bartholdi<at>gmail<dot>com
EPFL SB SMA IMB MAD \ Téléphone: +41 21-6935458
Station 8 \ Secrétaire: +41 21-6935471
CH-1015 Lausanne, Switzerland \ Fax: +41 21-6930339
Home address: http://f34.com/68


More information about the Forum mailing list