Re: [elixir-core:5709] Home Directory On Windows

2016-05-12 Thread Onorio Catenacci
Thanks for the clarification @Dmitry. I tend to conflate bash and Linux which is a mistake of course. -- Onorio On Thursday, May 12, 2016 at 4:26:03 AM UTC-4, Dmitry Belyaev wrote: > > The feature of expanding ~ belongs to bash, not Linux itself. > > On 7 May 2016 3:27:18 AM AEST, Onorio Cate

Re: [elixir-core:5708] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread Charles Okwuagwu
I think we are best served with two functions: *read_bytes(file, start, bytes)* *read_lines(file, start, lines)* You an then optimize as required for each specific case On Thursday, May 12, 2016 at 2:38:43 PM UTC+1, eksperimental wrote: > > I was thinking of delegating stuff to IO.read when de

Re: [elixir-core:5706] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread eksperimental
I was thinking of delegating stuff to IO.read when dealing with lines On Thu, 12 May 2016 15:08:15 +0200 José Valim wrote: > Not in your example but if you want to do it per line, then yes. > > On Thursday, May 12, 2016, Charles Okwuagwu > wrote: > > > def read(file, start, length) do > > {

Re: [elixir-core:5705] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread José Valim
Not in your example but if you want to do it per line, then yes. On Thursday, May 12, 2016, Charles Okwuagwu wrote: > def read(file, start, length) do > {ok, f} = :file.open(file, [:binary]) > * {ok**, data} = :file.pread(f, start,** length)* > :file.close(f) > dataend > > We are not read

Re: [elixir-core:5705] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread Charles Okwuagwu
def read(file, start, length) do {ok, f} = :file.open(file, [:binary]) * {ok**, data} = :file.pread(f, start,** length)* :file.close(f) dataend We are not reading the whole file, or are we? *:file.pread/3* On Thursday, May 12, 2016 at 1:36:05 PM UTC+1, José Valim wrote: > > We need to c

Re: [elixir-core:5703] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread José Valim
We need to consider that performance wise they are quite different. We can move the cursor when reading lines, we can't move the cursor when reading bytes. We would actually need to load the file into Elixir. It would probably be more interesting to add a File.position instead of hiding the underly

Re: [elixir-core:5702] Can we have this convenience as a function in the File module: read(file, start, length)

2016-05-12 Thread eksperimental
Hi Charles, thank you for your proposal. I think it could be an interesting addition. But rather than just a convenience function, make it behave more like its IO conterpart: IO.read/2 Where you can pass the byte length, or :line. Because sometimes is not about the bytes, but about the informatio

Re: [elixir-core:5701] Home Directory On Windows

2016-05-12 Thread Dmitry Belyaev
The feature of expanding ~ belongs to bash, not Linux itself. On 7 May 2016 3:27:18 AM AEST, Onorio Catenacci wrote: >Oh--that's good to know José. I had just assumed that Unix wouldn't >have >that issue since Windows seems to be such a fertile hunting ground for >odd >behaviors. > >On Fri, May