[julia-users] Create formatted string

2014-04-12 Thread Dominique Orban
Sorry if this is a RTFM, but I can't find the answer in the documentation or on the web. I may have missed it. I come from Python where I can build strings with formatted data using a syntax like s = pi=%7.1e % acos(-1) How do I accomplish that in Julia? @printf doesn't do the job because it

Re: [julia-users] Create formatted string

2014-04-12 Thread John Myles White
@sprintf On Apr 11, 2014, at 11:18 PM, Dominique Orban dominique.or...@gmail.com wrote: Sorry if this is a RTFM, but I can't find the answer in the documentation or on the web. I may have missed it. I come from Python where I can build strings with formatted data using a syntax like s =

Re: [julia-users] Create formatted string

2014-04-12 Thread Dominique Orban
Thank you! Such a basic operation could feature a bit more prominently in the documentation. On Friday, April 11, 2014 11:21:28 PM UTC-7, John Myles White wrote: @sprintf On Apr 11, 2014, at 11:18 PM, Dominique Orban dominiq...@gmail.comjavascript: wrote: Sorry if this is a RTFM, but

Re: [julia-users] Create formatted string

2014-04-12 Thread Dominique Orban
As a follow-up question, why is the following not allowed? julia fmt = %8.1e; julia @sprintf(fmt, 3.1415) ERROR: first or second argument must be a format string I don't see how it's different from julia @sprintf(%8.1e, 3.1415) What's the appropriate syntax? Thanks. On Friday, April 11,

Re: [julia-users] Create formatted string

2014-04-12 Thread John Myles White
@sprintf is a macro, not a function. It doesn't evaluate its inputs: it just rewrites the inputs into something else (usually less readable) that carries out the actual computation. You can see what it does using the macroexpand function: julia macroexpand(quote @sprintf(%8.1e, 3.1415) end)

Re: [julia-users] Create formatted string

2014-04-12 Thread Mike Innes
That @sprintf is a macro sort of explains why using a run-time value doesn't work in the same way, but it isn't really *the* reason since @sprintf(fmt, val) could work in principle – it would just have to delegate to a function if its argument isn't a compile-time string. If using a run-time

Re: [julia-users] Create formatted string

2014-04-12 Thread Milan Bouchet-Valat
Le samedi 12 avril 2014 à 04:11 -0700, Mike Innes a écrit : That @sprintf is a macro sort of explains why using a run-time value doesn't work in the same way, but it isn't really the reason since @sprintf(fmt, val) could work in principle – it would just have to delegate to a function if its

Re: [julia-users] Function naming idioms in Julia

2014-04-12 Thread Mike Innes
This is something of an unsolved problem at the moment, but one way to explore is methodswith(AType). If you're looking for more flexible function chaining, I recommend having a look at the threading macros in Lazy.jlhttps://github.com/one-more-minute/Lazy.jl#macros . On Saturday, 12 April

[julia-users] Re: Online Database + IDE for Julia

2014-04-12 Thread Simon Danisch
Well, the answer to this is pretty long... I'd really like to keep things short, but I'm afraid I can't explain, why I think that this project is relevant in a short summary. I'm not naive enough to think that two people could pull off something big like this. But that's why you do things Open

[julia-users] ConfParser.jl

2014-04-12 Thread Brandon Miller
Hello, I am new to the Julia community and am developing a package for parsing configuration files styled in INI, HTTP, and Simple syntaxes. I am in the process of cleaning it up and plan to add config file write logic as well. At the moment, the parsing portion of the package is complete, so

[julia-users] problem installing JuMP

2014-04-12 Thread Stéphane Laurent
Hello, I have just installed JuMP but impossible to use it. If I type julia import JuMP then Julia is freezed, even after 5 minutes nothing happens. MathProgBase has been installed too and I have no problem to load it. *julia versioninfo()* *Julia Version 0.2.0* *Commit 05c6461

Re: [julia-users] Function naming idioms in Julia

