[julia-users] Re: Adding new column to dataframe

2014-05-15 Thread Sam L
> df = DataFrame(A=rand(10), B=rand(10)) > df[:C] = df[:A] .+ df[:B] does the trick in DataFrames v0.5.4. On Thursday, May 15, 2014 7:59:54 PM UTC-7, Jason Solack wrote: > > So i feel like this a simple question, but i can't find reference to it. > > Lets say i have a DataFrame with columns A a

[julia-users] Adding new column to dataframe

2014-05-15 Thread Jason Solack
So i feel like this a simple question, but i can't find reference to it. Lets say i have a DataFrame with columns A and B and i want to add a new column C that is A+B. How would i do that? Sorry if i'm overlooking an easy answer! jason

[julia-users] Re: JuliaCon Question Thread

2014-05-15 Thread Viral B. Shah
There will be a bit of everything. It is certainly not experts only. -viral On Wednesday, May 14, 2014 1:08:55 AM UTC+5:30, G. Patrick Mauroy wrote: > > Will the conference target Julia experts with only advanced topics or will > it be appropriate/beneficial to newcomers and prospective ones who

Re: [julia-users] Re: build failure in vagrant/virtualbox?

2014-05-15 Thread S Wade
Yes I used those same build setting but got the same failure. The only difference is that I'm allowing make to download the packages rather than using the prebuilt ones. thanks, wade > On May 15, 2014, at 2:49 PM, Patrick O'Leary wrote: > > Have you checked the Vagrantfile (and README) in c

Re: [julia-users] for loops

2014-05-15 Thread Mike Innes
Ah, I see what you mean. I'm not sure if it's possible, though. You'd have to determine whether f() do ... meant "function with do block" or "iterator with do block", which isn't possible in general. So at least you'd need special syntax for it, and by that point it's probably easier to stick with

Re: [julia-users] for loops

2014-05-15 Thread Cameron McBride
Sure, Mike. But the idea is to have this for all iterator objects intrinsically rather than defining it for each function that returns an iterator. There is likely a way to do this automagically for all iterators, but my julia-fu isn't strong enough that it jumped out at me when I looked over som

Re: [julia-users] for loops

2014-05-15 Thread Mike Innes
Well, if you want the first syntax you can easily define Base.enumerate(f::Function, args...) = map(t->f(t...), enumerate(args...)) You could always open a pull request if you wanted to see this in Base, too. On Thursday, 15 May 2014 21:18:31 UTC+1, Cameron McBride wrote: > > I missed enumerate(

Re: [julia-users] for loops

2014-05-15 Thread Cameron McBride
I missed enumerate() for a while, and was happy I found it. I find it amusing how satisfying a few missing keystrokes can be. On a related but different note, from a similar influence, I keep wanting to pass blocks to iterators. Any chance that will ever happen? I realize that do..end blocks a

Re: [julia-users] purpose of the end keyword

2014-05-15 Thread Stefan Karpinski
Yes, the point about metaprogramming is a good one. On Thu, May 15, 2014 at 4:03 PM, Steven G. Johnson wrote: > It's a tradeoff. The cost of having an explicit "end" is a few extra > characters that you have to type, and an extra line of code at the end of > each block. On the other hand, the b

Re: [julia-users] purpose of the end keyword

2014-05-15 Thread Steven G. Johnson
It's a tradeoff. The cost of having an explicit "end" is a few extra characters that you have to type, and an extra line of code at the end of each block. On the other hand, the benefits include less error-prone cut-and-paste (as Stefan mentioned), the possibility of automated reformatting of

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Kevin Squire
FWIW, I really appreciate you pointing out the different uses of :: Toivo. Along with the different meanings of parameterizations in types and functions, this is another area I haven't been clear about (and I wasn't even aware of it until you pointed it out). Cheers! Kevin On Thu, May 15, 20

Re: [julia-users] purpose of the end keyword

2014-05-15 Thread Stefan Karpinski
It's a matter of taste – and the fact that we wanted Julia to feel familiar in particular to Matlab users (and to a lesser extent Ruby users). I personally don't like significant indentation. It gets really awkward and fiddly when you're trying to cut and paste into a terminal or into an editor. I'

Re: [julia-users] purpose of the end keyword

2014-05-15 Thread Dustin Lee
Thanks. I should probably have been more clear. I understand what it *is* doing. I'm just curious if there was a reason besides "taste" to choose that over whitespace significance. On Thursday, May 15, 2014 12:55:07 PM UTC-6, Stefan Karpinski wrote: > > The `end` keyword closes blocks. Python

Re: [julia-users] purpose of the end keyword

2014-05-15 Thread Stefan Karpinski
The `end` keyword closes blocks. Python uses indentation for this. In Julia indentation is not significant. On Thu, May 15, 2014 at 2:51 PM, Dustin Lee wrote: > Coming from python I've found that julias's "end" statement doesn't bother > me as much as I would have thought, but when I show some

[julia-users] purpose of the end keyword

