question about repeat() function

new topic     » topic index » view thread      » older message » newer message

I do not understand the following behavior of the repeat() function. According to the book repeat("*",10) should return a sequence of 10 *. If I try to print the string I get the sequence in character string error. We appear to be back to the extra set of braces problem or is there a subtle difference between a character sequence and a general sequence? Any help appreciated. Thx

sequence txt                                                                     
txt = repeat("*",10)                                                             
include std/pretty.e                                                             
pretty_print(1,txt,{})                                                           
printf(1,"%d\n",length(txt))                                                     
printf(1,"%s\n",{txt}) --if remove braces get one * as expected 

 
{ 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'}, 
  {42'*'} 
}10 
 
test.ex:6 
sequence found inside character string  
 
--> See ex.err  
 

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu