[julia-users] Re: enforcing homogeneity of vector elements in function signature

2016-04-05 Thread 'Greg Plowman' via julia-users
> A workaround would be to have two methods, one for the homogeneous > elements in the first parameter, as you suggest, and a second for a vector > with homogeneous elements in both parameters, with both T, N specified in > the signature. But I have to write an extra method... > As pointed

Re: [julia-users] dispatch slowdown when iterating over array with abstract values

2016-04-05 Thread 'Greg Plowman' via julia-users
Thanks for your relies. I'm starting to understand some of this now. In particular, I'm learning there are many aspects to dynamic dispatch. Also worth noting the difference between: if isa(features[i], A) retval += evaluate(features[i]::A) elseif isa(features[i], B) retval +=

[julia-users] Re: ANN: VegaLite.jl

2016-04-05 Thread Dominik Moritz
Just added a page with links to libraries and tools that use Vega-Lite. https://vega.github.io/vega-lite/examples/applications.html On Thursday, March 17, 2016 at 9:23:29 PM UTC-7, Dominik Moritz wrote: > > This is fantastic. I'll add links to all the packages that use/build on > Vega-Lite to

[julia-users] Re: Small package for timing sections of code and pretty printing the results

2016-04-05 Thread Jeffrey Sarnoff
You might have an option to show "wall time / call" or just include it in the table however you like the columns. section | avg time | number| time used | time used | per call | of calls | all calls | % of total

[julia-users] Re: Small package for timing sections of code and pretty printing the results

2016-04-05 Thread Jeffrey Sarnoff
This is very useful and much appreciated. Thank you. On Tuesday, April 5, 2016 at 3:42:45 PM UTC-4, Kristoffer Carlsson wrote: > > Hello everyone, > > I put up a new (unregistered) small package for timing different sections > of code. It works similar to @time in Base but you also give the

Re: [julia-users] elementwise operators

2016-04-05 Thread Stefan Karpinski
The .op operators actually generally do broadcast(op, ...) rather than map. Now that higher order programming is really efficient on 0.5, we could actually implement it that way too, which will eliminate some implementation complexity. On Tue, Apr 5, 2016 at 11:35 AM, Erik Schnetter

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Stefan Karpinski
On Tue, Apr 5, 2016 at 8:27 AM, Scott Jones wrote: > That chart shows that Julia is the *only* language that does not have a one > or two *ASCII* character infix operator for integer division. > Never mind JavaScript, Perl, Matlab, R, PHP or Lisp. Nobody uses those.

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Cristóvão Duarte Sousa
It may have been already proposed sometimes, for some other things (and possibly by myself), but, what about a module that simple defines *macro ~(x,y); div(x,y); end* ? Enabling code like *4~3*. Would it be considered idiomatic enough to use such available option? On Tue, Apr 5, 2016 at 9:19

Re: [julia-users] overflow behavior

2016-04-05 Thread Scott Jones
What if numeric literals acted the same way as irrational numbers like pi, and automatically adapted to the environment where they are used? I know that that sort of rule would have made a lot of the bit twiddling code a lot simpler than having to worry that 0xff and 0x1ff, or

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Scott Jones
On Tuesday, April 5, 2016 at 2:42:56 AM UTC-4, Tomas Lycken wrote: > > There are only 6 uses of // outside of rationals.jl in base (4 of those > are in mpfr.jl), compared to 187 uses of div, and 22 uses of ÷. (that’s > uses, not definitions, exports, documentation, although the ratios are very

[julia-users] optical character recognition

2016-04-05 Thread mgopipun
Hi Friends, I am trying to test the implementation of character recognition using Julia in my Windows 10 machine using the tutorial from https://www.kaggle.com/c/street-view-getting-started-with-julia/data. I am trying to train my system using the sample images and the code works fine in

[julia-users] Small package for timing sections of code and pretty printing the results

2016-04-05 Thread Kristoffer Carlsson
Hello everyone, I put up a new (unregistered) small package for timing different sections of code. It works similar to @time in Base but you also give the code section being timed a label. We can then track the total time and number of calls that are made to code sections with that label and

[julia-users] Small package for timing sections in code

2016-04-05 Thread Kristoffer Carlsson
Hello everyone, It can be found here: https://github.com/KristofferC/TimerOutputs.jl using TimerOutputs; const time_tracker = TimerOutput() @timeit time_tracker "sleeping" sleep(1) @timeit time_tracker "loop" for i in 1:10 rand() end for i in 1:5 @timeit time_tracker "in a loop"

Re: [julia-users] ccall behavior in julia 0.4.3

2016-04-05 Thread Isaiah Norton
> > I was just guessing that Tv needs to somehow be global to be correctly > read by ccall, but this is just a hunch. Is this correct? Or is something > else going on here. The issue here is that all types used in a ccall must be statically resolved at compile time. In this case it might seem

[julia-users] Help with convoluted types and Vararg

2016-04-05 Thread Seth
Hi all, I have the following on 0.4.6-pre+18: z = [Pair((+,1,5,7), 3), Pair((-,6,5,3,5,8), 1)] type Foo x::Array{Pair{Tuple{Function, Vararg{Int}}, Int}} end and I'm getting julia> Foo(z) ERROR: MethodError: `convert` has no method matching

[julia-users] ccall behavior in julia 0.4.3

2016-04-05 Thread Serban Andrei Stan
I'm trying to call an MKL matrix multiplication routine from inside Julia. I have julia version 0.4.3 compiled with intel MKL. I've noticed however some weird behavior involving the ccall function. If I run the following code inside a Julia terminal, I get no errors: Tv *=* Float*64* > > > n

[julia-users] Re: Julia + MKL no Base.LinAlg.SparseBLAS

2016-04-05 Thread Serban Andrei Stan
Thanks Kristoffer - I didn't use your repo, but got an example working using ccall. On Tuesday, March 29, 2016 at 6:37:43 PM UTC-4, Kristoffer Carlsson wrote: > > I meant https://github.com/JuliaSparse/MKLSparse.jl/pull/7 > > On Tuesday, March 29, 2016 at 10:22:58 PM UTC+2, Kristoffer Carlsson

Re: [julia-users] Re: regression from 0.43 to 0.5dev, and back to 0.43 on fedora23

2016-04-05 Thread Milan Bouchet-Valat
Le mardi 05 avril 2016 à 10:18 -0700, Johannes Wagner a écrit : > hey Milan, > so consider following code: > > Pkg.clone("git://github.com/kbarbary/TimeIt.jl.git") > using TimeIt > > v = rand(3) > r = rand(6000,3) > x = linspace(0.0, 10.0, 500) * (v./sqrt(sumabs2(v)))' > > dotprods = r * x[2,:]

Re: [julia-users] Re: regression from 0.43 to 0.5dev, and back to 0.43 on fedora23

2016-04-05 Thread Johannes Wagner
hey Milan, so consider following code: Pkg.clone("git://github.com/kbarbary/TimeIt.jl.git") using TimeIt v = rand(3) r = rand(6000,3) x = linspace(0.0, 10.0, 500) * (v./sqrt(sumabs2(v)))' dotprods = r * x[2,:] imexp= cis(dotprods) sumprod = sum(imexp) * sum(conj(imexp)) f(r, x) = r *

Re: [julia-users] Best way to make a module available to all pmap workers?

2016-04-05 Thread Tim Holy
Do you need the @everywhere? using should be good enough on its own. However, this isn't working perfectly: see https://github.com/JuliaLang/julia/issues/9245 https://github.com/JuliaLang/julia/issues/3674 for some things you may need to work around (or better yet, submit a fix for!). In

Re: [julia-users] overflow behavior