2014-05-15 Thread Dustin Lee
Coming from python I've found that julias's "end" statement doesn't bother me as much as I would have thought, but when I show some code to my python colleagues this really annoys them. But this got me thinking, what *is* the purpose of "end". Is it just a taste issue, a way to make parsing e

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Toivo Henningsson
On Thursday, 15 May 2014 10:59:07 UTC+2, Tomas Lycken wrote: > > it silently uses :: in a different sense than anywhere else in the language > > > I started writing a reply here, but realized it would be more instructive > to have it as an IJulia notebook, where we can actually inspect the value

[julia-users] Re: build failure in vagrant/virtualbox?

2014-05-15 Thread Patrick O'Leary
Have you checked the Vagrantfile (and README) in contrib/vagrant? I don't exactly recall what all I ran into but I know I ended up relying on mostly system packages, ran into the AVX thing with VirtualBox, and had to work around the limitation that there are no symlinks in VirtualBox shared fol

[julia-users] Re: Fast, robust predicates with Julia

2014-05-15 Thread Toivo Henningsson
On Thursday, 15 May 2014 09:36:06 UTC+2, Ariel Keselman wrote: > > they are MIT licensed, no need for permission :) > Right, I missed that. Good :) > how efficient is Voroni construction using conic hulls, I think Qhull > which uses convex hulls is way slower than what I plan with the algor

Re: [julia-users] for loops

2014-05-15 Thread John Myles White
I kind of suspect Stefan, like me, would instinctively call this operation `each_with_index`. -- John On May 15, 2014, at 6:33 AM, Kevin Squire wrote: > One nice thing about Julia is that she borrows many (though not all) good > ideas from other languages. In this case, enumerate came from P

Re: [julia-users] Optimisation troubles

