1. [std lib] question about read_lines() return value

Jeremy, regarding your documentation for the read_lines() function, you have it
returning {{"line_1"}, {"line_2"}, {"line_3"}}.

Aren't the extra braces redundant? Shouldn't the function return {"line_1",
"line_2", "line_3"}?

Basically it seems to be returning one extra level of indirection.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » topic index » view message » categorize

2. Re: [std lib] question about read_lines() return value

Jason Gade wrote:
> 
> Jeremy, regarding your documentation for the read_lines() function, you have
> it returning {{"line_1"}, {"line_2"}, {"line_3"}}.
> 
> Aren't the extra braces redundant? Shouldn't the function return {"line_1",
> "line_2", "line_3"}?

Ops. That's a problem in the documentation. I looked at the unit tests and
confirmed as well with a test program:

include file.e
include misc.e

sequence l
l = read_lines("test.e")
pretty_print(1, l, {2})


The output is:

$ exu test.e 
{
  "include file.e",
  "include misc.e",
  "",
  "sequence l",
  "l = read_lines("test.e")",
  "pretty_print(1, l, {2})"
}

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu