Re: [julia-users] excessive memory allocation with @printf at compile time

2016-01-07 Thread Michael Friedlander
Thanks for the pointer — wrapping all `@printf` statements cut compile time down by a factor of 10! On Thursday, January 7, 2016 at 3:27:53 PM UTC-8, Chris Stook wrote: > > You can see what I did here. > > https://github.com/cstook/FTD2XX.jl/blob/master/src/ft_ee_read__ft_ee_program.jl > > <

Re: [julia-users] How to define methods of rearranged arguments

2016-01-07 Thread Josh Day
True, but this is a special case where arguments have unique types. The reason I asked is for a type in OnlineStats.jl , where more often than not, the user will probably change defaults. StatLearn(x, y, L1Regression(), AdaGrad(), L2Penalty()) looks

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
(Not sure how to edit my message) Actually, I ran it how you did and it worked fine. But I'm still not sure why it won't run when I use include("arg.jl"). On Thursday, January 7, 2016 at 7:09:47 PM UTC-5, Uthsav Chitra wrote: > > I opened Julia in Terminal, made a file with that text called 'arg

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
I opened Julia in Terminal, made a file with that text called 'arg.jl', and ran include("arg.jl"). On Thursday, January 7, 2016 at 4:34:00 PM UTC-5, Kevin Squire wrote: > > Hello Uthsav, > > Works for me: > > $ julia0.3 argparse_example3.jl --opt1 1 2 3 > Parsed args: > arg1 => {"2","3"} >

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
Sorry! Won't happen again. On Thursday, January 7, 2016 at 4:38:27 PM UTC-5, Stefan Karpinski wrote: > > Please don't cross-post questions on multiple forums: > http://stackoverflow.com/questions/34665140/argparse-add-arg-table-not-recognized-in-julia > . > > On Thu, Jan 7, 2016 at 4:33 PM, Kevin

[julia-users] Re: Pre-ANN: StringInterpolation.jl

2016-01-07 Thread Eric Forgy
Haha! :D Scott, that is awesome :) I don't deserve any credit for StringInterpolation. It is simply Stefan's old interp_parse resurrected and even JuliaJS is largely an immitation of Blink. I should make this more clear in the READMEs but was rushing to get them out hoping to get feedback to m

Re: [julia-users] excessive memory allocation with @printf at compile time

2016-01-07 Thread Chris Stook
You can see what I did here. https://github.com/cstook/FTD2XX.jl/blob/master/src/ft_ee_read__ft_ee_program.jl There are a bunch of @printf 's starting at line 450. I'm learning Julia. There may be a better wa

Re: [julia-users] Iterating over leafs of a tree: use Cartesian?

2016-01-07 Thread Asbjørn Nilsen Riseth
Ah, that makes sense. I've mostly been working with Floats, so I didn't realise there was an Int type. On Thu, 7 Jan 2016 at 23:02 Kristoffer Carlsson wrote: > Just an unsolicited tip here. > > Try not to "over type" your functions. Your function here would be > cumbersome to use for someone on

Re: [julia-users] How to define methods of rearranged arguments

2016-01-07 Thread Tim Holy
This is what keyword arguments are for. http://docs.julialang.org/en/stable/manual/functions/#keyword-arguments --Tim On Thursday, January 07, 2016 11:02:03 AM Josh Day wrote: > Suppose I have a function that takes several arguments of different types > and each has a default value. What is the

Re: [julia-users] Iterating over leafs of a tree: use Cartesian?

2016-01-07 Thread Kristoffer Carlsson
Just an unsolicited tip here. Try not to "over type" your functions. Your function here would be cumbersome to use for someone on a 32-bit system for example. Unless you have a good reason, prefer Int instead of explicit Int32 / Int64. On Thursday, January 7, 2016 at 7:18:31 PM UTC+1, Asbjørn N

Re: [julia-users] excessive memory allocation with @printf at compile time

2016-01-07 Thread Michael Friedlander
I'm also having similar trouble: compiling a module with a couple of dozen `@printf` statements can take 20-30 seconds, but only a few seconds when these statements are commented out. Can you please say a bit more about how the `@printf` call should be wrapped in a function? On Sunday, Octobe

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Stefan Karpinski
Please don't cross-post questions on multiple forums: http://stackoverflow.com/questions/34665140/argparse-add-arg-table-not-recognized-in-julia . On Thu, Jan 7, 2016 at 4:33 PM, Kevin Squire wrote: > Hello Uthsav, > > Works for me: > > $ julia0.3 argparse_example3.jl --opt1 1 2 3 > Parsed args:

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Kevin Squire
Hello Uthsav, Works for me: $ julia0.3 argparse_example3.jl --opt1 1 2 3 Parsed args: arg1 => {"2","3"} karma => 0 arg2 => {"no_arg_given"} opt1 => 1 How are you trying to run that code? On Thu, Jan 7, 2016 at 12:36 PM, Uthsav Chitra wrote: > I'm using Julia v0.3.9 right now.

[julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
I'm using Julia v0.3.9 right now. I recently updated all my packages (I haven't opened Julia in a couple months), including ArgParse. The macro @add_arg_table isn't recognized though. In particular, I tried running example code here

Re: [julia-users] How to define methods of rearranged arguments

2016-01-07 Thread Josh Day
Thanks, Tom. That's exactly what I'm looking for. On Thursday, January 7, 2016 at 2:21:13 PM UTC-5, Tom Breloff wrote: > > Depending on how much performance you need, you could do something like: > > _f(a::A, b::B, c::C) = ... > > function f(args...) > a,b,c = A(1),B(1),C(1) > for arg in args

Re: [julia-users] How to define methods of rearranged arguments

2016-01-07 Thread Tom Breloff
Depending on how much performance you need, you could do something like: _f(a::A, b::B, c::C) = ... function f(args...) a,b,c = A(1),B(1),C(1) for arg in args T = typeof(arg) if T <: A a = arg elseif T <: B b = arg elseif T <: C c = arg end end _f(a,b

[julia-users] How to define methods of rearranged arguments

2016-01-07 Thread Josh Day
Suppose I have a function that takes several arguments of different types and each has a default value. What is the best way to specify all possible methods where a user can specify an argument without entering the defaults that come before it? I don't want to force a user to remember the exac

[julia-users] Re: Confused about unmatching method signature

2016-01-07 Thread Marco Caramma
Thanks a lot Kristoffer! On Thursday, January 7, 2016 at 5:51:26 PM UTC, Kristoffer Carlsson wrote: > > First sentence should have been: > > A Dict{ASCIIString, Any}, is not a subtype off Dict{AbstractString, Any}. > > On Thursday, January 7, 2016 at 6:50:54 PM UTC+1, Kristoffer Carlsson > wrote:

[julia-users] Re: Confused about unmatching method signature

2016-01-07 Thread Kristoffer Carlsson
First sentence should have been: A Dict{ASCIIString, Any}, is not a subtype off Dict{AbstractString, Any}. On Thursday, January 7, 2016 at 6:50:54 PM UTC+1, Kristoffer Carlsson wrote: > > A Dict{AbstractString, Any}, is not a subtype off Dict{AbstractString, > Any}. You can read more about why a

[julia-users] Confused about unmatching method signature

2016-01-07 Thread Marco Caramma
Hi, I'm having trubles understanding why the following code generate 'method matching' errors. In my understanding this 2 signatures should be compatibles: function signature =>(::AbstractString, ::Array{Dict{AbstractString,Any },N}) call signature =>(::ASCIIString, ::Array{Dict{ASCIIStr

Re: [julia-users] Iterating over leafs of a tree: use Cartesian?

2016-01-07 Thread Asbjørn Nilsen Riseth
Thank you both. I'll have a look at a recursion approach. On Thursday, 7 January 2016 13:47:02 UTC, Tim Holy wrote: > > This is a problem for recursion. See, for example, the LightGraphs or > Graphs > packages. > > Best, > --Tim > > On Thursday, January 07, 2016 02:10:18 AM Asbjørn Nilsen Ri

[julia-users] Re: depsy.org

2016-01-07 Thread Jeffrey Sarnoff
Andreas, I find this on-topic. Depsy is built and run by Impactstory and funded by the National Science Foundation. They give as a contact email t...@impactstory.org. I sent a brief note as an interested third party (my tax dollars at work). Thanks, Jeffrey Sarnoff On Thursday, January 7, 2

[julia-users] Re: Operating with a Float64 on an Array of Real's gives an Array of Any's

2016-01-07 Thread Kristoffer Carlsson
An Int will be automatically converted to for example Float64 if you try to assign an int to a Float64 array. julia> a = Float64[1.0, 2.0] 2-element Array{Float64,1}: 1.0 2.0 julia> a[2] = 3 3 julia> a 2-element Array{Float64,1}: 1.0 3.0 On Thursday, January 7, 2016 at 4:20:55 PM UTC+1,

[julia-users] Re: How to detect an word starts with "\" in a text

2016-01-07 Thread Steven G. Johnson
On Thursday, January 7, 2016 at 2:51:54 AM UTC-7, Tomas Lycken wrote: > > Does this solve your problem? > > julia> startswith(haystack, needle) = haystack[1:length(needle)] == needle; > > This is wrong for Unicode needle strings (where length(needle) is not necessarily equal to the number of cod

[julia-users] Re: Operating with a Float64 on an Array of Real's gives an Array of Any's

2016-01-07 Thread amiksvi
A meaningful small test: julia> xr = Real[rand() for i = 1:1]; julia> xf = [rand() for i = 1:1]; julia> tic(); for n = 1:1000; xr += Real[rand() for i = 1:1]; end; toc() elapsed time: 5.51013855 seconds 5.51013855 julia> tic(); for n = 1:1000; xf += [rand() for i = 1:1]; end; to

[julia-users] Re: Operating with a Float64 on an Array of Real's gives an Array of Any's

2016-01-07 Thread amiksvi
Le jeudi 7 janvier 2016 16:15:56 UTC+1, Kristoffer Carlsson a écrit : > > Not sure why it promotes to Any but anyway, you most likely want to use x > = Float64[1.0, 2.0] or another concrete Real type unless you plan to mix > the type of the items in the array. > > The type Real is an abstract

[julia-users] Re: Pre-ANN: JuliaJS.jl

2016-01-07 Thread Eric Forgy
Mike, Cool! Glad it worked :) (Phew!) Tony, Yeah, this is just javascript in the browser. No node.js. Thanks :) On Thursday, January 7, 2016 at 10:34:38 PM UTC+8, Tony Kelman wrote: > > This is explicitly designed for interoperating with javascript in the > browser, not local js execution engi