2014-04-12 Thread Ethan Anderes
I often use |. You can get multiple args to work with x... and anonymous functions. function foo(a,b) a * b end x = (3,4) | x-foo(x...) | x-foo(x,7) x == foo(foo(3,4),7) # true Is this what you were looking for?

Re: [julia-users] Re: How to use GLPK.exact ?

2014-04-12 Thread Stéphane Laurent
Thank you everybody. I have updated my blog posthttp://stla.github.io/stlapblog/posts/KantorovichWithJulia.html, especially to include Carlo's comments. Unfortunately I have some problems to use JuMP (I have opened another discussion about it). And installing pycddlib on Windows 64bit is a

Re: [julia-users] Function naming idioms in Julia

2014-04-12 Thread Ethan Anderes
@jason-sage You can use methodswith to discover methods on a type. I find it doesn't work a smoothly as pythons tab completion but I still find it useful. julia type Parm a::Float64 b::Int64 end julia function addparm(x::Parm, y::Parm)

Re: [julia-users] Function naming idioms in Julia

2014-04-12 Thread Jason Grout
On 4/12/14, 10:59, Ethan Anderes wrote: @jason-sage You can use methodswith to discover methods on a type. I find it doesn't work a smoothly as pythons tab completion but I still find it useful. Ethan and Mike, Thanks for pointing out methodswith. I didn't know about that. Jason

[julia-users] HypothesisTests question

2014-04-12 Thread Iain Gallagher
Hi I'm new to julia - test driving as it were. I'm trying to carry out a Mann-Wihtney U test on two columns of a DataFrame. # data available at http://www.openintro.org/download.php?file=os2_datareferrer=/stat/extras.php using DataFrames data_in = readtable(marathon.csv, header=true,

[julia-users] Re: HypothesisTests question

