[julia-users] Re: What do you call an (Associative{Int,T} or AbstractArray{T})

2016-04-13 Thread Matt Bauman
On Wednesday, April 13, 2016 at 6:29:21 PM UTC-4, James Fairbanks wrote: > > Or do you make a constructor that validates C <: Associative{NTuple{N, > Int},T} at construction time? > What would be the appropriate error to throw in this case? > Exactly! It's not currently possible to express the

[julia-users] Re: Should `append!(a::Vector{T}, items::NTuple{N, T})` be defined in Base?

2016-04-13 Thread Davide Lasagna
Interestingly, I have just noticed a bug in append!, see https://github.com/JuliaLang/julia/issues/15868 It occurs when you try to append a vector of elements which have a different type with respect to that of the original vector and when the conversion mechanism fails. On Wednesday, April

[julia-users] Re: Should `append!(a::Vector{T}, items::NTuple{N, T})` be defined in Base?

2016-04-13 Thread Steven G. Johnson
On Wednesday, April 13, 2016 at 6:22:27 PM UTC-4, Greg Plowman wrote: > > Considering the existing append! is pretty loose wrt the items being > appended, a simple extension to the signature might work: > > append!{T}(a::Array{T,1}, items::Union{AbstractVector,Tuple}) > Arguably, the signature

[julia-users] Re: What do you call an (Associative{Int,T} or AbstractArray{T})

2016-04-13 Thread James Fairbanks
I am glad to get two consistent answers within 1 minute of each other! On Wednesday, April 13, 2016 at 1:48:20 PM UTC-4, Matt Bauman wrote: > > If you're able to define a `size` method for the Associative types, then > I'd call them all AbstractArrays. > Yeah they are 1 dimensional and have

[julia-users] Re: Should `append!(a::Vector{T}, items::NTuple{N, T})` be defined in Base?

2016-04-13 Thread 'Greg Plowman' via julia-users
Considering the existing append! is pretty loose wrt the items being appended, a simple extension to the signature might work: append!{T}(a::Array{T,1}, items::Union{AbstractVector,Tuple}) You could extend this yourself to try it out. On Thursday, April 14, 2016 at 4:07:45 AM UTC+10, Davide

[julia-users] Re: edit() with foreground emacs

2016-04-13 Thread Josef Sachs
> On Wed, 13 Apr 2016 14:03:08 -0700 (PDT), daniel matz said: > It seems to work for me. What were you trying to set JULIA_EDITOR > to when you were trying emacs? Were you trying to use console emacs > with emacs -nw? > On Wednesday, April 13, 2016 at 7:46:21 AM UTC-5, Josef Sachs wrote:

[julia-users] Re: edit() with foreground emacs

2016-04-13 Thread daniel . matz
It seems to work for me. What were you trying to set JULIA_EDITOR to when you were trying emacs? Were you trying to use console emacs with emacs -nw? On Wednesday, April 13, 2016 at 7:46:21 AM UTC-5, Josef Sachs wrote: > > Is there a way that I can use edit() to start emacs in the foreground

[julia-users] Re: GtkIDE.jl, a semi-functional editor for Julia

2016-04-13 Thread jonathan . bieler
Hum, I guess you need to add it before you can check it out : Pkg.add("Gtk"). I'll update the readme.

[julia-users] Re: GtkIDE.jl, a semi-functional editor for Julia

2016-04-13 Thread LarryD
Hi. I just loaded Julia 0.4.5 and entered the starting line of your installation instructions: Pkg.checkout("Gtk"). I get the error message ERROR: Gtk is not a git repot in checkout at pkg/entry.jl:203 Is there something else I need to load first, or what am I doing wrong? Thanks Larry

[julia-users] Re: DataFrames: How to change column name?

