Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-20 Thread Scott Jones
Why restrict it to Int elements?  I would think that any element whose type 
: Integer would be fine.

On Sunday, July 19, 2015 at 4:08:41 PM UTC-4, Matt Bauman wrote:

 I think we should probably support indexing with Array{Any}, just so long 
 as all the contained elements are Ints. It's not performant or recommended, 
 but it can still work just fine. 



[julia-users] Indexing Array with empty vector in v.0.4.

2015-07-20 Thread Christoph Ortner
Then again there are those of us who prefer to not think about types too much 
on first implementations and worry about performance afterwards. 
Christoph

Premature optimisation is the root of all evil.

Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-20 Thread Stefan Karpinski
I agree. The solution is to provide good tools to identify what code is
slow and why, not to try to disallow all slow code.

On Mon, Jul 20, 2015 at 1:47 PM, Christoph Ortner 
christophortn...@gmail.com wrote:

 Then again there are those of us who prefer to not think about types too
 much on first implementations and worry about performance afterwards.
 Christoph

 Premature optimisation is the root of all evil.


Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-20 Thread Stefan Karpinski
That seems reasonable to me.

On Sun, Jul 19, 2015 at 4:08 PM, Matt Bauman mbau...@gmail.com wrote:

 I think we should probably support indexing with Array{Any}, just so long
 as all the contained elements are Ints. It's not performant or recommended,
 but it can still work just fine.


Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-20 Thread Felipe Jiménez
If it's not performant (i.e. slow), I'd prefer Julia not to admit it. Even 
non-expert programmers like me often want the code to run fast. I prefer to get 
an error and fix it than slow code not knowing why.

Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-19 Thread Yichao Yu
On Sun, Jul 19, 2015 at 11:02 AM, Stefan Karpinski
stefan.karpin...@gmail.com wrote:
 Slicing with an empty array of element type Union() should be supportable, 
 though, no?

It's Any array on 0.4, which makes me hesitate whether we should support that.


 On Jul 18, 2015, at 7:41 AM, Yichao Yu yyc1...@gmail.com wrote:

 On Sat, Jul 18, 2015 at 6:00 AM, Felipe Jiménez
 felipe.jimene...@gmail.com wrote:
 Say A is an Array, like A = [1 2 3 4], and I index it with an empty vector.

 In Julia v.0.3, A[[]] is empty. I find this convenient when programming.

 In Julia v.0.4, A[[]] throws an error.

 Is this intended? It sometimes forces me to code if isempty()... else...

 The difference is that on 0.4, `[]` is a `Array{Any}`. Write `Int[]`
 should work.


 My version is 0.4.0-dev+5841 (2015-07-07 14:58 UTC), Commit f428392* (10
 days old master), x86_64-w64-mingw32.

 Thank you.


Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-19 Thread Matt Bauman
I think we should probably support indexing with Array{Any}, just so long as 
all the contained elements are Ints. It's not performant or recommended, but it 
can still work just fine. 

Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-19 Thread Stefan Karpinski
Slicing with an empty array of element type Union() should be supportable, 
though, no?

 On Jul 18, 2015, at 7:41 AM, Yichao Yu yyc1...@gmail.com wrote:
 
 On Sat, Jul 18, 2015 at 6:00 AM, Felipe Jiménez
 felipe.jimene...@gmail.com wrote:
 Say A is an Array, like A = [1 2 3 4], and I index it with an empty vector.
 
 In Julia v.0.3, A[[]] is empty. I find this convenient when programming.
 
 In Julia v.0.4, A[[]] throws an error.
 
 Is this intended? It sometimes forces me to code if isempty()... else...
 
 The difference is that on 0.4, `[]` is a `Array{Any}`. Write `Int[]`
 should work.
 
 
 My version is 0.4.0-dev+5841 (2015-07-07 14:58 UTC), Commit f428392* (10
 days old master), x86_64-w64-mingw32.
 
 Thank you.


Re: [julia-users] Indexing Array with empty vector in v.0.4.

2015-07-18 Thread Yichao Yu
On Sat, Jul 18, 2015 at 6:00 AM, Felipe Jiménez
felipe.jimene...@gmail.com wrote:
 Say A is an Array, like A = [1 2 3 4], and I index it with an empty vector.

 In Julia v.0.3, A[[]] is empty. I find this convenient when programming.

 In Julia v.0.4, A[[]] throws an error.

 Is this intended? It sometimes forces me to code if isempty()... else...

The difference is that on 0.4, `[]` is a `Array{Any}`. Write `Int[]`
should work.


 My version is 0.4.0-dev+5841 (2015-07-07 14:58 UTC), Commit f428392* (10
 days old master), x86_64-w64-mingw32.

 Thank you.


[julia-users] Indexing Array with empty vector in v.0.4.

2015-07-18 Thread Felipe Jiménez
Say A is an Array, like A = [1 2 3 4], and I index it with an empty vector.

In Julia v.0.3, A[[]] is empty. I find this convenient when programming.

In Julia v.0.4, A[[]] throws an error.

Is this intended? It sometimes forces me to code if isempty()... else...

My version is 0.4.0-dev+5841 (2015-07-07 14:58 UTC), Commit f428392* (10 
days old master), x86_64-w64-mingw32.

Thank you.