2014-04-12 Thread Simon Kornblith
There was a missing method for ApproximateMannWhitneyUTest. If you run Pkg.update(), this should be fixed. (I also added some tests to make sure that show() isn't completely broken for any of the types.) Simon On Saturday, April 12, 2014 12:29:22 PM UTC-4, Iain Gallagher wrote: Hi I'm new

[julia-users] Re: GPU computing

2014-04-12 Thread Deepraj Paul
Can the combo of PyCall in Julia be Interfaced with PyCUDA effectively !! On Friday, April 11, 2014 9:31:16 PM UTC+5:30, Jake Bolewski wrote: Hi Gexarcha, I'm the author of the OpenCL package for Julia. Although things have stalled lately do to other commitments, I think we are slowly

[julia-users] Re: Talk on numerical algorithms in Julia at UCL, 4/14

2014-04-12 Thread Deepraj Paul
Well, I am interested in it. Will it be available online ! on Youtube ! On Friday, April 11, 2014 5:07:40 PM UTC+5:30, Jiahao Chen wrote: I will be giving a talk in London to introduce how Julia facilitates the writing of numerical algorithms. University College London Roberts Building,

[julia-users] Re: problem installing JuMP

2014-04-12 Thread Iain Dunning
Does the same thing happen if you do `using JuMP`? On Saturday, April 12, 2014 10:05:12 AM UTC-4, Stéphane Laurent wrote: Hello, I have just installed JuMP but impossible to use it. If I type julia import JuMP then Julia is freezed, even after 5 minutes nothing happens. MathProgBase

[julia-users] Re: ConfParser.jl

2014-04-12 Thread Iain Dunning
Possibly worth comparing functionality with https://github.com/JuliaLang/IniFile.jl On Saturday, April 12, 2014 12:49:00 AM UTC-4, Brandon Miller wrote: Hello, I am new to the Julia community and am developing a package for parsing configuration files styled in INI, HTTP, and Simple

[julia-users] A project for compact expressiveness

2014-04-12 Thread Jeff Waller
TL;DR Let's start with some golfing http://codegolf.stackexchange.com/. Compact Expressiveness: A term I've coined; maybe it already exists, but don't bother looking it up, I didn't, In the case of programming languages, loosely, I'm talking about getting the most out of fewest number of

[julia-users] Re: problem installing JuMP

2014-04-12 Thread Stéphane Laurent
Yes. Moreover the solver packages (Clp, ...) are not correctly built, but this is expected on windows 64bit with the 64bit version of Julia: https://jump.readthedocs.org/en/release-0.4/jump.html Thus I should try Julia 32bit anyway. Le samedi 12 avril 2014 22:07:20 UTC+2, Iain Dunning a

Re: [julia-users] A project for compact expressiveness

2014-04-12 Thread Stefan Karpinski
Making STDIN consistently the default input stream and STDOUT consistently the default output stream is right – any inconsistency there is just an oversight. Could you open an issue? I don't care for the renaming to readln myself. I've often considered the idea that lines should be chomped by

[julia-users] Create formatted string

2014-04-12 Thread Kevin Squire
I have a port of a BSD printf function which works at about half the speed of the @printf macro. I was hoping to make it more functional/less ugly, but I'll see if I can't get it into a pull request, at least, or in a package if it's not accepted. I'll also point out Dahua's Formatting.jl

Re: [julia-users] Function naming idioms in Julia

2014-04-12 Thread Spencer Russell
In a recent discussion on inserting unicode characters we talked about the idea of tab-substitution (instead of vanilla tab-completion), so that when you type something and hit tab you have options that might replace what you've typed so far. This could be extended to this use-case as well, so

Re: [julia-users] A project for compact expressiveness

2014-04-12 Thread Jeff Waller
On Saturday, April 12, 2014 6:02:44 PM UTC-4, Stefan Karpinski wrote: Making STDIN consistently the default input stream and STDOUT consistently the default output stream is right – any inconsistency there is just an oversight. Could you open an issue? I don't care for the renaming to

Re: [julia-users] A project for compact expressiveness

2014-04-12 Thread Stefan Karpinski
The issue is good, thanks. Another option would be to return a tuple of (line, nl) and just let people either ignore the newline part or use it. Then doing println(line) would standardize line endings while print(line,nl) would reproduce the input exactly. On Apr 12, 2014, at 7:26 PM, Jeff

Re: [julia-users] A project for compact expressiveness

2014-04-12 Thread Peter Simon
How about leaving readline as it now is and defining readln() to be chomp(readline())? On Saturday, April 12, 2014 4:26:48 PM UTC-7, Jeff Waller wrote: On Saturday, April 12, 2014 6:02:44 PM UTC-4, Stefan Karpinski wrote: Making STDIN consistently the default input stream and STDOUT

Re: [julia-users] A project for compact expressiveness

2014-04-12 Thread Jeff Waller
On Saturday, April 12, 2014 7:50:16 PM UTC-4, Peter Simon wrote: How about leaving readline as it now is and defining readln() to be chomp(readline())? That works, and it's backwards compatible. It's a little confusing, though, because there's 2 read a line functions and which one to use

[julia-users] Julia interface to the AMPL modeling language

2014-04-12 Thread Dominique Orban
I just put together a few C and Julia files that let users read models in the AMPL modeling language for optimization. https://github.com/dpo/ampl.jl It's not quite a module or a package; please bear with me as I'm still learning Julia. This gives access to a huge collection of problems

Re: [julia-users] Help with PyPlot -- How to change the aspect ratio of a plot

2014-04-12 Thread Adrian Cuthbertson
Hi Daniel, this worked for me in IJulia... using PyPlot using PyCall img = imread(ada.png); fig = plt.figure() ax = plt.Axes(fig,[0,0,1,1]) fig[:add_axes](ax) ax[:set_axis_off]() ax[:imshow](img,aspect=auto) ax[:set_aspect](0.5) plt.show() Adrian. On Sun, Apr 13, 2014 at 12:08 AM, Daniel

[julia-users] Re: Julia interface to the AMPL modeling language

2014-04-12 Thread Tony Kelman
Hey Dominique, This is great! I've been hoping someone would put something like this together. I was just talking about this (among other things) with Miles over in julia-opt https://groups.google.com/forum/#!topic/julia-opt/CFyxCfjeOCw Since there's so much overlap between what AMPL does and