2016-04-13 Thread Andrew McKay
minor update: rename!(df, :x1, :randomnumbers) On Monday, December 9, 2013 at 2:27:10 AM UTC-8, Johan Sigfrids wrote: > > There is a rename!() function which does this. You can use it ilke this: > df = DataFrame(x1=rand(5) > rename!(df, "x1", "randomnubers") > > > > On Monday, December 9, 2013

[julia-users] Should `append!(a::Vector{T}, items::NTuple{N, T})` be defined in Base?

2016-04-13 Thread Davide Lasagna
Hi all, I need to extend a vector with contents from n-tuples i generate iteratively. Currently append!(a::Vector{T}, items::NTuple{N, T}) is not defined, whereas the method append!{T}(a::Array{T,1}, items::AbstractVector) exists and is defined in array.jl. Anyone finds this useful to

[julia-users] Re: What do you call an (Associative{Int,T} or AbstractArray{T})

2016-04-13 Thread Matt Bauman
If you're able to define a `size` method for the Associative types, then I'd call them all AbstractArrays. I'd use a wrapper type like the last example in http://docs.julialang.org/en/release-0.4/manual/interfaces/#abstract-arrays. You could parameterize the `data` field so any associative

[julia-users] Re: What do you call an (Associative{Int,T} or AbstractArray{T})

2016-04-13 Thread Steven G. Johnson
On Wednesday, April 13, 2016 at 1:14:42 PM UTC-4, James Fairbanks wrote: > > What is the best way to express this in types? Does > Union{Associative{Int,T}, AbstractArray{T}} express this with no > performance penalty? Is there any reason to avoid Union types? > Unions have no better or worse

Re: [julia-users] Re: sparse rank, sparse nullspace, sparse linear algebra over rationals?

2016-04-13 Thread James Fairbanks
Does this help? https://github.com/JuliaLang/IterativeSolvers.jl/blob/master/src/svdl.jl#L192 On Wednesday, April 13, 2016 at 10:30:32 AM UTC-4, Alex Dowling wrote: > > Hello Laurent, > > Thanks. I've used svds in MATLAB before with some success. Ideally I'd > like to have a pure Julia

[julia-users] What do you call an (Associative{Int,T} or AbstractArray{T})

2016-04-13 Thread James Fairbanks
Over at LightGraphs we have been discussing support for collections indexed by integers that can be either dense like Vector{T} or sparse like Dict{Int,T}. The idea is that you want to collect some T's together indexed by a range of integers 1:n. Often you will have a value for all or most of

[julia-users] Re: I am trying to figure out how to pass DataTypes for a dataframe to @ListStore in Gtk.jl

2016-04-13 Thread Min-Woong Sohn
I just did and it works perfectly. Thank you so much! On Tuesday, April 12, 2016 at 7:04:39 PM UTC-4, Eric Forgy wrote: > > Hi, > > I'm not sitting at a computer at the moment, but just curious if you've > tried > > ls = @ListStore(eltypes(df)...) > > Sorry for the noise if that doesn't work

Re: [julia-users] Re: sparse rank, sparse nullspace, sparse linear algebra over rationals?

2016-04-13 Thread Alex Dowling
Hello Laurent, Thanks. I've used svds in MATLAB before with some success. Ideally I'd like to have a pure Julia implementation. Do you know of any appropriate packages? Alex On Tuesday, April 12, 2016 at 4:41:06 PM UTC-5, Laurent Bartholdi wrote: > > @Stefan: sorry, I had meant that Julia

Re: [julia-users] Re: Setting min()=Inf and max()=-Inf

2016-04-13 Thread Stefan Karpinski
The decision here was made to be consistent across types: since most types don't have a way of representing ± infinite values, there's no general way to do this. It's a bit too much of a subtle corner case to make this work, but *only* for arrays of concrete floating-point types. Imagine you write

Re: [julia-users] local types or macros?

2016-04-13 Thread Stefan Karpinski
To answer somewhat the reason for the lack of local macros: Julia relies on macros considerably less than Lisp does. In fact, they're generally seen as a last resort. From this perspective, there's not so much call for local macros. There are, of course, namespace-local macros, which seems

[julia-users] Re: Int or Int64

2016-04-13 Thread Scott Jones
There is no Float, you should use Float32 or Float64 depending on precision needed for your application. I'd definitely use Int instead of Int64 as long as Int32 will be large enough, to avoid performance issues on 32-bit machines. (I build and use Julia on my 32-bit ARM based Raspberry Pi) On

Re: [julia-users] Re: Setting min()=Inf and max()=-Inf

2016-04-13 Thread Niclas Wiberg
What about minimum() and maximum() with empty floating-point arrays? Would it make sense for those to return -Inf and +Inf by default? I get: *julia> **a = Array(Float64,(0,))* *0-element Array{Float64,1}* *julia> **minimum(a)* *ERROR: ArgumentError: reducing over an empty collection is not

[julia-users] edit() with foreground emacs

2016-04-13 Thread Josef Sachs
Is there a way that I can use edit() to start emacs in the foreground with support for line number? As a kludge, I am currently setting JULIA_EDITOR=mvim, and I have a mvim in my PATH that is a symbolic link to emacs.

[julia-users] GtkIDE.jl, a semi-functional editor for Julia

2016-04-13 Thread jonathan . bieler
GtkIDE.jl is a IDE for Julia 0.4 written in Julia, aiming at providing something similar to the Matlab editor (with a console, plots, tools, and the possibility to make customs GUIs). I've been working on this for a while and although the code is still messy, and there's a lot of issues, I

Re: [julia-users] local types or macros?

2016-04-13 Thread Tamas Papp
On Wed, Apr 13 2016, Didier Verna wrote: > Tamas Papp wrote: > >> My perception is that simply pointing out that something is different >> in Common Lisp is unlikely to move the Julia language team to make >> fundamental changes to the language > > ... which is not my

Re: [julia-users] Re: [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-13 Thread Kaj Wiik
Perfect! The documentation looks very good, thanks! Cheers, Kaj On Wednesday, April 13, 2016 at 2:15:05 PM UTC+3, Mosè Giordano wrote: > > Hi Kaj, > > thanks for your question, it served me as inspiration to add another > example to the manual: >

Re: [julia-users] Int or Int64

2016-04-13 Thread Mauro
Also, note that floats work the same on both 32 and 64 bit machines (and both default to making Float64). Concerning ints: use Int64 if you need them for your code to be correct, otherwise use Int. (Maybe best to just use Int64 to be on the save side?) This has been discussed on this list

Re: [julia-users] scoping wat

2016-04-13 Thread Didier Verna
I wrote: > Consider for example embedding a for loop in a macro, and the risk for > variable capture. Forget that. Macros seem to be hygienic. -- ELS'16 registration open! http://www.european-lisp-symposium.org Lisp, Jazz, Aïkido: http://www.didierverna.info

[julia-users] Re: Need help with GR and PyPlot

2016-04-13 Thread Josef Heinen
To solve the PyPlot backend problem, I made a PR (Add support for the GR backend #207 ) . This patch solved the problem for me. To fix the savefig() problem, please checkout the GR.jl master ( Pkg. checkout("GR")) and/or rebuild the package. There

[julia-users] Re: Need help with GR and PyPlot

2016-04-13 Thread Josef Heinen
To solve the PyPlot backend problem, I made a PR. This patch solved the problem for me. To fix the ``savefig`` problem, please checkout the GR.jl master (``Pkg.checkout("GR")``) and/or rebuild the package. There was a configuration error on my build system (for OS X) which I didn't realize.

[julia-users] Re: Need help with GR and PyPlot

2016-04-13 Thread Josef Heinen
I made a PR (Add support for the GR backend #207 ) to enable GR support for the PyPlot library. It would be nice if the changes could be merged. I don't know, why showing the plot should freeze everything else. Changing the backend to GR did

Re: [julia-users] How to load data from a *.mat file on all workers in Julia 0.4.5 without require()?

2016-04-13 Thread 'Jhan Jar' via julia-users
Thanks Tim, The second link helped me figure out the issue(s)/bug(s). Really appreciate you guys! On Tuesday, April 12, 2016 at 3:54:58 PM UTC+5, Tim Holy wrote: > > This is covered is multiple previous posts to the mailing list. > >

Re: [julia-users] Re: [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-13 Thread Mosè Giordano
Hi Kaj, thanks for your question, it served me as inspiration to add another example to the manual: https://cubajl.readthedocs.org/en/latest/#passing-data-to-the-integrand-function Bye, Mosè 2016-04-13 5:14 GMT+02:00 Steven G. Johnson : > > > On Tuesday, April 12, 2016

[julia-users] Re: [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-13 Thread Kaj Wiik
On Wednesday, April 13, 2016 at 6:14:29 AM UTC+3, Steven G. Johnson wrote: > You don't need an explicit userdata argument -- this is just a crude > simulation of closures in C, but Julia has true closures and lexical > scoping. > > For example > > > myvar = 7 > Vegas( (x,f) -> f[1] =

Re: [julia-users] scoping wat

2016-04-13 Thread Didier Verna
Jeff Bezanson wrote: > Yes, one could argue that a `for` loop variable should always be a new > variable, but that does make the constructs less orthogonal. It's funny that you see this as less orthogonal, considering that, as Stefan pointed out, your "for" index

[julia-users] Re: Int or Int64

2016-04-13 Thread 'Bill Hart' via julia-users
Int is either Int32 or Int64, depending on the machine. Int64 does still seem to be defined on a 32 bit machine. In fact, even Int128 is defined. But of course it is going to have to emulate processor instructions to do 64 bit arithmetic unless the machine actually has such instructions. So it

Re: [julia-users] scoping wat

2016-04-13 Thread Didier Verna
Jeff Bezanson wrote: > It works this way because we didn't want to require all variables to > be explicitly introduced with a construct like `var x = 0`. This adds > a lot of noise to a program and is annoying to those used to python or > matlab. I see your point and

[julia-users] Int or Int64

2016-04-13 Thread vincent leclere
Hi all, quick question: I am building a package and has been defining types with Int64 or Float64 properties. Is there any reason why I should be using Int and Float instead ? (Does Int64 work on 32bits processors ?) Will it be at the price of efficiency loss ? Thanks

Re: [julia-users] local types or macros?

2016-04-13 Thread Didier Verna
Tamas Papp wrote: > My perception is that simply pointing out that something is different > in Common Lisp is unlikely to move the Julia language team to make > fundamental changes to the language ... which is not my intention. I'm simply curious about the language, and

Re: [julia-users] Creating an empty 2D array and append values to it

2016-04-13 Thread 'Greg Plowman' via julia-users
> julia> reshape(d,3,2) 3x2 Array{ASCIIString,2}: "x1" "y2" "y1" "x3" "x2" "y3" This is because of Julia's column-major ordering. you see the problem ? instead I would like to have : x1 y1 x2 y2 .. xn yn In this case, you could use: julia> reshape(d,2,3)' 3x2

Re: [julia-users] local types or macros?

2016-04-13 Thread Tamas Papp
Hi Didier, It is good to see some familiar names from comp.lang.lisp :D I switched to Julia from Lisp a while ago, expecting it to be some kind of Common Lisp with Dylan-like surface syntax, only faster and with parametric types. It isn't, and while Common Lisp influenced the design

Re: [julia-users] local types or macros?

2016-04-13 Thread Didier Verna
Cedric St-Jean wrote: > Local macros in Lisp are expanded at compile-time. They're useful > inside macro-expansions, eg. Not even inside other macros, but as local macros inside any kind of code block. E.g. (silly): CL-USER> (let (list) (macrolet ((add

Re: [julia-users] Re: [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-13 Thread Mosè Giordano
Hi Oliver, 2016-04-12 21:38 GMT+02:00 Oliver Schulz : > Very nice, Mose! I thought I might have to write a Julia wrapper for Cuba at > some point, but you beat me to it (which I'm grateful for!). :-) Thanks! > I noticed that you're maintaining a modified version of

Re: [julia-users] Re: [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-13 Thread Mosè Giordano
Hi Chris, thanks for your comments :-) Regarding integration algorithm, unless you have specific reasons to use Vegas I warmly recommend to use Cuhre, which in my experience is the best in terms of speed and precision. There must be a reason if Cubature,jl, the only widely used numerical

Re: [julia-users] Re: Setting min()=Inf and max()=-Inf

2016-04-13 Thread Milan Bouchet-Valat
Le mardi 12 avril 2016 à 20:21 -0700, Anonymous a écrit : > Those are good points, although I always kind of wondered why Float > gets Inf while Int doesn't, I guess there's no way to have Inf belong > to 2 distinct concrete types. The problem is that native integers have no way of representing