Re: [julia-users] Re: Default behavior from omitted catch block when a finally block is added.

2015-04-08 Thread Harry Sungod
Lex, I am fine not having the terse syntax of #1. In fact I am not asking why f2() threw an exception. I was only worried why the syntax of f1() lays a trap for me that I will fall in to later. In other languages I am familiar with, finally is orthogonal to what happens inside catch (or

Re: [julia-users] Re: Default behavior from omitted catch block when a finally block is added.

2015-04-08 Thread elextr
On Wednesday, April 8, 2015 at 3:08:53 PM UTC+10, Toivo Henningsson wrote: I think you are right that this is deliberate, but I also think that making catch and finally orthogonal to each other should trump such case by case optimizations. It would allow a simpler mental model of the

Re: [julia-users] Re: Default behavior from omitted catch block when a finally block is added.

2015-04-08 Thread Mauro
If we require a 'catch' block for every try, it would be cleaner. Otherwise I suggest we had a note in the documentation to state the caveats. Particularly for those who come from other background and get too excited about try end terse syntax. I would be happy to make some edits in the

Re: [julia-users] Extreme garbage collection time

2015-04-08 Thread cdm
just a moment to applaud this exemplary thread !!! excellent closing post ... love the Julia community. best, cdm

[julia-users] Why enumerate and zip are realized by different types?

2015-04-08 Thread Jinxuan Zhu
Recently, I am interested about the two functions enumerate(iter) and zip(iter). So I read the iterator.jl and find they are realized by different Types. I thought the enumerate was an alias like zip([1:length(a)], a), however it is not. I am curious that why the two functions are realized by