2016-04-05 Thread Erik Schnetter
On Tue, Apr 5, 2016 at 11:05 AM, Didier Verna wrote: > Erik Schnetter wrote: > >> The literal `1` has type `Int`. The promotion rules for `Int8` and >> `Int` state that, before the addition, `Int8` is converted to `Int`. >> (On your system, it seems

Re: [julia-users] elementwise operators

2016-04-05 Thread Erik Schnetter
On Tue, Apr 5, 2016 at 11:23 AM, Didier Verna wrote: > > I understand that some operators have elementwise versions, when > prefixed with a dot. I think the manual is missing some dots, like in > this paragraph, right ? > > "The operator < is intended for array

[julia-users] elementwise operators

2016-04-05 Thread Didier Verna
I understand that some operators have elementwise versions, when prefixed with a dot. I think the manual is missing some dots, like in this paragraph, right ? "The operator < is intended for array objects; the operation A .< B is valid only if A and B have the same dimensions. The operator

Re: [julia-users] litteral floats

2016-04-05 Thread Didier Verna
Isaiah Norton wrote: > Yes. (x86 has had double support for a long time and so do most > high-end ARM chips) Thank you. -- Resistance is futile. You will be jazzimilated. Lisp, Jazz, Aïkido: http://www.didierverna.info

Re: [julia-users] litteral floats

2016-04-05 Thread Isaiah Norton
> > But is that also the case on 32bits systems ? Yes. (x86 has had double support for a long time and so do most high-end ARM chips) On Tue, Apr 5, 2016 at 10:51 AM, Didier Verna wrote: > > The manual says: "The above results [e.g. 1.5e0] are all Float64 > values.

[julia-users] Re: List comprehension for 1 <= i < j <= 4

2016-04-05 Thread Jonatan Pallesen
> > I just realized that combinations is in base Julia, so it can instead be > collect(combinations(collect(1:4), 2))

Re: [julia-users] overflow behavior

2016-04-05 Thread Didier Verna
Erik Schnetter wrote: > The literal `1` has type `Int`. The promotion rules for `Int8` and > `Int` state that, before the addition, `Int8` is converted to `Int`. > (On your system, it seems that `Int` is `Int64`.) OK, so indeed, there's modular arithmetics for the non

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Gabriel Gellner
lol, thanks for the python 3 update! I need to get using that one of these days ... Yeah I didn't see your comment as very critical, I just wanted to say we can all coexist in general :) I find the holy wars on basic stuff like this always a bit mind blowing. Julia continually impresses me

Re: [julia-users] Teaching Julia as a first language to kids or adults. ThreeJS? Web?

2016-04-05 Thread Tamas Papp
On Tue, Apr 05 2016, Páll Haraldsson wrote: > On Tuesday, April 5, 2016 at 1:46:10 PM UTC, Tamas Papp wrote: > >> "First" language for which group? > > Kid[s], that [I] have already taught/learned Scratch and Alice (or past > that "age"), now a 12 year old. Scott Jones, is also teaching similar

[julia-users] prefix / infix syntax bridge

2016-04-05 Thread 'Till Schröder' via julia-users
Hi, as far as I know, the parentheses are just for better readability. But I'm sorry to say that you can't add bew operators as far as I know. You could do that with macros (I believe), but that would be a mess. Just stick ti the existing ones. Since I'm also a beginner I'm not entirely sure on

[julia-users] Re: List comprehension for 1 <= i < j <= 4

2016-04-05 Thread Jonatan Pallesen
> > I thought of another approach > using Iterators collect(subsets(collect(1:4), 2)) > >

Re: [julia-users] constructor & function have different promotion rules?

2016-04-05 Thread FANG Colin
Thank you On 5 April 2016 at 15:47, Josh Langsfeld wrote: > This is noted in the docs. See a few paragraphs down, "When a type is > applied like a function..." > > http://docs.julialang.org/en/release-0.4/manual/types/#composite-types > > On Tuesday, April 5, 2016 at 10:19:05

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Gabriel Gellner
Sweetness. Thanks for the clarification! On Tuesday, April 5, 2016 at 7:42:02 AM UTC-7, Cristóvão Duarte Sousa wrote: > > > For the julia example isn't matlab like concatenation using ';' being >> removed from julia? >> > > No. Just the concatenation using ',' > (AFAIK) > >

Re: [julia-users] Re: overflow behavior

2016-04-05 Thread Erik Schnetter
On Tue, Apr 5, 2016 at 10:50 AM, Páll Haraldsson wrote: > On Tuesday, April 5, 2016 at 2:45:38 PM UTC, Didier Verna wrote: >> >> >> Hello, >> >> the manual says: "In Julia, exceeding the maximum representable value of >> a given type results in a wraparound

Re: [julia-users] Re: overflow behavior

2016-04-05 Thread Didier Verna
Páll Haraldsson wrote: > Right, the manual could be updated, I guess. The last one, gives you > Int32 on 32-bit platforms. I expected as much, indeed. -- Resistance is futile. You will be jazzimilated. Lisp, Jazz, Aïkido: http://www.didierverna.info

Re: [julia-users] overflow behavior

2016-04-05 Thread Erik Schnetter
On Tue, Apr 5, 2016 at 10:45 AM, Didier Verna wrote: > > Hello, > > the manual says: "In Julia, exceeding the maximum representable value of > a given type results in a wraparound behavior:", but that seems to be > the case only for the native type and above: > > julia>

[julia-users] Re: overflow behavior

2016-04-05 Thread Páll Haraldsson
On Tuesday, April 5, 2016 at 2:45:38 PM UTC, Didier Verna wrote: > > > Hello, > > the manual says: "In Julia, exceeding the maximum representable value of > a given type results in a wraparound behavior:", but that seems to be > the case only for the native type and above: > > julia>

[julia-users] litteral floats

2016-04-05 Thread Didier Verna
The manual says: "The above results [e.g. 1.5e0] are all Float64 values. Literal Float32 values can be entered by writing an f in place of e". But is that also the case on 32bits systems ? -- Resistance is futile. You will be jazzimilated. Lisp, Jazz, Aïkido: http://www.didierverna.info

Re: [julia-users] constructor & function have different promotion rules?

2016-04-05 Thread Josh Langsfeld
This is noted in the docs. See a few paragraphs down, "When a type is applied like a function..." http://docs.julialang.org/en/release-0.4/manual/types/#composite-types On Tuesday, April 5, 2016 at 10:19:05 AM UTC-4, FANG Colin wrote: > > methods(TT) > > call(::Type{TT}, x::Float64,

[julia-users] overflow behavior

2016-04-05 Thread Didier Verna
Hello, the manual says: "In Julia, exceeding the maximum representable value of a given type results in a wraparound behavior:", but that seems to be the case only for the native type and above: julia> typeof(typemax(Int64) + 1) -> Int64 julia> typeof(typemax(Int128) + 1) -> Int128 but:

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Cristóvão Duarte Sousa
> For the julia example isn't matlab like concatenation using ';' being > removed from julia? > No. Just the concatenation using ',' (AFAIK)

Re: [julia-users] Teaching Julia as a first language to kids or adults. ThreeJS? Web?

2016-04-05 Thread Páll Haraldsson
On Tuesday, April 5, 2016 at 1:46:10 PM UTC, Tamas Papp wrote: > > On Tue, Apr 05 2016, Páll Haraldsson wrote: > > > Hi, > > > > I'm convinced Julia is the best second language to learn. Maybe, first, > if > > tutorials or books are ok, for the right project. What about libraries, > > what

Re: [julia-users] constructor & function have different promotion rules?

2016-04-05 Thread Sisyphuss
Yes, I guess. call(TT, 1, 2) call(TT, 'a', 'b') On Tuesday, April 5, 2016 at 4:19:05 PM UTC+2, FANG Colin wrote: > > methods(TT) > > call(::Type{TT}, x::Float64, y::Float64) at In[22]:2 > call(::Type{TT}, x, y) at In[22]:2 > call{T}(::Type{T}, arg) at essentials.jl:56

Re: [julia-users] constructor & function have different promotion rules?

2016-04-05 Thread FANG Colin
methods(TT) call(::Type{TT}, x::Float64, y::Float64) at In[22]:2 call(::Type{TT}, x, y) at In[22]:2 call{T}(::Type{T}, arg) at essentials.jl:56 call{T}(::Type{T}, args...) at essentials.jl:57 So I guess the rule is applied in call(::Type{TT}, x, y) What does it do? Does it try to

[julia-users] Re: constructor & function have different promotion rules?

2016-04-05 Thread Sisyphuss
Your `tt` only works for `Float64`: `tt(1.0 , 2.0)` works. To make your code generic, remove the type specification. On Tuesday, April 5, 2016 at 4:09:18 PM UTC+2, FANG Colin wrote: > > Sorry if this has been discussed somewhere as I am unable to find the > relative post. > > immutable TT >

Re: [julia-users] constructor & function have different promotion rules?

2016-04-05 Thread Yichao Yu
On Tue, Apr 5, 2016 at 10:09 AM, FANG Colin wrote: > Sorry if this has been discussed somewhere as I am unable to find the > relative post. > > immutable TT > x::Float64 > y::Float64 > end > > function tt(x::Float64, y::Float64) > x + y > > end > tt(1,2) # doesn't

[julia-users] constructor & function have different promotion rules?

2016-04-05 Thread FANG Colin
Sorry if this has been discussed somewhere as I am unable to find the relative post. immutable TT x::Float64 y::Float64 end function tt(x::Float64, y::Float64) x + y end tt(1,2) # doesn't work TT(1,2) # works What rule applies here for TT(1,2)?

Re: [julia-users] prefix / infix syntax bridge

2016-04-05 Thread Isaiah Norton
> > Also another question: is it possible, as in Haskell, to define new > infix operators No. There was some discussion of supporting Haskell-like custom infix with backticks, but I don't think anyone ever tried to implement it. (and if backticks syntax is ever freed-up, there are probably

[julia-users] Re: Outer constructor to initialize parametric type

2016-04-05 Thread Kristoffer Carlsson
http://docs.julialang.org/en/release-0.4/manual/constructors/#constructors-call-and-conversion On Tuesday, April 5, 2016 at 1:32:51 PM UTC+2, Anonymous wrote: > > hey alright! that works, thanks. Is there an explanation of how this > works in the tutorial? > > On Tuesday, April 5, 2016 at

[julia-users] Re: Small packages?

2016-04-05 Thread Kristoffer Carlsson
I would say the main problem is that there is no (good) way to REQUIRE packages that aren't listed in METADATA. The result is that you either must force your package into METADATA or deal with clunky install/C.I instructions with Pkg.clone() etc. On Tuesday, April 5, 2016 at 5:11:36 AM

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread DNF
On Tuesday, April 5, 2016 at 3:36:09 PM UTC+2, Gabriel Gellner wrote: > > you can do the python example as: > > a[[1, 4] + range(7, 17, 2)] > (ignoring the issues that this is not the same range as julia since python > uses 0-based indices ...) > Thanks. I'm getting an error, though:

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread FANG Colin
+ 1 to Gabriel's reply. On Tuesday, April 5, 2016 at 2:36:09 PM UTC+1, Gabriel Gellner wrote: > > you can do the python example as: > > a[[1, 4] + range(7, 17, 2)] > (ignoring the issues that this is not the same range as julia since python > uses 0-based indices ...) > > you don't need to index

Re: [julia-users] prefix / infix syntax bridge

2016-04-05 Thread Erik Schnetter
The syntax without parentheses works only for some operators; it does not work e.g. for `&`, since `&` is also a prefix operator. There are also some contexts where parsing is ambiguous without the parentheses, e.g. expressions such as `[+ + +]`. This could be an array literal with three

[julia-users] Re: how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo
> I wonder in what cases the warnings show. I try to make a simple case where I have just one file called "testConst.jl" in which I have the following 2 lines: [code] const A=12 println(A) [\code] Everytime I modify the file and include it on the REPL, I don't get warning of redefining

Re: [julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread Mauro
I made https://github.com/mauro3/Parameters.jl potentially for your use-case. So instead of const g=9.81 const rho=1000.0 pressure(h) = rho*g*h you write: using Parameters @with_kw type Para{R} g::R=9.81 rho::R=1000.0 end pressure(h,p::Para) = (@unpack p: g, rho; rho*g*h)

Re: [julia-users] Teaching Julia as a first language to kids or adults. ThreeJS? Web?

2016-04-05 Thread Tamas Papp
On Tue, Apr 05 2016, Páll Haraldsson wrote: > Hi, > > I'm convinced Julia is the best second language to learn. Maybe, first, if > tutorials or books are ok, for the right project. What about libraries, > what would you recommend? It is hard to recommend libraries in abstract, without knowing

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Gabriel Gellner
you can do the python example as: a[[1, 4] + range(7, 17, 2)] (ignoring the issues that this is not the same range as julia since python uses 0-based indices ...) you don't need to index with an ndarray, and that way you can get the nice use of the + operator for concatenate. Lacking the :

[julia-users] Best way to make a module available to all pmap workers?

2016-04-05 Thread Thomas Covert
I have some code in a module (say, MyModule.jl) for which I would like each worker in a pmap() to have access. Right now, I accomplish this by something like: addprocs(CPU_CORES) @everywhere using MyModule function dostuff(x) # code that uses functions exported from MyModule end results =

[julia-users] Teaching Julia as a first language to kids or adults. ThreeJS? Web?

2016-04-05 Thread Páll Haraldsson
Hi, I'm convinced Julia is the best second language to learn. Maybe, first, if tutorials or books are ok, for the right project. What about libraries, what would you recommend? I try to be cautions when I recommend Julia. Julia should be ok as a first* language, with a mentor. This seemed

Re: [julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo
Thanks for the tip. Don't you have to do include everytime you change some files? My codes have not been complicated enough to use modules, but how does that help with only a couple files? On Tuesday, April 5, 2016 at 6:45:00 PM UTC+5:30, Erik Schnetter wrote: > > I usually put code into a

[julia-users] prefix / infix syntax bridge

2016-04-05 Thread Didier Verna
Hi, the user manual says this (VARIABLES section): "Operators like + are also valid identifiers, but are parsed specially. In some contexts, operators can be used just like variables; for example (+) refers to the addition function, and (+) = f will reassign it." This looks like Haskell's

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Sheehan Olver
It's nuts...people complaining about how many key presses it takes to write \div[tab] and hold up a language that takes np.array([..]) as better... Sent from my iPhone > On 5 Apr 2016, at 22:54, DNF wrote: > >> On Tuesday, April 5, 2016 at 2:47:15 PM UTC+2, Sisyphuss wrote:

Re: [julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread Erik Schnetter
I usually put code into a module, and use `using` to load the module. After updating a module, I use `workspace()` to remove all previous definition in the REPL: `workspace(); using FunHPC` -erik On Tue, Apr 5, 2016 at 9:13 AM, K leo wrote: > I have some const defined in

Re: [julia-users] Re: possibility to define a type that is subtype of more than one supertype

2016-04-05 Thread Jason Merrill
Re: SimpleTraits vs Traits, that's good to know. It would be nice to have this note as part of the docs for Traits.jl. You already have a very nice "Other Trait Implementations" section that links to a bunch of other implementations, but not SimpleTraits. On Tue, Apr 5, 2016 at 2:56 AM Mauro

[julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo
I have some const defined in various files in the following way: [code]const AConst=1[/code] Everytime after I modify something in the files (constants remain unchanged) and include a file on Julia's REPL, I always get a bunch warnings about redefining constants. Repeating the process many time

[julia-users] Re: Outer constructor to initialize parametric type

2016-04-05 Thread Jeffrey Sarnoff
starting with your `*T*` parameterized type type Foo{*T*} x::Vector{*T*} end When you create a new element of type Foo by giving the concrete type a vector of some sort, say [1,2,3], newFoo = Foo( [1,2,3] ) you do not write out the *T*, nor do you explicitly give it its appropriate

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread DNF
On Tuesday, April 5, 2016 at 2:47:15 PM UTC+2, Sisyphuss wrote: > > np.array([a[i] for i in [1,2,4] + list(range(7,17,2))]) > > This works, albeit awkward. Python was not originally designed for > mathematics. > Thanks :) But that this is also my point: I find it mind-boggling that someone

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Zheng Wendell
np.array([a[i] for i in [1,2,4] + list(range(7,17,2))]) This works, albeit awkward. Python was not originally designed for mathematics. On Tue, Apr 5, 2016 at 10:40 AM, DNFwrote: > Thanks for the suggestion, but that returns a list, not an array. Also I > wanted a mix of arbitrary indices and

[julia-users] Re: Outer constructor to initialize parametric type

2016-04-05 Thread Anonymous
hey alright! that works, thanks. Is there an explanation of how this works in the tutorial? On Tuesday, April 5, 2016 at 4:17:28 AM UTC-7, Kristoffer Carlsson wrote: > > call{T}(::Type{Foo{T}}) = Foo{T}(T[]) > > julia> Foo{Float64}() > Foo{Float64}(Float64[]) > > > > On Tuesday, April 5, 2016

[julia-users] Re: Outer constructor to initialize parametric type

2016-04-05 Thread Kristoffer Carlsson
call{T}(::Type{Foo{T}}) = Foo{T}(T[]) julia> Foo{Float64}() Foo{Float64}(Float64[]) On Tuesday, April 5, 2016 at 1:12:00 PM UTC+2, Anonymous wrote: > > I couldn't really figure out a good way to describe it my title, but what > I'm trying to do is this: > > type Foo{T} > x::Vector{T} > end >

[julia-users] Outer constructor to initialize parametric type

2016-04-05 Thread Anonymous
I couldn't really figure out a good way to describe it my title, but what I'm trying to do is this: type Foo{T} x::Vector{T} end Foo{T}() = Foo{T}(T[]) but I get the warning msg: Warning: static parameter T does not occur in signature for call at none:1. The method will not be callable. How

[julia-users] Julia and Octave communication using MPI?

2016-04-05 Thread michael . creel
I use MPI with both Julia (using MPI.jl) and Octave (using the MPI package for Octave). For both Julia and Octave, the packages are wrapping (in my case) Open MPI functions. I believe that it should be possible for Julia and Octave to send information back and forth via MPI. Before trying this

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread DNF
Thanks for the suggestion, but that returns a list, not an array. Also I wanted a mix of arbitrary indices and a range (which could be arbitrarily long). Using your idea, I then tried: np.array([a[i] for i in [1,2,4, range(7,17,2)]]) but that didn't work. Also it's a bit awkward compared to

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Zheng Wendell
You can use list compression in python [a[i] for i in [1,2,4,7,9] ] On Apr 5, 2016 8:55 AM, "DNF" <> wrote: > > Typo, I meant to type: > > Python 3.5 > a[i*len(a)//n:(i+1)*len(a)//n] > > Julia: > a[1+i*end÷n:(i+1)end÷n] > > I'm just learning Python, and must say I find indexing in Python to be

Re: [julia-users] Re: possibility to define a type that is subtype of more than one supertype

2016-04-05 Thread Mauro
My Traits.jl package hasn't seen much love recently. It should work fine (within its limitation of being experimental) for 0.4 but I'm not sure I'll find the time to update it to 0.5 when the time comes. There is also https://github.com/mauro3/SimpleTraits.jl which is (+/-) just macro-sugar for

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread DNF
Typo, I meant to type: Python 3.5 a[i*len(a)//n:(i+1)*len(a)//n] Julia: a[1+i*end÷n:(i+1)end÷n] I'm just learning Python, and must say I find indexing in Python to be very awkward compared to Julia or Matlab. Do you have any suggestion for how I should do this in Python? a[[1; 4; 7:2:15]] So

[julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread DNF
On Saturday, April 2, 2016 at 1:55:55 PM UTC+2, Spiritus Pap wrote: > > A simple example why it makes my *life hard*: Assume there is an array of > size 100, and i want to take the i_th portion of it out of n. This is a > common scenario for research-code, at least for me and my friends. > In

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Tomas Lycken
There are only 6 uses of // outside of rationals.jl in base (4 of those are in mpfr.jl), compared to 187 uses of div, and 22 uses of ÷. (that’s uses, not definitions, exports, documentation, although the ratios are very similar). Looking at packages, it seems also that div is used frequently,

[julia-users] Re: enforcing homogeneity of vector elements in function signature

2016-04-05 Thread Jeffrey Sarnoff
If I understand your question, you want to accept e.g. both [Foo{Int,2}((1,2)), Foo{Int,2)((2,3))] and [Foo{Int,2}((1,2)), Foo{Int,3)((2,3,4)) ] and then do something with them, and you want to reject e.g. [Foo{Int,2((1,2)), Foo{Float64,2}((2.0,3.0))]. Having two method signatures that

[julia-users] Re: enforcing homogeneity of vector elements in function signature

2016-04-05 Thread Tomas Lycken
The reason you’re getting that method error is because of type parameter invariance - in short, even though F <: Foo{T}, we *don’t* have Vector{F} <: Vector{Foo{T}}. Until triangular dispatch lands, defining

Re: [julia-users] "Number of packages that depend on this package" at http://pkg.julialang.org/ - which ones?

2016-04-05 Thread Patrick Kofod Mogensen
Thank you. Unsure about the discrepancy. Could be because the pkg.julialang.org is a few weeks old, but maybe not. On Tuesday, April 5, 2016 at 12:31:39 AM UTC+2, Tim Holy wrote: > > Pkg.dependents should do it. To get both direct and indirect dependents, > you > can do this: > > julia> sold