Re: [julia-users] Implicit call problem

2016-02-28 Thread Julia Tylors
state_info is basically a dictionary holding type State s::Dict{C,A} #some other code end @special macro creates a state_info for each function it precedes. maybe i can define +(x::C,y::C,state) and curry this for each function using @special macro. However , +(::C,::C,::State) function seem

Re: [julia-users] Re: Non-uniform interpolation in 1D

2016-02-28 Thread Tomas Lycken
Higher than linear order interpolation on irregular grids is not supported in either Grid.jl or Interpolations.jl (and since the latter is a replacement for the former, it probably never will be supported in Grid). If you have a good scheme that you'd like to see implemented, do file an issue wi

Re: [julia-users] Make the computer make a beep?

2016-02-28 Thread FQ
No i can't show you the two-liner, because it was Mike who suggested that and i have no idea ^^ If you don't care where the beep comes from, you could also use the AudioIO package and just let your normal speaker play the beep using AudioIO play([sin(x) for x=0:0.03*pi:441]) according to the doc

[julia-users] Re: Real-time user input

2016-02-28 Thread Christoph Ortner
thank you - I will have a look. Christoph On Saturday, 27 February 2016 23:33:31 UTC, Simon Danisch wrote: > > You could try GLVisualize... There is the mario example to get you > started: http://www.glvisualize.com/examples/interactive/

[julia-users] Globally enable / disable @time execution

2016-02-28 Thread Adrian Salceanu
I have an application that runs in 2 environments, DEV and PROD. While running in DEV I'd like to see @time information for different expressions. But not in PROD. Any ideas about how can this be done so that I don't end up littering my code with conditionals, such as: if DEV @time expr el

[julia-users] Re: Globally enable / disable @time execution

2016-02-28 Thread Kristoffer Carlsson
Maybe something like: if DEV macro devtime(ex) @time ex end else macro devtime(ex) esc(ex) end end And then use @devtime instead of @time On Sunday, February 28, 2016 at 4:03:23 PM UTC+1, Adrian Salceanu wrote: > > I have an application that runs in 2 environment

[julia-users] Re: Globally enable / disable @time execution

2016-02-28 Thread Adrian Salceanu
Perfect, thank you very much! duminică, 28 februarie 2016, 16:09:36 UTC+1, Kristoffer Carlsson a scris: > > Maybe something like: > > if DEV > macro devtime(ex) > @time ex > end > else > macro devtime(ex) > esc(ex) > end > > end > > And then use @devtime instead of

[julia-users] Re: Globally enable / disable @time execution

2016-02-28 Thread Toivo Henningsson
I think you want to change the first case to macro devtime(ex) quote @time $(esc(ex)) end end right?

[julia-users] Defining a new numeric type with minimal effort

2016-02-28 Thread Kevin Kunzmann
Hey, I have a (probably) very simple question. I would like to define 'Probability' as a new subtype of 'Real', only with the additional restriction that the value must be between 0 and 1. How would I achieve that 'Julia-style'? This should be possible without having to rewrite all these promo

[julia-users] Re: Globally enable / disable @time execution

2016-02-28 Thread Adrian Salceanu
Indeed, I was now trying to debug Kristoffer's solution myself, as using the macro was throwing an UndefVarError This works perfectly, many thanks! duminică, 28 februarie 2016, 16:31:31 UTC+1, Toivo Henningsson a scris: > > I think you want to change the first case to > > macro devtime(ex) >

Re: [julia-users] reading compressed csv file?

2016-02-28 Thread ivo welch
hi tony---thanks. I will keep an eye on the docs (presumably streams). from a novice end-user (not developer) perspective, solving the specific snippet that I noted would be great in the documentation pages. regards, /iaw Ivo Welch (ivo.we...@gmail.com) http://www.ivo-welch.info/ J. Fred

[julia-users] Re: ANN: JuMP 0.12 released

2016-02-28 Thread Sisyphuss
Given that JuMP and Convex.jl are both AMLs, I always don't understand the difference between them. On Saturday, February 27, 2016 at 11:14:16 PM UTC+1, Miles Lubin wrote: > > The JuMP team is happy to announce the release of JuMP 0.12. > > This release features a complete rewrite of JuMP's auto

Re: [julia-users] Re: Non-uniform interpolation in 1D

2016-02-28 Thread Uwe Fechner
Hello, thanks for your explanations. Nevertheless I like the syntax of the package Dierckx much more. The expression Gridded(Linear()) is very confusing for me. What is gridded, in this example? Furthermore the Readme file of Interpolations is missing the information, how to use it for the give

[julia-users] Scalar and array version of a function

2016-02-28 Thread Uwe Fechner
Hello, what is the best way to implement a scalar and a vectorized version of a function? My code: const Z_REF = 10.0# reference height for wind profile law const ALPHA = 0.23375 # exponent of the wind profile law for Cabauw """ calcWindAtHeight(v_wind_gnd, z) Calculate the average wind

Re: [julia-users] Scalar and array version of a function

2016-02-28 Thread FQ
you can get the vectorized version in one line using a comprehension: calcWindAtHeight(v_wind_gnd, Z::AbstractArray) = [calcWindAtHeight(v_wind_gnd,z) for z in Z] i did a quick test and it seems to be about the same speed/slightly faster than your version. you could also use map and a lambda fun

[julia-users] Re: Globally enable / disable @time execution

2016-02-28 Thread Kristoffer Carlsson
Thanks for the correction. I still don't really grok macros well.

Re: [julia-users] Scalar and array version of a function

2016-02-28 Thread Uwe Fechner
Thank's a lot! My code looks now like this: const Z_REF = 10.0# reference height for wind profile law const ALPHA = 0.23375 # exponent of the wind profile law for Cabauw """ calcWindAtHeight(v_wind_gnd, z) Calculate the average wind speed for the given ground wind speed `v_wind_gnd` at a

Re: [julia-users] Scalar and array version of a function

2016-02-28 Thread FQ
for documentation, see http://docs.julialang.org/en/release-0.4/manual/documentation/#functions-methods so, you could put that last sentence of your documentation above the array implementation, and in single double quotes. When someone uses ?calcWindAtHeight in REPL, both documentation texts wil

[julia-users] Implicit conversion at time of dispatch / How can i do this?

2016-02-28 Thread Julia Tylors
Hi, I was wondering whether how i can do implicit conversion at time of dispatch. Here is an example +(x::A,y::A) = C(x,y) implicit_convert(::C) = #some operations returning type A function f(x::A,y::A) end

Re: [julia-users] Scalar and array version of a function

2016-02-28 Thread Milan Bouchet-Valat
Le dimanche 28 février 2016 à 21:33 +0100, FQ a écrit : > for documentation, see > > http://docs.julialang.org/en/release-0.4/manual/documentation/#functions-methods See also https://github.com/JuliaLang/julia/pull/15136 > so, you could put that last sentence of your documentation above the > ar

[julia-users] Re: Implicit conversion at time of dispatch / How can i do this?

2016-02-28 Thread Julia Tylors
Sorry I accidentaly pressed post, Hi, I was wondering whether how i can do implicit conversion at time of dispatch. Here is an example +(x::A,y::A) = C(x,y) implicit_convert(::C) = #some operations returning type A function f(x::A,y::A) (x+y)+x end in the function f , once x+y is executed

Re: [julia-users] Implicit conversion at time of dispatch / How can i do this?

2016-02-28 Thread Tom Breloff
Sounds like you should read up on promotion: http://docs.julialang.org/en/release-0.4/manual/conversion-and-promotion/ On Sunday, February 28, 2016, Julia Tylors wrote: > Sorry I accidentaly pressed post, > > Hi, > > I was wondering whether how i can do implicit conversion at time of > dispatch

Re: [julia-users] Re: Non-uniform interpolation in 1D

2016-02-28 Thread Tomas Lycken
Gridded here is the *interpolation scheme*, as opposed to (implicitly uniform) BSpline interpolation; it’s simply the way Interpolations.jl lets you specify which algorithm you want to use. Compare the following incantations: itp = interpolate(A, BSpline(Linear()), OnGrid()) # linear b-spline

[julia-users] Re: ANN: JuMP 0.12 released

2016-02-28 Thread cdm
a review of the REQUIRE sets for each package gives some high level sense of the differences: https://github.com/JuliaOpt/JuMP.jl/blob/master/REQUIRE https://github.com/JuliaOpt/Convex.jl/blob/master/REQUIRE enjoy !!! cdm

[julia-users] Functions in defined immutables

2016-02-28 Thread Jonathan Goldfarb
I realize now I may have been misunderstanding http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-containers-with-abstract-type-parameters for a long time... Is the recommendation there only related to parameterized types, or any user defined type? My specific question, in

Re: [julia-users] Functions in defined immutables

2016-02-28 Thread Yichao Yu
On Sun, Feb 28, 2016 at 6:49 PM, Jonathan Goldfarb wrote: > I realize now I may have been misunderstanding > http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-containers-with-abstract-type-parameters > for a long time... Is the recommendation there only related to parameteriz

Re: [julia-users] Functions in defined immutables

2016-02-28 Thread Yichao Yu
On Sun, Feb 28, 2016 at 7:24 PM, Yichao Yu wrote: > On Sun, Feb 28, 2016 at 6:49 PM, Jonathan Goldfarb wrote: >> I realize now I may have been misunderstanding >> http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-containers-with-abstract-type-parameters Also note that the r

Re: [julia-users] Functions in defined immutables

2016-02-28 Thread Jonathan Goldfarb
Yes, that's the performance tip I meant. Thanks for your detailed response and reference to the issue; that sounds like a good way forward. I'll be looking forward to future developments Regards, -Max > On Feb 28, 2016, at 7:26 PM, Yichao Yu wrote: > > On Sun, Feb 28, 2016 at 7:24 PM, Yichao Y

[julia-users] Re: [ANN] GLVisualize

2016-02-28 Thread Valentin Churavy
Congratulations Simon :) Now let's get quickly to a Vulkan backend On Saturday, 27 February 2016 22:46:56 UTC+9, Simon Danisch wrote: > > Thanks :) > > >I wonder if it will be the Matplotlib of Julia > > While possible, it will need quite a bit of work :) Offering the > flexibility and usability