Re: [julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Tim Holy
In a sense, a SharedArray should act like an Array if you're using a single core. I'm not saying all methods have been implemented for them, but if the code runs then it certainly shouldn't give different answers. So I'd say this is a bug. So now that we know it's a bug, I'd urge you to file

Re: [julia-users] A method with an optional parameter may result in a different method being called

2015-04-08 Thread Daan Huybrechs
Thanks, Seth, that example looks even stranger than what I encountered. I have suggested adding a short paragraph to the manual: https://github.com/JuliaLang/julia/pull/10769 I can't think of a case where the author of code would like a default value of a method to be used in another method

[julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Simon Danisch
Excuse my ignorance Tim! I just don't allow myself to waste too much time on this, so that I'm not looking into things very deeply. This indeed solves the issue in a slightly different way. I think we can definitely reuse more of what Images is currently doing. It makes a lot of sense to switch

Re: [julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Tim Holy
No criticism intended, I just wanted to save you (or anyone else) time :-). I agree that it's also a great opportunity to refactor, and (without taking the time to think about it too deeply) your suggestions seem very reasonable. Best, --Tim On Wednesday, April 08, 2015 07:23:40 AM Simon

[julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Patrick O'Leary
I understand *why* you're using them; the question is whether they're broken or not. One way to figure that out is to not use them and see if you still get the weird behavior. (No worries on the response speed, this is your issue after all!) On Wednesday, April 8, 2015 at 7:57:54 AM UTC-5,

[julia-users] A method with an optional parameter may result in a different method being called

2015-04-08 Thread Daan Huybrechs
I was a little surprised today by the following behaviour: julia f(d=2) = d f (generic function with 2 methods) julia f(a::Int) = -a f (generic function with 3 methods) julia f() -2 julia methods(f) # 3 methods for generic function f: f() at none:1 f(a::Int64) at none:1 f(d) at none:1 Yet,

Re: [julia-users] Holt-Winters D-E Smoothing in Julia

2015-04-08 Thread Tom Short
Given the lack of replies, I'd guess that the answer is no. Searching holt-winters julia jl didn't turn up anything. Your options might be: * Use RCall to call the function in R. RCall is still rather young. * Use PyCall to call a function in Python. PyCall is fairly mature. * Implement your

Re: [julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Tim Holy
Images has (I think) basically already solved this problem. The way it uses magic numbers is described at https://github.com/timholy/Images.jl/blob/master/doc/extendingIO.md For the example (a SIF) file, the magic bytes are enclosed in that bAndor Technology Multi-Channel File string. --Tim On

Re: [julia-users] A method with an optional parameter may result in a different method being called

2015-04-08 Thread Seth
That is a bit surprising indeed. Maybe worth an addition to http://docs.julialang.org/en/latest/manual/methods/#note-on-optional-and-keyword-arguments ? It's not only surprising, I'd consider it (absent a real reason why it should be this way) incorrect. Once you've decided which

Re: [julia-users] Why enumerate and zip are realized by different types?

2015-04-08 Thread Stefan Karpinski
That implementation has a few drawbacks: it allocates a vector of indices the length of what it's iterating over; it has to know in advance how long what it's iterating over is; it is more complicated, leading to more complex machine code. On Wed, Apr 8, 2015 at 4:51 AM, Jinxuan Zhu

[julia-users] Re: [ANN] JuliaIO and FileIO

2015-04-08 Thread Simon Danisch
This is half true. Magic numbers are only used in ImageMagick.jl per accident, as that's how the underlying C-library does things. To be honest, I haven't looked at the details yet myself, as I mostly copy and pasted code to get a first prototype running. I sketch out in FileIO.jl#3

[julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Nils Gudat
Hi Patrick, Sorry for the late reply (Easter and all that)! The problem with using Arrays in the code above is that they're not available for remote processes to write on, so I'd have to come up with a more complicated structure of passing computations and results around. The whole appeal of

Re: [julia-users] A method with an optional parameter may result in a different method being called

2015-04-08 Thread Mauro
On Wed, 2015-04-08 at 15:34, Daan Huybrechs daan.huybre...@gmail.com wrote: I was a little surprised today by the following behaviour: julia f(d=2) = d f (generic function with 2 methods) julia f(a::Int) = -a f (generic function with 3 methods) julia f() -2 julia methods(f) # 3

[julia-users] Re: Default behavior from omitted catch block when a finally block is added.

2015-04-08 Thread Jan van Oort
there is something to be said for the explicitness that comes with only catching exceptions when there is a catch keyword involved. Absolutely. Please go that way. It would be even better to make a catch mandatory with each try, in order to ( as someone else here said ) ease the load on

[julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Kristoffer Carlsson
I come from a Python background where direct access to fields in for example classes with the dot notation is very common. However, from what I have seen in different conversations, accessing fields directly is not really Julian. Sort of a fields are an implementation detail mindset, and what

Re: [julia-users] Short question about type alias with partially known parameter types

2015-04-08 Thread Kristoffer Carlsson
Thank you for the code and the pull request link. Very interesting. On Tuesday, April 7, 2015 at 8:55:34 PM UTC+2, Mauro wrote: In 0.3 it's not possible in 0.4 this works: julia type A{T,P} a::T end julia typealias B{T} A{T, 1} A{T,1} julia call{T}(::Type{B},

Re: [julia-users] A method with an optional parameter may result in a different method being called

2015-04-08 Thread Daan Huybrechs
On Wednesday, April 8, 2015 at 3:52:44 PM UTC+2, Mauro wrote: On Wed, 2015-04-08 at 15:34, Daan Huybrechs daan.hu...@gmail.com javascript: wrote: I was a little surprised today by the following behaviour: julia f(d=2) = d f (generic function with 2 methods) julia f(a::Int) =

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Tim Holy
It's a matter of taste, really, but in general I agree that the Julian way is to reduce the number of accesses to fields directly. That said, I do sometimes access the fields. However, your iterator example is a good opportunity to illustrate a more julian approach: mesh = mesh(...) for

Re: [julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Nils Gudat
Apologies again for being a little slow (mentally now, not in terms of response time); by trying an Array you mean running the code in single-core mode and using an Array instead of a SharedArray? Running it in parallel with a regular Array (unsurprisingly) doesn't work. So I have: Single

Re: [julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Tim Holy
Sounds like a bug, but I think what Patrick was trying to say is that it would help to test it with Arrays first just to make sure there's not some problem with your code. Assuming that it works for Arrays but not for SharedArrays, then you should probably file an issue. Best, --Tim On

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Mauro
Can you comment on the performance implications of directly accessing fields vs your approach? I'm guessing that directly accessing the fields would be faster? I think usually it should get inlined and there is no difference: julia immutable A a::Int end julia function

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Kristoffer Carlsson
Thank you Tim for your suggestion about creating functions returning iterators. That sounds indeed like a very clean way to do it. Mauro, thanks for the link. I read the paper by Logg and it seems interesting. Do you have any references for how the mapping from the cells to the actual finite

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Mauro
Mauro, thanks for the link. I read the paper by Logg and it seems interesting. Do you have any references for how the mapping from the cells to the actual finite elements is done? No, I never got that far. But it doesn't contain any nodes, so presumably those are all separate from the

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Mauro
Nat and I once started on a mesh library which implements some of that: https://bitbucket.org/maurow/mesh.jl but it has gone a bit stale. In the spirit of Tim's response, it defines a big mesh datatype and then helper dataytpes, for instance Vertices, which are just a thin wrapper around the

Re: [julia-users] Re: Unexpected behaviour when running parallelized code on single worker

2015-04-08 Thread Patrick O'Leary
Thank you Tim for explaining that more clearly. This morning's reply was ENOCOFFEE :D Please do file an issue, Nils, and thanks for investigating further. On Wednesday, April 8, 2015 at 10:03:04 AM UTC-5, Tim Holy wrote: Sounds like a bug, but I think what Patrick was trying to say is that it

Re: [julia-users] Holt-Winters D-E Smoothing in Julia

2015-04-08 Thread Philip Tellis
Thank you.

Re: [julia-users] Direct access to fields in a type, unjulian?

2015-04-08 Thread Phil Tomson
On Wednesday, April 8, 2015 at 8:00:42 AM UTC-7, Tim Holy wrote: It's a matter of taste, really, but in general I agree that the Julian way is to reduce the number of accesses to fields directly. That said, I do sometimes access the fields. However, your iterator example is a good

[julia-users] code review: my first outer constructor :)

2015-04-08 Thread Andrei Berceanu
Hi guys! Here is [part of] some code I recently wrote for solving a physics problem: https://gist.github.com/berceanu/010d331884848205acef It's the first time I try to use Julia constructors properly (or improperly?!) so I need your opinion on a couple of points. 1. On Julia's IRC channel I was

Re: [julia-users] Usage of floating point template arguments with many different values

2015-04-08 Thread Sheehan Olver
It already is Interval{Float64}. The issue is choosing defaults for a and b which aren't inferrable from the type. I think I'm convinced that just using NaN should work, with other domains having a similar representation for parameters not set. Sent from my iPhone On 9 Apr 2015, at 6:41 am,

Re: [julia-users] Re: Default behavior from omitted catch block when a finally block is added.

2015-04-08 Thread Harry B
I have put in a pull request for a documentation change related to this https://github.com/JuliaLang/julia/pull/10776 Please note it contains a few more edits that seemed appropriate. Please approve or let me know what needs to change. I would be happy to amend the documentation again if you

[julia-users] merged arrays?

2015-04-08 Thread Sebastian Good
I can use sub to pretend a larger array is a smaller, or differently shaped one. Is there functionality to allow me to treat several smaller arrays as a larger one without copying them? In effect, mimicking hcat and friends, but without copying data.

[julia-users] Re: CALL FOR PARTICIPATION: JuliaCon 2015, June 24-28, MIT

2015-04-08 Thread Jiahao Chen
Proposal submission deadline extended by popular request to *Sunday, April 12 at 11:59pm EDT*.

Re: [julia-users] merged arrays?

2015-04-08 Thread Kevin Squire
AFAIK, there's nothing really like that right now, but what do you plan to do with the data? Most linear algebra code, for example, calls out to BLAS, which requires data to be contiguous (or at least strided) in memory. Other code may or may not have this same restriction. It should be

Re: [julia-users] Usage of floating point template arguments with many different values

2015-04-08 Thread Steven G. Johnson
On Tuesday, April 7, 2015 at 5:53:09 PM UTC-4, Sheehan Olver wrote: The current problem is f=Fun(x-x^2,Chebyshev(Interval(a,b))) represents a function on [a,b] as type Fun{Float64,Chebyshev}. But sometimes one needs to convert numbers to functions a la