Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-11-01 Thread elextr
On Saturday, November 1, 2014 10:09:46 AM UTC+11, Daniel Carrera wrote: On 31 October 2014 18:46, Jason Merrill jwme...@gmail.com javascript: wrote: On Thursday, October 30, 2014 11:42:38 PM UTC-7, Daniel Carrera wrote: The point is that Julia will parse the entire line and form a

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-11-01 Thread Jameson Nash
now you are getting very close to just implementing a version of include that takes a command object such as include(`test.jl --fast a -r 3`), which sets ARGS then include‘s test.jl normally python doesn't have special syntax for making command lines, so it needed special syntax to make this

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-31 Thread Daniel Carrera
On 31 October 2014 03:29, David P. Sanders dpsand...@gmail.com wrote: Does the following count as a fragile hack? (Probably yes!) macro run(file, args...) args = [file, args...] return esc(:(ARGS = map(string, $args)[2:end]; include(string($args[1] end IMO, yes. julia

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-31 Thread Jason Merrill
On Thursday, October 30, 2014 11:42:38 PM UTC-7, Daniel Carrera wrote: The point is that Julia will parse the entire line and form a parse tree before it begins to interpret the instruction. Therefore, the @run line has to parse correctly as valid Julia syntax. If you want to type fewer

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-31 Thread Daniel Carrera
On 31 October 2014 18:46, Jason Merrill jwmerr...@gmail.com wrote: On Thursday, October 30, 2014 11:42:38 PM UTC-7, Daniel Carrera wrote: The point is that Julia will parse the entire line and form a parse tree before it begins to interpret the instruction. Therefore, the @run line has to

[julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread David P. Sanders
El jueves, 30 de octubre de 2014 07:42:28 UTC-6, Daniel Carrera escribió: How about this macro: macro run(file, args...) return esc(:(ARGS = $args; include($file))) end That's a very simple and nice solution! I have also missed this functionality from IPython. Maybe this could go

[julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread Martin Klein
Am Donnerstag, 30. Oktober 2014 14:42:28 UTC+1 schrieb Daniel Carrera: How about this macro: macro run(file, args...) return esc(:(ARGS = $args; include($file))) end For example: - $ cat ./test.jl #!/usr/bin/julia for a in ARGS

[julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread David P. Sanders
El jueves, 30 de octubre de 2014 09:11:08 UTC-6, Martin Klein escribió: Am Donnerstag, 30. Oktober 2014 14:42:28 UTC+1 schrieb Daniel Carrera: How about this macro: macro run(file, args...) return esc(:(ARGS = $args; include($file))) end For example:

[julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread David P. Sanders
El jueves, 30 de octubre de 2014 20:01:40 UTC-6, David P. Sanders escribió: El jueves, 30 de octubre de 2014 09:11:08 UTC-6, Martin Klein escribió: Am Donnerstag, 30. Oktober 2014 14:42:28 UTC+1 schrieb Daniel Carrera: How about this macro: macro run(file, args...) return

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread Stefan Karpinski
You can't really without resorting to a fragile hack – stuff that's not in double quotes must be valid Julia syntax and the macro will not get it in raw form but in parsed form. On Thu, Oct 30, 2014 at 10:13 PM, David P. Sanders dpsand...@gmail.com wrote: El jueves, 30 de octubre de 2014

Re: [julia-users] Re: Equivalent command to IPython's %run in Julia REPL

2014-10-30 Thread David P. Sanders
El jueves, 30 de octubre de 2014 20:17:55 UTC-6, Stefan Karpinski escribió: You can't really without resorting to a fragile hack – stuff that's not in double quotes must be valid Julia syntax and the macro will not get it in raw form but in parsed form. Does the following count as a