Taylor: just for your reference, here is an implementation along the lines
of what Tim suggested:
function Base.include(path::AbstractString, lines::AbstractVector{Int64})
lns = open(readlines, path)
include_string(join(lns[lines]))
end
Now include("file.jl", 10:20) will evaluate lines 10 through 20. You can
also do include("file.jl", [1:2;9:10]) to evaluate lines 1 through 2 and
then 9 through 10.
I’m going to put this is my .juliarc.jl :)
On Tuesday, January 5, 2016 at 1:46:05 PM UTC-8, Taylor Maxwell wrote:
Thanks, I will see if I can figure it out.
>
> On Tuesday, January 5, 2016 at 11:54:06 AM UTC-7, Tim Holy wrote:
>>
>> You should be able to write your own method
>>
>> include(filename, linerange)
>>
>> and specify 3:17 to load line numbers 3-17.
>>
>> Best,
>> --Tim
>>
>> On Tuesday, January 05, 2016 09:25:40 AM Taylor Maxwell wrote:
>> > Ordinarily that would work but my problem is that I need to do it from
>> the
>> > command line on a remote workstation (the data files cannot be moved
>> from
>> > that computer) and I can only have one terminal open in the vnc. I
>> also
>> > generally cannot install additional software such at atom (someone else
>> has
>> > to do it and it would be a giant hassle unless absolutely necessary).
>> >
>> > Thanks,
>> > Taylor
>> >
>> > On Tuesday, January 5, 2016 at 10:08:47 AM UTC-7, Spencer Russell
>> wrote:
>> > > The Atom interface [1] works really well for that sort of thing. You
>> can
>> > > just highlight the lines you want to run and press ctrl+enter to
>> execute
>> > > them.
>> > >
>> > > -s
>> > >
>> > > [1]: https://github.com/JunoLab/atom-julia-client
>> > >
>> > >
>> > > On Tue, Jan 5, 2016, at 11:54 AM, Taylor Maxwell wrote:
>> > >
>> > > I have looked around and haven't been able to find an answer (I am
>> sure it
>> > > is simple).
>> > >
>> > > Say I have a script.jl file with a bunch of commands that I want to
>> work
>> > > with interactively in the REPL but only want to do a few lines at a
>> time
>> > > and I am unable to copy/paste.
>> > >
>> > > Is there a way to load/import/include a specific set of lines of a
>> > > script.jl file into the REPL without copy/paste or putting those
>> lines
>> > > into
>> > > a new file?
>> > >
>> > > I can include("script.jl") to read in the whole file but I would like
>> to
>> > > do it piecemeal if possible.
>> > >
>> > > Thanks
>>
>>