Arc Forumnew | comments | leaders | submitlogin
2 points by zck 3569 days ago | link | parent

Now that I've been able to test it, this works, as long as you don't have empty lines in your file. If you do, it works...oddly:

This file:

    This is the first line.
    After this line there is an empty line.
    
    After this line there are two empty lines.
    
    
    This is the last line.

results in this list:

    arc> (read-all "/home/zck/test.txt")
    ("This is the first line." "After this line there is an empty line." "\nAfter this line there are two empty lines." "\n" "This is the last line.")
Note how the newline after the first empty line gets glommed onto the line after it? Yech. But it does work exactly as expected if each line is nonempty.


2 points by akkartik 3569 days ago | link

That is indeed quite lame: http://arclanguage.github.io/ref/io.html#readline

Edit 8 minutes later: seems to work fine for me on anarki.

  arc> (fromfile "x" (drain:readline))
  ("This is the first line." "After this line there is an empty line." "" "After this line there are two empty lines." "" "" "This is the last line.")
  arc> (fromstring "\n\na\nc\n\nd" (drain:readline))
  ("" "" "a" "c" "" "d")
Were you running arc3.1 or something?

-----

2 points by zck 3568 days ago | link

Yeah, I run arc3.1 for several reasons -- including that anarki doesn't work in Emacs's shell, and I haven't taken the time to figure out^1 why: my hypothesis is that simply removing rlwrap would fix it, but I so rarely use Arc these days I haven't dealt with it.

[1] Nor have I taken the time to respond to your emails from months ago. I'm sorry about that; it's related (among other things) to some general malaise I'm trying to deal with.

-----

3 points by rocketnia 3567 days ago | link

I think this thread is when the bug was raised and fixed: http://arclanguage.org/item?id=10830

-----