2014-05-15 Thread Adrian Cuthbertson
Hi Tom, I've had good use of NLopt with GP optimisation. I plan in due course to package and release the GP stuff I've been working on, but not for a few weeks yet. However, for now here are the functions I use for NLopt... function optinf(gp::GPmodel, maxopt; algo=:LD_LBFGS, l_b=Float64[],u_b=Fl

[julia-users] Re: Macro question

2014-05-15 Thread Abe Schneider
That works, thanks! On Thursday, May 15, 2014 8:00:29 AM UTC-4, Mike Innes wrote: > > Oh, the other thing I should point out (sorry to post repeatedly) is that > the macro hygiene pass will mean that `foo` is not actually defined by this > macro. You probably want: > > macro createVar(name, va

[julia-users] Re: Macro question

2014-05-15 Thread Abe Schneider
You are correct -- it's weird, because I'm sure I tested it several times before posting, but I now get '5', as you suggest. On Thursday, May 15, 2014 7:51:15 AM UTC-4, Mike Innes wrote: > > I think your second snippet must have gotten a bit muddled, since `expr` > should end up with the value 5

Re: [julia-users] for loops

2014-05-15 Thread Yakir Gagnon
Love the Lazy thing, I'm real tempted to use lazy more, will do once I'm more sure of what I'm doing. Yakir Gagnon The Queensland Brain Institute (Building #79) The University of Queensland Brisbane QLD 4072 Australia cell +61 (0)424 393 332 work +61 (0)733 654 089 On Thu, May 15, 2014 at 11:3

Re: [julia-users] for loops

2014-05-15 Thread Yakir Gagnon
OMG. So awesome! Thanks!!! Yakir Gagnon The Queensland Brain Institute (Building #79) The University of Queensland Brisbane QLD 4072 Australia cell +61 (0)424 393 332 work +61 (0)733 654 089 On Thu, May 15, 2014 at 11:33 PM, Kevin Squire wrote: > One nice thing about Julia is that she borrows

Re: [julia-users] for loops

2014-05-15 Thread Mike Innes
You may also be interested in zip: for (file, i) in zip(files, 1:length(files)) println(file, " ", i) end # Even better: using Lazy for (file, i) in zip(files, range()) println(file, " ", i) end Enumerate is definitely the best solution here, but zip is more general if you find yourself bu

Re: [julia-users] for loops

2014-05-15 Thread Kevin Squire
One nice thing about Julia is that she borrows many (though not all) good ideas from other languages. In this case, enumerate came from Python (although it likely has other incarnations). Cheers! Kevin On Thursday, May 15, 2014, Billou Bielour wrote: > I was thinking the same thing the other

Re: [julia-users] for loops

2014-05-15 Thread Billou Bielour
I was thinking the same thing the other day, when using *for x in xs* I often find myself needing an index at some point and then I have to change the for loop, or write an index manually. Enumerate is exactly what I need in this case. +1 for Julia

Re: [julia-users] for loops

2014-05-15 Thread Michele Zaffalon
What about enumerate: http://docs.julialang.org/en/latest/stdlib/base/?highlight=enumerate#Base.enumerate? On Thu, May 15, 2014 at 2:48 PM, Yakir Gagnon <12.ya...@gmail.com> wrote: > I love the > for file in files > ... do something with file ... > end > > syntax. But sometimes it's really usefu

[julia-users] for loops

2014-05-15 Thread Yakir Gagnon
I love the for file in files ... do something with file ... end syntax. But sometimes it's really useful to be able to have an iterator accessible in the for loop, like: for file in files ... do something with file ... ... and with i that equals find(file == files) ... end Is there something

[julia-users] Re: ODBC query: arrayset not defined

2014-05-15 Thread Andrew B. Martin
Thanks for your response Jacob! I'm still getting the error, so I'll open an issue. Cheers, Andrew

[julia-users] Re: Macro question

2014-05-15 Thread Mike Innes
Oh, the other thing I should point out (sorry to post repeatedly) is that the macro hygiene pass will mean that `foo` is not actually defined by this macro. You probably want: macro createVar(name, value) quote $(esc(name)) = $value; end end See the hygiene

Re: [julia-users] Re: [ANN] Julia + Light Table!

2014-05-15 Thread Marcus Kriele
To me it looks as if the shell unquotes your argument and then interprets your string as two strings, "/Users/feldt/Library/Application " and "Support/LightTable/plugins/Jewel/jl/init.jl". I would try to copy the folder "LightTable" and all its contents to a location without spaces in the path

[julia-users] Re: Macro question

2014-05-15 Thread Mike Innes
Alternatively macroexpand(:@createVar(foo, 5)) Might have the desired behaviour. On Thursday, 15 May 2014 12:51:15 UTC+1, Mike Innes wrote: > > I think your second snippet must have gotten a bit muddled, since `expr` > should end up with the value 5. > > macro createVar(name, value) > quote

[julia-users] Re: Macro question

2014-05-15 Thread Mike Innes
I think your second snippet must have gotten a bit muddled, since `expr` should end up with the value 5. macro createVar(name, value) quote $name = $value; end end expr = @createVar foo 5 # This is equivalent to `expr = (foo = 5)`, *not* `expr = :(foo = 5)` expr == 5 If you do want `cr

Re: [julia-users] Optimisation troubles

2014-05-15 Thread Hans W Borchers
Which of the optimization solvers in NLopt are you talking about, there are many. I am a contributor to the 'nloptr' R package and my experience is that most/all of the solvers in NLopt are accurate and more reliable than any of the (many!) optimization functions in R. PS: Might be better to

[julia-users] Macro question

2014-05-15 Thread Abe Schneider
As an experiment I wrote a simple macro to set a variable: macro createVar(name, value) eval(quote $name = $value; end) end which works as expected: @createVar foobar 5; println("foobar = $foobar"); # "foobar = 5" (OK) However, if I instead do: macro createVar(name, value) quote

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Mauro
> Although instructive, that example is almost identical to the corresponding > doc section > (http://julia.readthedocs.org/en/latest/manual/methods/#parametric-methods) > so I doubt I could add much value other than a link to the docs ;) But isn't, for instance, your first examples also in the

Re: [julia-users] Optimisation troubles

2014-05-15 Thread Tim Holy
I've had similar experiences. For me, Optim.jl is currently somewhat more reliable than NLopt, although it's not as if Optim.jl is without its problems. I confess I haven't tried hard to track down what's happening with NLopt. In Optim, there's a branch, teh/constrained, which contains some not-

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Tomas Lycken
Although instructive, that example is almost identical to the corresponding doc section (http://julia.readthedocs.org/en/latest/manual/methods/#parametric-methods) so I doubt I could add much value other than a link to the docs ;) // T On Thursday, May 15, 2014 11:39:53 AM UTC+2, Mauro wrote:

[julia-users] Optimisation troubles

2014-05-15 Thread Tom Nickson
Hi all, I am trying to optimise the log-likelihood of the Gaussian Process. This is a straight port of some code form MATLAB, so I know the gradients are correct. Using Optim.jl I don't have too many problems (I was one told "dphia < 0" however I can't replicate it). Using NLopt, which the doc

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Mauro
This is a good summary, cheers. Maybe you include an example of a parametric function as well as was discussed in this tread earlier? For instance: julia> foofoo{T<:Real}(x::T,y::T) = x foofoo (generic function with 1 method) julia> barbar(x::Real,y::Real) = x barbar (generic function with 1 me

Re: [julia-users] Trouble with Type Parameters

2014-05-15 Thread Tomas Lycken
> > it silently uses :: in a different sense than anywhere else in the language I started writing a reply here, but realized it would be more instructive to have it as an IJulia notebook, where we can actually inspect the values of various statements along the way - take a look here instead:

[julia-users] Re: Fast, robust predicates with Julia

2014-05-15 Thread Ariel Keselman
they are MIT licensed, no need for permission :) how efficient is Voroni construction using conic hulls, I think Qhull which uses convex hulls is way slower than what I plan with the algorithms described in here: http://arxiv.org/pdf/0901.4107v3.pdf