Re: [julia-users] jl_call function in c++ code

2016-01-07 Thread Isaiah Norton
> > Can the output, jl_value_t* ret, point to more than one output argument? Only as a tuple or array, On Thu, Jan 7, 2016 at 12:26 AM, Shamika wrote: > Can the output, jl_value_t* ret, point to more than one output argument? > > On Wednesday, January 6, 2016 at 7:45:33 PM UTC+5:30, Stefan Kar

[julia-users] Re: Pre-ANN: JuliaJS.jl

2016-01-07 Thread Tony Kelman
This is explicitly designed for interoperating with javascript in the browser, not local js execution engines like node.js, right? Given how widely used node is, it might not be unambiguous to claim JSCall.jl for a browser specific interoperability package. Still, cool stuff.

Re: [julia-users] Question about "null/empty" values

2016-01-07 Thread Milan Bouchet-Valat
Le jeudi 07 janvier 2016 à 01:49 -0800, Tomas Lycken a écrit : > Two common options in many 0-indexed languages (Java and C#, to name > a couple of static ones; JavaScript and Python, to name a couple of > dynamic) is to return either -1 or length(iterator), i.e. either the > index before the first

[julia-users] Re: Iterating over leafs of a tree: use Cartesian?

2016-01-07 Thread Tomas Lycken
I don’t think so; your way of determining the loop ranges is a little bit too specific. The only two ways of generating loop bounds is either from a variable referencing an array (or array-like object), in which case the bounds will be determined by the size of the array, or with an anonymous

Re: [julia-users] Equivalent for Python .join() function

2016-01-07 Thread David Salamon
Hi Alex, I think you're looking for join. julia> join(1:10, " - ") "1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10" If you haven't tried it, :methodswith and :methods are both amazing command line functions. julia> methodswith(Array) 312-element Array{Method,1}: *{T,S}(s::Base.LinAlg.SVDOperator{T,S},

Re: [julia-users] One click execution of Julia program

2016-01-07 Thread Fred
In Thunar : Create a custom action within Thunar which will execute your shell script in a terminal window. Open Thunar > Edit > Configure custom actions... > Add a new custom action, then: - On the Basic Tab: - Name = ExecuteJulia - Description = ExecuteJulia - Command = "xfce4-te

[julia-users] Re: Pre-ANN: JuliaJS.jl

2016-01-07 Thread Michael Hatherly
Hi Eric, Are you planning for this to be a full-on JS interface? If so, would it make sense to follow the naming convention of some of the other interface packages like PyCall, RCall, and JavaCall? Perhaps JSCall? I wasn't able to get the plotly example, include(Pkg.dir("JuliaJS","exa

Re: [julia-users] One click execution of Julia program

2016-01-07 Thread Fred
I solved the problem :) In XFE (http://roland65.free.fr/xfe/) associate .jl files with /usr/bin/julia allows one click execution of Julia programs :) In Thunar, it seems to be much more difficult : https://bbs.archlinux.org/viewtopic.php?id=194464 Le jeudi 7 janvier 2016 10:29:57 UTC+1, Fred a

[julia-users] Re: Pre-ANN: JuliaJS.jl

2016-01-07 Thread Eric Forgy
Sorry. Small correction: callback["Run My Code Please"] = begin println("Ok! I will run your code.") # Your code here. end should be (of course): callback["Run My Code Please"] = () -> begin println("Ok! I will run your code.") # Your code here. end On Thursday, January 7, 201

Re: [julia-users] One click execution of Julia program

2016-01-07 Thread Fred
That's true, it seems to be related to the system. On my system, lightweight (XFCE), a double click open any executable Julia program in a text editor and I don't have the choice to execute in a terminal. But, if I run the program in a terminal using ./program.jl it works, indicating that the p

[julia-users] Pre-ANN: JuliaJS.jl

2016-01-07 Thread Eric Forgy
Hi, Yesterday, I posted a link to a new package StringInterpolation . That was a warmup for this one :) JuliaJS started life as PlotlyJS providing an i