[julia-users] Re: GtkInteract

2014-09-07 Thread Kaj Wiik
Very useful, many thanks!!

Cheers!



Re: [julia-users] Re: Julia native lexical scanner and parser ideas

2014-09-07 Thread Takeshi Kimura
Thank you for the information.

I'll double check.



2014年9月7日日曜日 12時24分31秒 UTC+9 Isaiah:
>
> It seemed that actions along with lexical rules are written in OCaml, Go, 
>> and C (not in Julia).
>
>
> Ragel has it's own definition DSL, but the code generated by Daniel's 
> backend should be pure-Julia. (I admit I'm not very familiar with Ragel, so 
> maybe I misunderstood something in this conversation).
>
>
> On Sat, Sep 6, 2014 at 12:17 PM, Takeshi Kimura  > wrote:
>
>> Thank you for your introduce of ragel fork.
>>
>> It seemed that actions along with lexical rules are written in OCaml, Go, 
>> and C (not in Julia).
>>
>> So it is useful for DSL related works, but slightly far from I imagined.
>>
>> the ragel manipulates DFA, so I should write DFA based lexical scanner 
>> (fast but limited regex).
>>
>> May be flex(1) code helps me a lot.
>>
>> I know that I should study deeper for lexical scanner written in Dragon 
>> Book,
>>
>> so, I will study several topics, and will decide where I'd like to go 
>> (=design of target implementation).
>>
>> Thank you again.
>>
>> Takeshi KIMURA
>>
>>
>>
>> 2014年9月7日日曜日 0時49分28秒 UTC+9 Daniel Jones:
>>
>>>
>>> If you're interested, I have a ragel fork 
>>>  that let's one generate scanners and 
>>> parsers for regular languages. We've been using it to generate parsers as 
>>> part of the BioJulia project.
>>>
>>> It's generally as fast or faster than PCRE and let's you insert 
>>> arbitrary code in the DFA, like the PCRE callout feature but much more 
>>> flexible.
>>>
>>>
>>> On Saturday, September 6, 2014 8:35:21 AM UTC-7, Takeshi Kimura wrote:

 Hi there,

 I'd like to create old Lex/Yacc like lexical scanner and parser (may be 
 LL(1) or LALR(1)) by implementing Julia Module(s).

 The goal is too far, but I'd like to start to write lexical scanner at 
 first.

 The lexical scanner is related to Regular Expression objects (NFA(Perl 
 compatible), or DFA (not compatible)).

 So, I'd like to use PCRE(3) as its use. May be call out facilities will 
 help me a lot.

 But call out facilities only handle 256 call-outs, so we need extend 
 call out by sequentially callouts (callout 0x01, callout 0x01 = callout 
 257, etc.)

 Have you any ideas for this type of lexical scanners?

 If we can not use PCRE(3), may be the flex(1) internal APIs should be 
 called.


 Takeshi KIMURA

>>>
>

[julia-users] Why are images generated by IJulia in low resolution?

2014-09-07 Thread gael . mcdon
Hi, this is matplotlib-related (the python lib behind PyPlot). You have to 
change the figsize or the dpi either this way:

http://stackoverflow.com/questions/17230797/how-to-set-the-matplotlib-figure-default-size-in-ipython-notebook

Or that way:

http://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib

I don't know if this is wrapped directly in PyPlot though. Some persons may 
give more accurate answer.

Just as a reminder though, if you want to reuse those figure, you might want a 
more suitable format such as svg (vector graphics).

BTW, you can switch to vector graphics following the indications in this thread 
(you just have to change Julia's Jupyter profile instead of creating a new one):

http://stackoverflow.com/questions/17582137/ipython-notebook-svg-figures-by-default


[julia-users] Suprises with for loops

2014-09-07 Thread me
I've been writing a few for loops in Julia and seen a few behaviours that 
were surprising to me:

Firstly, it seems that using `in` is converted to `=` at some point in the 
parser. This caught me out when looking at a macro that expanded to a for 
loop.

julia> quote for x in y print(x) end end
quote  # none, line 1:
for x = y # line 1:
print(x)
end
end

I'm also surprised that `for x in y` doesn't require a container:

julia> for x in 1 println(x) end
1

I would have expected an error in this case.

Finally, Julia seems to have a Perl-style array flattening:

julia> for row in [[1, 2], [3, 4]] println(row) end
1
2
3
4

I would have expected row to be bound to the subarrays, not the integers. I 
can work around this with:

julia> for row in Array[[1, 2], [3, 4]] println(row) end
[1,2]
[3,4]

I'm not seeking to criticise, just to understand. What's the motivation 
behind this behaviour?

Wilfred


[julia-users] Combining modules with parallel computing

2014-09-07 Thread Richard Dennis
The follow (contrived) code illustrates a problem that I would like to 
overcome.  The problem seems to be one of getting the contents of a module 
seen by multiple processors.  Is there any solution other than stripping 
the functions out of the module, putting them into a separate file and then 
using require().  Any suggestions appreciated.

addprocs(3)
using NLsolve

function fixed_point_system(x,f)

  f[1] = x[1].^2.0+x[2].^2.0+1.0
  f[2] = x[1]-0.7*x[2]-0.7

  return f

end

function solve_fixed_point_system(init,tol)

  z1 = @spawn nlsolve(fixed_point_system, init, xtol = tol, ftol = tol)
  z2 = @spawn nlsolve(fixed_point_system, init, xtol = tol, ftol = tol)
  z3 = @spawn nlsolve(fixed_point_system, init, xtol = tol, ftol = tol)
  z4 = @spawn nlsolve(fixed_point_system, init, xtol = tol, ftol = tol)

  z1 = fetch(z1)
  z2 = fetch(z2)
  z3 = fetch(z3)
  z4 = fetch(z4)

  z = (z1.zero+z2.zero+z3.zero+z4.zero)/4

  return z

end

const tol = 1e-12
init = [0.2, 1.0]

fixed_point = solve_fixed_point_system(init,tol)
println(fixed_point)



Re: [julia-users] GtkInteract

2014-09-07 Thread Tim Holy
John, this sounds very interesting. At some point I will need to do a bit of 
an overhaul on ImageView, and I certainly plan to take a close look at this 
package.

Best,
--Tim

On Saturday, September 06, 2014 01:35:33 PM j verzani wrote:
> The new Interact.jl package allows you to use interactive widgets such as
> sliders, dropdowns and checkboxes to play with your Julia code within an
> IJulia session. It is pretty neat, in particular the `@manipulate` macro.
> For those times where IJulia is not convenient, but the console is, I've
> made a small wrapper package GtkInteract.jl that creates these widgets in
> Gtk with the expectation that Winston will be used for graphics. If you are
> interested in such a thing, you can try it out by cloning the package:
> Pkg.clone("https://github.com/jverzani/GtkInteract.jl.git";).



Re: [julia-users] Importing the Distributions module gives error UnitRange not defined

2014-09-07 Thread Tim Holy
This suggests you're running a 0.2 version of julia but the package assumes 
0.3. Would it be an option to upgrade to the stable 0.3 series? (There are 
ways to fix it so you get an older version of the package on 0.2, but 0.3 is 
recommended anyway.)

--Tim

On Saturday, September 06, 2014 08:26:23 PM Jack Pack wrote:
> Hi all,
> 
> I am new to Julia and want to use the Distributions module so that I can
> use a normal distribution.
> 
> In the Julia console, I ran Pkg.add and Pkg.update, then ran
> require("Distributions") but got this. Help?
> 
> require("Distributions")
> 
> ERROR: UnitRange not defined
> 
>  in reload_path at loading.jl:146
> 
>  in _require at loading.jl:59
> 
>  in require at loading.jl:46
> 
>  in reload_path at loading.jl:146
> 
>  in _require at loading.jl:59
> 
>  in require at loading.jl:43
> 
> while loading /Users/myself/.julia/ArrayViews/src/ArrayViews.jl, in
> expression starting on line 555
> 
> while loading /Users/myself/.julia/Distributions/src/Distributions.jl, in
> expression starting on line 3



Re: [julia-users] GtkInteract

2014-09-07 Thread Shashi Gowda
Tim, is there a way to show Compose output in ImageView? Will be nice to
have SVG rendering - that's the fastest Compose backend. It would also let
Gadfly plots show up.


On Sun, Sep 7, 2014 at 5:35 PM, Tim Holy  wrote:

> John, this sounds very interesting. At some point I will need to do a bit
> of
> an overhaul on ImageView, and I certainly plan to take a close look at this
> package.
>
> Best,
> --Tim
>
> On Saturday, September 06, 2014 01:35:33 PM j verzani wrote:
> > The new Interact.jl package allows you to use interactive widgets such as
> > sliders, dropdowns and checkboxes to play with your Julia code within an
> > IJulia session. It is pretty neat, in particular the `@manipulate` macro.
> > For those times where IJulia is not convenient, but the console is, I've
> > made a small wrapper package GtkInteract.jl that creates these widgets in
> > Gtk with the expectation that Winston will be used for graphics. If you
> are
> > interested in such a thing, you can try it out by cloning the package:
> > Pkg.clone("https://github.com/jverzani/GtkInteract.jl.git";).
>
>


[julia-users] Combining modules with parallel computing

2014-09-07 Thread Sam Kaplan
Hi Richard,

Give

@everywhere using NLSolve

a try.  Hope that helps.

Sam



Re: [julia-users] GtkInteract

2014-09-07 Thread Andreas Lobinger
Hello colleagues,

On Sunday, September 7, 2014 2:21:15 PM UTC+2, Shashi Gowda wrote:
>
> Tim, is there a way to show Compose output in ImageView? Will be nice to 
> have SVG rendering - that's the fastest Compose backend. It would also let 
> Gadfly plots show up.
>

Compose (as most of the drawing is done via Cairo Surfaces anyway) has the 
option to draw/render into an available Cairo Surface. 
With that and a few lines of Gtk definitions you can paint Gadfly on screen.


julia> using Gtk

julia> using Gadfly

julia> using Compose

julia> p = plot(x=rand(40,1),y=rand(40,1));

julia> co = render(p);

julia> c = Gtk.@GtkCanvas(400,300);

julia> w = Gtk.@GtkWindow(c,"data win");

julia> show(c);

julia> Gtk.draw(c) do widget
   Compose.draw(CAIROSURFACE(c.back),co)
   end

gives me a plot into a resizable Gtk Window.

The replotting is not super-fast, so it's not suited to animations.


[julia-users] Julia iPython notebook doesn't display inline graphics

2014-09-07 Thread Bruno Morgado
Hi all,

I'm trying to get started with Julia but I'm having some troubles.

After finally getting to get iJulia to run and starting a notebook in the 
browser, I can finally follow and execute all the code, but I still can't 
see any inline graphs.
The code runs correctly (first it complained about missing Cairo but I 
installed that), but it doesn't show anything inline.

How do I fix this?


[julia-users] Two issues with Juno, the Julia plugin for LightTable

2014-09-07 Thread Erlend Magnus Viggen
Hi,

I've been trying out the Juno plugin after finding out that Julia Studio 
unfortunately doesn't work well for me at the moment. Juno seems really 
nice, and I'd highly recommend checking it out. However, I have some issues 
with plotting and the REPL.

First, the plotting. Gadfly seems to work well with Juno, but I'd rather be 
using PyPlot to be honest. Unfortunately PyPlot doesn't work for me in 
Juno. I've made a minimal working example that works fine in the regular 
Julia REPL:

using PyPlot
plot([0 1]', [0 1]')

Now, the first line executes nicely in Juno, but the second one results in 
an exception,

*PyError (PyObject_Call) RuntimeError('Julia exception: 
> UndefVarError(:htmlimage)',) File 
> "/Users/username/anaconda3/lib/python3/site-packages/matplotlib/pyplot.py", 
> line 3094, in plot draw_if_interactive()* 
> in pyerr_check at exception.jl:58
> in pycall at PyCall.jl:85
> in plot at PyPlot.jl:314
>

Second, I've tried to connect Juno with the Julia REPL in the Terminal, as 
described here 
,
 
in order to have an interactive console in addition to Juno. But when I do, 
it dumps out errors on my Julia command line,

WARNING: Can't handle command julia.set-default-client
>
 

> WARNING: LightTable.jl: global_client not defined
>  in anonymous at /Users/*username*
> /.julia/v0.3/Jewel/src/LightTable/misc.jl:11
>  in handle_cmd at /Users/*username*
> /.julia/v0.3/Jewel/src/LightTable/LightTable.jl:65
>  in server at /Users/*username*
> /.julia/v0.3/Jewel/src/LightTable/LightTable.jl:22
>  in server at /Users/*username*/.julia/v0.3/Jewel/src/Jewel.jl:16
>  in anonymous at task.jl:340
>

At this point, I can still run execute Julia commands in Juno and on the 
Terminal REPL, but the latter kind of warning pops up regularly.

Any tips on any of these issues? My setup is:

   - Mac OS X 10.9.4
   - Julia 0.3.0, with the latest version of all packages as given by 
   Pkg.update()
   - LightTable 0.6.7 with Juno/Julia plugin version 0.8.0
   - Anaconda Python 3.4 distribution with Python 3.4.1 and Matplotlib 1.4.0
   


Re: [julia-users] Julia iPython notebook doesn't display inline graphics

2014-09-07 Thread Shashi Gowda
Which package are you using for plotting? Gadfly and PyPlot currently work
well with IJulia as far as I know.

On Sun, Sep 7, 2014 at 7:21 PM, Bruno Morgado  wrote:

> Hi all,
>
> I'm trying to get started with Julia but I'm having some troubles.
>
> After finally getting to get iJulia to run and starting a notebook in the
> browser, I can finally follow and execute all the code, but I still can't
> see any inline graphs.
> The code runs correctly (first it complained about missing Cairo but I
> installed that), but it doesn't show anything inline.
>
> How do I fix this?
>


[julia-users] Re: Combining modules with parallel computing

2014-09-07 Thread Richard Dennis
Thanks Sam.  Your suggestion combined with using require on the two 
functions and it works.

On Sunday, 7 September 2014 14:31:53 UTC+1, Sam Kaplan wrote:
>
> Hi Richard,
>
> Give
>
> @everywhere using NLSolve
>
> a try.  Hope that helps.
>
> Sam
>
>

[julia-users] Re: Suprises with for loops

2014-09-07 Thread Patrick O'Leary
On Sunday, September 7, 2014 6:00:55 AM UTC-5, m...@wilfred.me.uk wrote:
>
> I've been writing a few for loops in Julia and seen a few behaviours that 
> were surprising to me:
>
> Firstly, it seems that using `in` is converted to `=` at some point in the 
> parser. This caught me out when looking at a macro that expanded to a for 
> loop.
>

`in` is equivalent to `=`, yes. This just makes iteration nicer to read.
 

> I'm also surprised that `for x in y` doesn't require a container:
>
> julia> for x in 1 println(x) end
> 1
>

It's both less bad and weirder than that. Integers are iterable. You can 
search through the list; either Jeff or Stefan has talked about this at 
some point.
 

> I would have expected an error in this case.
>

If integers weren't iterable, that would be reasonable.
 

> Finally, Julia seems to have a Perl-style array flattening:
>

More precisely, it's MATLAB-style array concatenation. Fine if you're used 
to it (hi), annoying if you're not. It'll probably go away, but figuring 
out how to make it go away has proven nontrivial. See:

https://github.com/JuliaLang/julia/issues/2488
https://github.com/JuliaLang/julia/issues/3737
https://github.com/JuliaLang/julia/issues/7941
https://github.com/JuliaLang/julia/pull/7998

Patrick


[julia-users] Re: Why are images generated by IJulia in low resolution?

2014-09-07 Thread Steven G. Johnson
You can change the figure size easily by just 

figure(figsize=(xx, yy))

etcetera, exactly as in Python.

On Sunday, September 7, 2014 6:58:14 AM UTC-4, gael@gmail.com wrote:
 

> BTW, you can switch to vector graphics following the indications in this 
> thread (you just have to change Julia's Jupyter profile instead of creating 
> a new one):
>
>
> http://stackoverflow.com/questions/17582137/ipython-notebook-svg-figures-by-default
>
As explained in

  https://github.com/stevengj/PyPlot.jl#svg-output-in-ijulia

you can get SVG output by default in PyPlot by running PyPlot.svg(true) 
 this isn't the default because browsers are much slower at rendering 
complex SVG plots than they are at rendering PNG.

Of course, you can also save to a vector format at any time by 
savefig("foo.svg") or savefig("foo.eps").
 


[julia-users] Re: #JuliaLang anime character design spec.

2014-09-07 Thread Takeshi Kimura
I misunderstand that Julia Logo and three dots logo graphic can be used 
under the MIT core team's grant.
So anime character is NOT derivative work of Julia logos.

I think new Julia anime character is independent from Julia Logo, and their 
license is:

(quote from CC pages (license under the 
http://creativecommons.org/licenses/by/4.0/)):


*Attribution-NonCommercial-ShareAlike CC BY-NC-SA*

This license lets others remix, tweak, and build upon your work 
non-commercially,

as long as they credit you and license their new creations under the 
identical terms.


may be the best choose for this character.

The design specification deadline is September 10th in JST(+9:00).


 Takeshi KIMURA

2014年9月3日水曜日 1時08分40秒 UTC+9 Takeshi Kimura:
>
> Hi there,
>
> I decided to establish #JuliaLang anime character project in Japan.
> Now we are welcome your comments in this thread about this character spec. 
> (costume, etc.) if you are interested in this project.
> The design specification deadline is September 10th in JST(+9:00).
>
> For more details, see:
>
> http://mechawooser.blogspot.jp/2014/09/julialang-anime-character-project.html
>
> We realize that this character may be contain #JuliaLang logo or 
> #JuliaLang 3-circle icons, and in this case,
> our anime character may be satisfy CC's derivative work of #JuliaLang logo.
>
> I have two questions for julia-user:
>
> Q1. What type of costume or appearance do you prefer for this character? 
> Is this better for holding Logo in her arms?
>
> Q2. Which type of CC License is suitable for this character itself?
>
> Comments are welcome!
>
> Best Regards,
>
>  Takeshi KIMURA
>
>
>

[julia-users] Are dataframes indexed?

2014-09-07 Thread Steven Sagaert
Hi,
I was wondering if searching in a dataframe is indexed (in the DB sense, 
not array sense. e.g. a tree index structure) or not? If so can you have 
multiple indices (on multiple columns) or not?


Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread John Myles White
No, DataFrames are not indexed. For now, you’d need to build a wrapper that 
indexes a DataFrame to get that kind of functionality.

 — John

On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:

> Hi,
> I was wondering if searching in a dataframe is indexed (in the DB sense, not 
> array sense. e.g. a tree index structure) or not? If so can you have multiple 
> indices (on multiple columns) or not?



[julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Steven Sagaert
When you start with an empty array and grow it one element at a time with 
push!, does the underlying array memory block get copied & expanded by one 
or in larger chunks (like ArrayList in Java)?


Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
It gets expanded in chunks.

 — John

On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:

> When you start with an empty array and grow it one element at a time with 
> push!, does the underlying array memory block get copied & expanded by one or 
> in larger chunks (like ArrayList in Java)?



Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Harlan Harris
This was a feature that sorta existed for a while (see
https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was
very happy with it, and I think John ripped it out as part of one of his
simplification passes. It's tricky to think about how best to implement
this sort of feature when you aspirationally want to support memory-mapped
and distributed structures too, and where you want a semantics that's
explicitly set-like, cf Pandas or R's data.tables.

Also worth thinking about this in the context of John's just-announced
goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e



On Sun, Sep 7, 2014 at 12:54 PM, John Myles White 
wrote:

> No, DataFrames are not indexed. For now, you’d need to build a wrapper
> that indexes a DataFrame to get that kind of functionality.
>
>  — John
>
> On Sep 7, 2014, at 9:53 AM, Steven Sagaert 
> wrote:
>
> > Hi,
> > I was wondering if searching in a dataframe is indexed (in the DB sense,
> not array sense. e.g. a tree index structure) or not? If so can you have
> multiple indices (on multiple columns) or not?
>
>


Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread John Myles White
FWIW, I think it’s much easier to index structures if every row has an atomic 
existence that is independent of the table it is currently part of. (This is a 
big part of my interest in moving away from matrix semantics and towards 
relational model semantics.)

It’s a little harder to index DataFrames because the row indices change over 
time, so your index can’t just map values to indices. (Well, it can: but then 
it needs to be updated very frequently: potentially the entire index has to be 
rewritten if you delete the first row of a DataFrame.)

 — John

On Sep 7, 2014, at 10:27 AM, Harlan Harris  wrote:

> This was a feature that sorta existed for a while (see 
> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was very 
> happy with it, and I think John ripped it out as part of one of his 
> simplification passes. It's tricky to think about how best to implement this 
> sort of feature when you aspirationally want to support memory-mapped and 
> distributed structures too, and where you want a semantics that's explicitly 
> set-like, cf Pandas or R's data.tables. 
> 
> Also worth thinking about this in the context of John's just-announced goals: 
> https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
> 
> 
> 
> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
> wrote:
> No, DataFrames are not indexed. For now, you’d need to build a wrapper that 
> indexes a DataFrame to get that kind of functionality.
> 
>  — John
> 
> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
> 
> > Hi,
> > I was wondering if searching in a dataframe is indexed (in the DB sense, 
> > not array sense. e.g. a tree index structure) or not? If so can you have 
> > multiple indices (on multiple columns) or not?
> 
> 



[julia-users] Re: Ignoring NaNs

2014-09-07 Thread Alex
I know it's a little late, but I was looking for the same thing and 
couldn't find it. I've made some slight adjustments to some code I found on 
github and made functions for nanmean and nanstd. I did not optimize for 
performance and wanted them to be able to handle arrays of various sizes.  

NANMEAN:

function nanmean(x::Array)

   z=similar(x)
   fill!(z,1)
   z[isnan(x)]=0
   numb_not_NaN_in_x=sum(z)

   nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
https://gist.github.com/milktrader/5213361
   nansum_x/numb_not_NaN_in_x

end


NANSTD
function nanstd(x::Array)

   z=similar(x)
   fill!(z,1)
   z[isnan(x)]=0
   numb_not_NaN_in_x=sum(z)

   nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
https://gist.github.com/milktrader/5213361
   nanmean_x=nansum_x/numb_not_NaN_in_x

   y=(x-nanmean_x).*(x-nanmean_x)

## NanMean for Sample
function nanmean_sample(y::Array)
   w=similar(y)
   fill!(w,1)
   w[isnan(y)]=0
   numb_not_NaN_in_y=sum(w)

   nansum_y=sum(y) do y isnan(y) ? 0 : y end #from 
https://gist.github.com/milktrader/5213361
   nansum_y/(numb_not_NaN_in_y-1)

 end
 nanstd_x=sqrt(nanmean_sample(y))

end




On Wednesday, February 5, 2014 9:11:45 PM UTC-7, Roger Herikstad wrote:
>
> Hi,
>  Are there equivalent functions to Matlab's nanmean and nanstd, i.e. 
> functions for computing mean and standard deviation while ignoring NaN's? 
> It's simple to put something together, of course, e.g.
>
> function nanmean(x)
>  mean(~isnan(x))
> end
>
> but it would nice to have as part of Base, or perhaps StatsBase? 
>
> ~ Roger
>


[julia-users] Re: Full REPL Pager?

2014-09-07 Thread Ivar Nesje
Maybe a special REPL mode where you can get a pager view of ans?

julia> Sys.dllist()
81-element Array{String,1}:
 "/Users/ivarne/dev/julia/usr/lib/libjulia.dylib"   

 "/usr/lib/libSystem.B.dylib"   

 "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
 "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices" 
   
 "/usr/lib/libc++.1.dylib" 
 
 "/usr/lib/libz.1.dylib"   
 
 ⋮ 
 
 "/Users/ivarne/dev/julia/usr/lib/libpcre.1.dylib" 
 
 "/Users/ivarne/dev/julia/usr/lib/libdSFMT.dylib"   

 "/Users/ivarne/dev/julia/usr/lib/libgmp.10.dylib" 
 
 "/Users/ivarne/dev/julia/usr/lib/libmpfr.4.dylib" 
 
 "/Users/ivarne/dev/julia/usr/lib/libopenlibm.dylib.0.4"

julia>&

And Julia will show up a pager view of the 81 element vector, so that I can 
scroll, without just dumping massive datasets to the terminal.


On Friday, September 5, 2014 5:24:35 PM UTC+2, Rick Graham wrote:
>
> Help messages ⊂ All output
>
> On Friday, September 5, 2014 11:00:49 AM UTC-4, Rick Graham wrote:
>>
>> I know there has been previous discussion about paging through data in 
>> the REPL, but I'd like to know if it is possible to turn on a *full* 
>> REPL pager.
>>
>> By full pager, I mean that the REPL is "terminal aware" and all output is 
>> paged.  All output would even include such things as the "methods 
>> available" list when hitting TAB after an open paren, etc.
>>
>>

Re: [julia-users] Re: Ignoring NaNs

2014-09-07 Thread John Myles White
I think we’re still not really interested in promoting the use of NaN as a 
surrogate for NULL, especially given that Nullable is going to be added to Base 
in 0.4.

Your functions would perform substantially better if you iterated over the 
values of A. For example,

function nanmean(A::Array)
s, n = 0.0, 0
for val in A
if !isnan(val)
s += val
n += 1
end
end
return s / n
end

 — John

On Sep 7, 2014, at 10:36 AM, Alex  wrote:

> I know it's a little late, but I was looking for the same thing and couldn't 
> find it. I've made some slight adjustments to some code I found on github and 
> made functions for nanmean and nanstd. I did not optimize for performance and 
> wanted them to be able to handle arrays of various sizes.  
> 
> NANMEAN:
> 
>   function nanmean(x::Array)
> 
>   z=similar(x)
>   fill!(z,1)
>   z[isnan(x)]=0
>   numb_not_NaN_in_x=sum(z)
> 
>   nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
> https://gist.github.com/milktrader/5213361
>   nansum_x/numb_not_NaN_in_x
> 
>   end
> 
> 
> NANSTD
>   function nanstd(x::Array)
> 
>   z=similar(x)
>   fill!(z,1)
>   z[isnan(x)]=0
>   numb_not_NaN_in_x=sum(z)
> 
>   nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
> https://gist.github.com/milktrader/5213361
>   nanmean_x=nansum_x/numb_not_NaN_in_x
> 
>   y=(x-nanmean_x).*(x-nanmean_x)
> 
>   ## NanMean for Sample
>   function nanmean_sample(y::Array)
>   w=similar(y)
>   fill!(w,1)
>   w[isnan(y)]=0
>   numb_not_NaN_in_y=sum(w)
> 
>   nansum_y=sum(y) do y isnan(y) ? 0 : y end #from 
> https://gist.github.com/milktrader/5213361
>   nansum_y/(numb_not_NaN_in_y-1)
> 
>end
>   
>   nanstd_x=sqrt(nanmean_sample(y))
> 
>   end
> 
> 
> 
> 
> On Wednesday, February 5, 2014 9:11:45 PM UTC-7, Roger Herikstad wrote:
> Hi,
>  Are there equivalent functions to Matlab's nanmean and nanstd, i.e. 
> functions for computing mean and standard deviation while ignoring NaN's? 
> It's simple to put something together, of course, e.g.
> 
> function nanmean(x)
>  mean(~isnan(x))
> end
> 
> but it would nice to have as part of Base, or perhaps StatsBase? 
> 
> ~ Roger



[julia-users] Re: Ignoring NaNs

2014-09-07 Thread Alex
Hi There, 

I know its a little late, but I've had the same need for nanmean and 
nanstd, and when I stumbled across this I noticed that your function 
example will not provided the same answer as matlab. For example,

x= [1 2 NaN]
 
will produce the answer of 1.5 in matlab, but 2/3 using your function as it 
seems to produce the average number of  values that are NaN. 

I've written a nanmean and a nanstd function based off of some code I found 
on github for nansum. I have not optimized it for performance, but I wanted 
it to be able to handle arrays of various sizes.

NANMEAN
function nanmean(x::Array)

   z=similar(x)
   fill!(z,1)
   z[isnan(x)]=0
   numb_not_NaN_in_x=sum(z)

   nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
https://gist.github.com/milktrader/5213361
   nansum_x/numb_not_NaN_in_x

end
NANSTD

function nanstd(x::Array)

z=similar(x)
fill!(z,1)
z[isnan(x)]=0
numb_not_NaN_in_x=sum(z)

nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
https://gist.github.com/milktrader/5213361
nanmean_x=nansum_x/numb_not_NaN_in_x

y=(x-nanmean_x).*(x-nanmean_x)

## NanMean for Sample
function nanmean_sample(y::Array)
w=similar(y)
fill!(w,1)
w[isnan(y)]=0
numb_not_NaN_in_y=sum(w)

nansum_y=sum(y) do y isnan(y) ? 0 : y end #from 
https://gist.github.com/milktrader/5213361
nansum_y/(numb_not_NaN_in_y-1)
end
 nanstd_x=sqrt(nanmean_sample(y))
end

Best, 

Alex


On Wednesday, February 5, 2014 9:11:45 PM UTC-7, Roger Herikstad wrote:
>
> Hi,
>  Are there equivalent functions to Matlab's nanmean and nanstd, i.e. 
> functions for computing mean and standard deviation while ignoring NaN's? 
> It's simple to put something together, of course, e.g.
>
> function nanmean(x)
>  mean(~isnan(x))
> end
>
> but it would nice to have as part of Base, or perhaps StatsBase? 
>
> ~ Roger
>


Re: [julia-users] Re: Ignoring NaNs

2014-09-07 Thread Alex
Thanks for the tip John. I'll add that feature to my functions!

On Sunday, September 7, 2014 10:45:28 AM UTC-7, John Myles White wrote:
>
> I think we’re still not really interested in promoting the use of NaN as a 
> surrogate for NULL, especially given that Nullable is going to be added to 
> Base in 0.4.
>
> Your functions would perform substantially better if you iterated over the 
> values of A. For example,
>
> function nanmean(A::Array)
> s, n = 0.0, 0
> for val in A
> if !isnan(val)
> s += val
> n += 1
> end
> end
> return s / n
> end
>
>  — John
>
> On Sep 7, 2014, at 10:36 AM, Alex > 
> wrote:
>
> I know it's a little late, but I was looking for the same thing and 
> couldn't find it. I've made some slight adjustments to some code I found on 
> github and made functions for nanmean and nanstd. I did not optimize for 
> performance and wanted them to be able to handle arrays of various sizes.  
>
> NANMEAN:
>
> function nanmean(x::Array)
>
>z=similar(x)
>fill!(z,1)
>z[isnan(x)]=0
>numb_not_NaN_in_x=sum(z)
>
>nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
> https://gist.github.com/milktrader/5213361
>nansum_x/numb_not_NaN_in_x
>
> end
>
>
> NANSTD
> function nanstd(x::Array)
>
>z=similar(x)
>fill!(z,1)
>z[isnan(x)]=0
>numb_not_NaN_in_x=sum(z)
>
>nansum_x=sum(x) do x isnan(x) ? 0 : x end #from 
> https://gist.github.com/milktrader/5213361
>nanmean_x=nansum_x/numb_not_NaN_in_x
>
>y=(x-nanmean_x).*(x-nanmean_x)
>
> ## NanMean for Sample
> function nanmean_sample(y::Array)
>w=similar(y)
>fill!(w,1)
>w[isnan(y)]=0
>numb_not_NaN_in_y=sum(w)
>
>nansum_y=sum(y) do y isnan(y) ? 0 : y end #from 
> https://gist.github.com/milktrader/5213361
>nansum_y/(numb_not_NaN_in_y-1)
>
>  end
>  nanstd_x=sqrt(nanmean_sample(y))
>
> end
>
>
>
>
> On Wednesday, February 5, 2014 9:11:45 PM UTC-7, Roger Herikstad wrote:
>>
>> Hi,
>>  Are there equivalent functions to Matlab's nanmean and nanstd, i.e. 
>> functions for computing mean and standard deviation while ignoring NaN's? 
>> It's simple to put something together, of course, e.g.
>>
>> function nanmean(x)
>>  mean(~isnan(x))
>> end
>>
>> but it would nice to have as part of Base, or perhaps StatsBase? 
>>
>> ~ Roger
>>
>
>

Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Jason Merrill
John, if you haven't already, you might want to read up a bit on column 
oriented databases. It seems like these map more closely to dataframes in 
their current form, and it'd be good to understand what's been done with 
them, and what is/isn't possible before deciding to move to a row-oriented 
approach for dataframes.

See e.g. 
https://en.wikipedia.org/wiki/Column-oriented_DBMS#Row-oriented_systems 
which unfortunately is not the greatest article. I believe that one of the 
proprietary APL derivatives (K?) that's used in finance has a highly 
regarded integrated column oriented database.

Unfortunately, I've already said more than I know about the topic. But I've 
heard claims that column oriented databases have at least some interesting 
advantages over row oriented systems.

On Sunday, September 7, 2014 10:32:53 AM UTC-7, John Myles White wrote:
>
> FWIW, I think it’s much easier to index structures if every row has an 
> atomic existence that is independent of the table it is currently part of. 
> (This is a big part of my interest in moving away from matrix semantics and 
> towards relational model semantics.)
>
> It’s a little harder to index DataFrames because the row indices change 
> over time, so your index can’t just map values to indices. (Well, it can: 
> but then it needs to be updated very frequently: potentially the entire 
> index has to be rewritten if you delete the first row of a DataFrame.)
>
>  — John
>
> On Sep 7, 2014, at 10:27 AM, Harlan Harris  > wrote:
>
> This was a feature that sorta existed for a while (see 
> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was 
> very happy with it, and I think John ripped it out as part of one of his 
> simplification passes. It's tricky to think about how best to implement 
> this sort of feature when you aspirationally want to support memory-mapped 
> and distributed structures too, and where you want a semantics that's 
> explicitly set-like, cf Pandas or R's data.tables. 
>
> Also worth thinking about this in the context of John's just-announced 
> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>
>
>
> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  > wrote:
>
>> No, DataFrames are not indexed. For now, you’d need to build a wrapper 
>> that indexes a DataFrame to get that kind of functionality.
>>
>>  — John
>>
>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert > > wrote:
>>
>> > Hi,
>> > I was wondering if searching in a dataframe is indexed (in the DB 
>> sense, not array sense. e.g. a tree index structure) or not? If so can you 
>> have multiple indices (on multiple columns) or not?
>>
>>
>
>

Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread John Myles White
I've read up a little bit on column-oriented DB’s and will be doing a bunch 
more as I start thinking about how to design DataTables.

The trick is that right now DataFrames aren’t databases at all in the 
relational model sense, because they impose a bunch of structure that a DB 
doesn’t have to provide.

 — John

On Sep 7, 2014, at 10:53 AM, Jason Merrill  wrote:

> John, if you haven't already, you might want to read up a bit on column 
> oriented databases. It seems like these map more closely to dataframes in 
> their current form, and it'd be good to understand what's been done with 
> them, and what is/isn't possible before deciding to move to a row-oriented 
> approach for dataframes.
> 
> See e.g. 
> https://en.wikipedia.org/wiki/Column-oriented_DBMS#Row-oriented_systems which 
> unfortunately is not the greatest article. I believe that one of the 
> proprietary APL derivatives (K?) that's used in finance has a highly regarded 
> integrated column oriented database.
> 
> Unfortunately, I've already said more than I know about the topic. But I've 
> heard claims that column oriented databases have at least some interesting 
> advantages over row oriented systems.
> 
> On Sunday, September 7, 2014 10:32:53 AM UTC-7, John Myles White wrote:
> FWIW, I think it’s much easier to index structures if every row has an atomic 
> existence that is independent of the table it is currently part of. (This is 
> a big part of my interest in moving away from matrix semantics and towards 
> relational model semantics.)
> 
> It’s a little harder to index DataFrames because the row indices change over 
> time, so your index can’t just map values to indices. (Well, it can: but then 
> it needs to be updated very frequently: potentially the entire index has to 
> be rewritten if you delete the first row of a DataFrame.)
> 
>  — John
> 
> On Sep 7, 2014, at 10:27 AM, Harlan Harris  wrote:
> 
>> This was a feature that sorta existed for a while (see 
>> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was very 
>> happy with it, and I think John ripped it out as part of one of his 
>> simplification passes. It's tricky to think about how best to implement this 
>> sort of feature when you aspirationally want to support memory-mapped and 
>> distributed structures too, and where you want a semantics that's explicitly 
>> set-like, cf Pandas or R's data.tables. 
>> 
>> Also worth thinking about this in the context of John's just-announced 
>> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>> 
>> 
>> 
>> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
>> wrote:
>> No, DataFrames are not indexed. For now, you’d need to build a wrapper that 
>> indexes a DataFrame to get that kind of functionality.
>> 
>>  — John
>> 
>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
>> 
>> > Hi,
>> > I was wondering if searching in a dataframe is indexed (in the DB sense, 
>> > not array sense. e.g. a tree index structure) or not? If so can you have 
>> > multiple indices (on multiple columns) or not?
>> 
>> 
> 



Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Kevin Squire
More specifically, the underlying array size starts at 16 elements and
doubles whenever it grows beyond it's underlying size. (This might change
when the array gets large, but I haven't looked at that code recently, so I
forget the details.)

Cheers,
   Kevin

On Sunday, September 7, 2014, John Myles White 
wrote:

> It gets expanded in chunks.
>
>  — John
>
> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  > wrote:
>
> > When you start with an empty array and grow it one element at a time
> with push!, does the underlying array memory block get copied & expanded by
> one or in larger chunks (like ArrayList in Java)?
>
>


Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
Since we’re on this topic, I recently discovered this document in one of FB’s 
open source libraries for C++: 
https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md

It makes an interesting argument for growing arrays by a factor smaller than 2 
when resizing them so that you can reuse memory more easily. Not sure how much 
you also need to use a custom malloc routine to get the benefits being claimed, 
though.

 — John

On Sep 7, 2014, at 11:38 AM, Kevin Squire  wrote:

> More specifically, the underlying array size starts at 16 elements and 
> doubles whenever it grows beyond it's underlying size. (This might change 
> when the array gets large, but I haven't looked at that code recently, so I 
> forget the details.)
> 
> Cheers,
>Kevin
> 
> On Sunday, September 7, 2014, John Myles White  
> wrote:
> It gets expanded in chunks.
> 
>  — John
> 
> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:
> 
> > When you start with an empty array and grow it one element at a time with 
> > push!, does the underlying array memory block get copied & expanded by one 
> > or in larger chunks (like ArrayList in Java)?
> 



[julia-users] Re: FastGauss.jl: fast computation of Gauss quadrature rules

2014-09-07 Thread Alex Townsend
Jason Merrill, 

Thank you for your speed up suggestions. 
Managed to get close to a factor of 2 speed up 
out of GaussLegendre. I quickly looked at 
GaussJacobi too and also got a significant 
speed up there... still more to do on that code. 
 
Alex  

On Tuesday, 2 September 2014 20:52:28 UTC-4, Alex Townsend wrote:
>
> Both those tools look great. Trying them now.  Thanks a bunch. 
> Alex 
>
> On Tuesday, 2 September 2014 19:16:36 UTC-4, Jason Merrill wrote:
>>
>> On Tuesday, September 2, 2014 5:57:43 AM UTC-7, Alex Townsend wrote:
>>>
>>>
>>>
>>> On Tuesday, 2 September 2014 03:00:10 UTC-4, Jason Merrill wrote:

 On Monday, September 1, 2014 2:33:31 PM UTC-7, Alex Townsend wrote:
>
> I have written a package FastGauss.jl available here: 
>
> https://github.com/ajt60gaibb/FastGauss.jl
>

> I am a Julia beginner (only been learning for 2 weeks) so I am 
> assuming the code can be 
> improved in a million and one ways. Please tell me if I've done 
> something that Julia does 
> not like. I am not sure if it is appropriate to make this an official 
> package.
>
  
 One thing to look out for is making sure your functions have consistent 
 return types. E.g. in 
 https://github.com/ajt60gaibb/FastGauss.jl/blob/91e2ac656b856876563d5aacf7b5a405e068b3da/src/GaussLobatto.jl#L4
  
 you have

>>> Thanks! I tried to get the return types consistent, but obviously missed 
>>> a few. I've been trying to use @code_typed to tell me this 
>>> information, but reading the output is a little difficult (at the 
>>> moment). 
>>>
>>
>> I think the community as a whole would like to see better tooling around 
>> finding and fixing this kind of soft bug.
>>
>> You might check out https://github.com/tonyhffong/Lint.jl, and 
>> https://github.com/astrieanna/TypeCheck.jl. I haven't tried either of 
>> them myself yet, but I've heard people say good things about both of them.
>>  
>>
>

[julia-users] Re: Suprises with for loops

2014-09-07 Thread me
Thanks for the response.

> It's both less bad and weirder than that. Integers are iterable. 

Cripes! I've found the relevant mailing list thread you mentioned: 
https://groups.google.com/forum/#!msg/julia-users/bNDcBnF5hd0/q2GL2UtbmVIJ 
. Stefan mentions this decision could be revisited, so I'm hopeful this 
will eventually change. Julia isn't yet at a stage where backwards 
compatibility is critical, I presume?


Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Tim Holy
With a sufficiently compelling argument, I imagine it might be conceivable---
there are other equally-fundamental decisions that are viewed as being in-play 
during the 0.4 series. You might start by disabling that behavior and then 
seeing what aspects, if any, of `make testall` break.

But as an argument for change, "cripes!" doesn't cut it :-).

--Tim

On Sunday, September 07, 2014 12:16:19 PM m...@wilfred.me.uk wrote:
> Thanks for the response.
> 
> > It's both less bad and weirder than that. Integers are iterable.
> 
> Cripes! I've found the relevant mailing list thread you mentioned:
> https://groups.google.com/forum/#!msg/julia-users/bNDcBnF5hd0/q2GL2UtbmVIJ
> . Stefan mentions this decision could be revisited, so I'm hopeful this
> will eventually change. Julia isn't yet at a stage where backwards
> compatibility is critical, I presume?



Re: [julia-users] Re: #JuliaLang anime character design spec.

2014-09-07 Thread Stefan Karpinski
You just have to ask for permission – technically the copyright is mine since I 
made the logo. Using elements of it for something like this may well be fair 
use, but if you ask, I'm likely to say yes as long as it's for non-commercial 
use.

> On Sep 7, 2014, at 5:27 PM, Takeshi Kimura  wrote:
> 
> I misunderstand that Julia Logo and three dots logo graphic can be used under 
> the MIT core team's grant.
> So anime character is NOT derivative work of Julia logos.
> 
> I think new Julia anime character is independent from Julia Logo, and their 
> license is:
> 
> (quote from CC pages (license under the 
> http://creativecommons.org/licenses/by/4.0/)):
> 
> Attribution-NonCommercial-ShareAlike 
> CC BY-NC-SA
> 
> This license lets others remix, tweak, and build upon your work 
> non-commercially,
> 
> as long as they credit you and license their new creations under the 
> identical terms.
> 
> 
> 
> may be the best choose for this character.
> 
> The design specification deadline is September 10th in JST(+9:00).
> 
> 
>  Takeshi KIMURA
> 
> 2014年9月3日水曜日 1時08分40秒 UTC+9 Takeshi Kimura:
>> 
>> Hi there,
>> 
>> I decided to establish #JuliaLang anime character project in Japan.
>> Now we are welcome your comments in this thread about this character spec. 
>> (costume, etc.) if you are interested in this project.
>> The design specification deadline is September 10th in JST(+9:00).
>> 
>> For more details, see:
>> http://mechawooser.blogspot.jp/2014/09/julialang-anime-character-project.html
>> 
>> We realize that this character may be contain #JuliaLang logo or #JuliaLang 
>> 3-circle icons, and in this case,
>> our anime character may be satisfy CC's derivative work of #JuliaLang logo.
>> 
>> I have two questions for julia-user:
>> 
>> Q1. What type of costume or appearance do you prefer for this character? Is 
>> this better for holding Logo in her arms?
>> 
>> Q2. Which type of CC License is suitable for this character itself?
>> 
>> Comments are welcome!
>> 
>> Best Regards,
>> 
>>  Takeshi KIMURA
>> 
>> 


Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Stefan Karpinski
If you identify scalars with zero-dimensional arrays, then this behavior falls 
out naturally. In Julia those *are* different things, but it still makes sense 
for them to behave similarly. To make a hard break between a zero-dimensional 
array and a scalar seems to me to require some argument – how are they 
different and why?

> On Sep 7, 2014, at 9:34 PM, Tim Holy  wrote:
> 
> With a sufficiently compelling argument, I imagine it might be conceivable---
> there are other equally-fundamental decisions that are viewed as being 
> in-play 
> during the 0.4 series. You might start by disabling that behavior and then 
> seeing what aspects, if any, of `make testall` break.
> 
> But as an argument for change, "cripes!" doesn't cut it :-).
> 
> --Tim
> 
>> On Sunday, September 07, 2014 12:16:19 PM m...@wilfred.me.uk wrote:
>> Thanks for the response.
>> 
>>> It's both less bad and weirder than that. Integers are iterable.
>> 
>> Cripes! I've found the relevant mailing list thread you mentioned:
>> https://groups.google.com/forum/#!msg/julia-users/bNDcBnF5hd0/q2GL2UtbmVIJ
>> . Stefan mentions this decision could be revisited, so I'm hopeful this
>> will eventually change. Julia isn't yet at a stage where backwards
>> compatibility is critical, I presume?
> 


Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Kevin Squire
Interesting read!  How about opening an issue?

On Sunday, September 7, 2014, John Myles White 
wrote:

> Since we’re on this topic, I recently discovered this document in one of
> FB’s open source libraries for C++:
> https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
>
> It makes an interesting argument for growing arrays by a factor smaller
> than 2 when resizing them so that you can reuse memory more easily. Not
> sure how much you also need to use a custom malloc routine to get the
> benefits being claimed, though.
>
>  — John
>
> On Sep 7, 2014, at 11:38 AM, Kevin Squire  > wrote:
>
> More specifically, the underlying array size starts at 16 elements and
> doubles whenever it grows beyond it's underlying size. (This might change
> when the array gets large, but I haven't looked at that code recently, so I
> forget the details.)
>
> Cheers,
>Kevin
>
> On Sunday, September 7, 2014, John Myles White  > wrote:
>
>> It gets expanded in chunks.
>>
>>  — John
>>
>> On Sep 7, 2014, at 10:15 AM, Steven Sagaert 
>> wrote:
>>
>> > When you start with an empty array and grow it one element at a time
>> with push!, does the underlying array memory block get copied & expanded by
>> one or in larger chunks (like ArrayList in Java)?
>>
>>
>


Re: [julia-users] Importing the Distributions module gives error UnitRange not defined

2014-09-07 Thread Ivar Nesje
This should not happen and as Tim said, the cause version incompatibility 
between the installed version of Distributions and Julia 0.2.X.

Our Package system has great support for version requirements, but it is a 
manual process to ensure that one update requirements before tagging a new 
release that depends on new APIs, and it is sometimes forgotten. Please open an 
issue on https://github.com/JuliaLang/METADATA.jl/issues/new and ping @ivarne, 
and I might remember to fix it tomorrow. In the mean time you might try Pkg.pin 
to manually use older versions of the package.

Updating to 0.3 is still recommended, but we should not break people's Julia 
0.2.X installations on Pkg.update like this regardless. 


Re: [julia-users] Is it possible to manually set current module?

2014-09-07 Thread Andrei Zh
Thanks, Isaiah. Can you please add more details about closing Julia 
modules? Is it like finalizing them so that no more details can be added to 
it later? If so, what is rationale behind it? 

On Sunday, September 7, 2014 6:14:55 AM UTC+3, Isaiah wrote:
>
> I believe this is not currently exposed, although it may be worth pointing 
> out that any internal variable from an imported module is readable with 
> `MyModule.foo`. Julia modules are closed after declaration, although you 
> can sort of cheat by calling `MyModule.eval(::Expr)  -- the downside being 
> that the call will be interpreted.
>
> You could do a limited (read-only) form of this in a macro by basically 
> checking all names in a macro against the current scope and then prepending 
> `MyModule.X` if it is not found. I've wanted this occasionally, because it 
> would make copy-pasting code from a module somewhat easier, for debugging 
> purposes.
>
>
> On Fri, Sep 5, 2014 at 4:58 PM, Andrei 
> > wrote:
>
>> In module.c in Julia sources I see "jl_set_current_module()" function. Is 
>> it somehow exposed to Julia API? 
>>
>> To give you some context, in Common Lisp (as well as some other dialects) 
>> there are 2 separate macros for dealing with packages (analogue of modules 
>> in Julia): 
>>
>>  defpackage - defines new package and switches to it
>>  in-package - simply switches to specified package
>>
>> One great feature that these macros bring is ability to easily switch 
>> context of execution. E.g. in REPL (code simplified): 
>>
>>  ;; initially working from cl-user package
>>  cl-user> (defpackage foo (:use :common-lisp)) ;; automatically switched 
>> to new package
>>  foo> (defvar x 1)
>>  X
>>  foo> x
>>  1
>>  foo> (in-package :cl-user)
>>  foo> x
>>  ;; error: x not defined in :cl-user
>>
>> This is extremely helpful for both - package extension and 
>> debugging/interactive development. E.g. we can switch to a module in 
>> question and get all internal variables visible, play around in that 
>> context and go back to main package without stopping REPL. 
>>
>> So I'm wondering if something like this is possible in Julia at all. 
>>
>
>

[julia-users] For Loop over set of vector names

2014-09-07 Thread Alex
Hi Everyone, 

I've been having some trouble using a for loop to perform tasks over 
similarly named vectors. This simple example below illustrates my problem 
pretty well. I would like to create two 5x5 arrays of zeros, but with 
dynamic names. In this case x_foo and x_bar would be the names. When I run 
this code, it clearly is looping over the string set, but it is not 
actually creating the array. I have had similar problem trying to call 
arrays into functions dynamically based on their names. Clearly I am just 
incorrectly referencing i, but I cannot figure it where the error is. I am 
trying to port a complicated version of this code from Stata, where this is 
quite easy to do by referencing i in your code as `i'. Sorry for such a 
novice question, but this has been driving me nuts all day!

Thanks in advance!

Alex

n=5
for i in ["foo","bar"]
x_$i=zeros(n,n)
println("x_$i")
end
x_bar


[julia-users] Re: For Loop over set of vector names

2014-09-07 Thread Alex
 

EDIT: Sorry I forgot to add the output. 

julia> n=5

5

julia> for i in ["foo","bar"]

   x_$i=zeros(n,n)

   println("x_$i")

   end

x_foo

x_bar

julia> x_foo

ERROR: x_foo not defined

On Sunday, September 7, 2014 3:03:01 PM UTC-7, Alex wrote:
>
> Hi Everyone, 
>
> I've been having some trouble using a for loop to perform tasks over 
> similarly named vectors. This simple example below illustrates my problem 
> pretty well. I would like to create two 5x5 arrays of zeros, but with 
> dynamic names. In this case x_foo and x_bar would be the names. When I run 
> this code, it clearly is looping over the string set, but it is not 
> actually creating the array. I have had similar problem trying to call 
> arrays into functions dynamically based on their names. Clearly I am just 
> incorrectly referencing i, but I cannot figure it where the error is. I am 
> trying to port a complicated version of this code from Stata, where this is 
> quite easy to do by referencing i in your code as `i'. Sorry for such a 
> novice question, but this has been driving me nuts all day!
>
> Thanks in advance!
>
> Alex
>
> n=5
> for i in ["foo","bar"]
> x_$i=zeros(n,n)
> println("x_$i")
> end
> x_bar
>


Re: [julia-users] For Loop over set of vector names

2014-09-07 Thread John Myles White
Hi Alex,

You can’t use things like x_$i as variable names. The $i interpolation trick 
applies only to strings — no other construct in the entire language will 
perform this kind of interpolation.

You could use a macro to generate variables like this, but it’s not clear to me 
why you’d want to. Why are you creating variables in a loop?

Perhaps you’d prefer using a Dict instead?

n = 5
vars = Dict()
for name in [“foo”, “bar”]
vars[“x_$(name)”] = zeros(n, n)
end
vars[“x_bar”]

 — John

On Sep 7, 2014, at 3:03 PM, Alex  wrote:

> Hi Everyone, 
> 
> I've been having some trouble using a for loop to perform tasks over 
> similarly named vectors. This simple example below illustrates my problem 
> pretty well. I would like to create two 5x5 arrays of zeros, but with dynamic 
> names. In this case x_foo and x_bar would be the names. When I run this code, 
> it clearly is looping over the string set, but it is not actually creating 
> the array. I have had similar problem trying to call arrays into functions 
> dynamically based on their names. Clearly I am just incorrectly referencing 
> i, but I cannot figure it where the error is. I am trying to port a 
> complicated version of this code from Stata, where this is quite easy to do 
> by referencing i in your code as `i'. Sorry for such a novice question, but 
> this has been driving me nuts all day!
> 
> Thanks in advance!
> 
> Alex
> 
> n=5
> for i in ["foo","bar"]
>   x_$i=zeros(n,n)
>   println("x_$i")
> end
> x_bar



Re: [julia-users] Is it possible to manually set current module?

2014-09-07 Thread Isaiah Norton
Yes. The recommended work-around/workflow is to make changes within the
module declaration, and call `reload` to get those changes. It's a similar
issue to what is discussed here:
https://github.com/JuliaLang/julia/issues/265
(and could potentially be changed whenever that is resolved)

This might also be useful or informative as an example:
https://github.com/malmaud/Autoreload.jl




On Sun, Sep 7, 2014 at 5:02 PM, Andrei Zh  wrote:

> Thanks, Isaiah. Can you please add more details about closing Julia
> modules? Is it like finalizing them so that no more details can be added to
> it later? If so, what is rationale behind it?
>
> On Sunday, September 7, 2014 6:14:55 AM UTC+3, Isaiah wrote:
>>
>> I believe this is not currently exposed, although it may be worth
>> pointing out that any internal variable from an imported module is readable
>> with `MyModule.foo`. Julia modules are closed after declaration, although
>> you can sort of cheat by calling `MyModule.eval(::Expr)  -- the downside
>> being that the call will be interpreted.
>>
>> You could do a limited (read-only) form of this in a macro by basically
>> checking all names in a macro against the current scope and then prepending
>> `MyModule.X` if it is not found. I've wanted this occasionally, because it
>> would make copy-pasting code from a module somewhat easier, for debugging
>> purposes.
>>
>>
>> On Fri, Sep 5, 2014 at 4:58 PM, Andrei  wrote:
>>
>>> In module.c in Julia sources I see "jl_set_current_module()" function.
>>> Is it somehow exposed to Julia API?
>>>
>>> To give you some context, in Common Lisp (as well as some other
>>> dialects) there are 2 separate macros for dealing with packages (analogue
>>> of modules in Julia):
>>>
>>>  defpackage - defines new package and switches to it
>>>  in-package - simply switches to specified package
>>>
>>> One great feature that these macros bring is ability to easily switch
>>> context of execution. E.g. in REPL (code simplified):
>>>
>>>  ;; initially working from cl-user package
>>>  cl-user> (defpackage foo (:use :common-lisp)) ;; automatically switched
>>> to new package
>>>  foo> (defvar x 1)
>>>  X
>>>  foo> x
>>>  1
>>>  foo> (in-package :cl-user)
>>>  foo> x
>>>  ;; error: x not defined in :cl-user
>>>
>>> This is extremely helpful for both - package extension and
>>> debugging/interactive development. E.g. we can switch to a module in
>>> question and get all internal variables visible, play around in that
>>> context and go back to main package without stopping REPL.
>>>
>>> So I'm wondering if something like this is possible in Julia at all.
>>>
>>
>>


[julia-users] Slow startup time on Mac OSX with Julia 0.3 .dmg package

2014-09-07 Thread curiouslearn

Hello,

It takes very long for the julia script to even start running (about a 
litte over 10 seconds). Looking at some posts here, it appears this problem 
can be solved if I change how I use other packages. However, it is not 
clear to me what the solution is. I would appreciate if anyone could give a 
quick example using the script below. 

If I just have:

function add5(x)
x + 5
end

println(add5(3))


the script starts quickly.

However, if I have:

import Distributions
import DataFrames

const Dist = Distributions
const Df = DataFrames


function add5(x)
x + 5
end

println(add5(3)) 


it take over 10-12 seconds to start up.

Is there something I can do to decrease the startup time? Thank you. 




[julia-users] Re: FastGauss.jl: fast computation of Gauss quadrature rules

2014-09-07 Thread Jason Merrill
Glad I could help.

I've been following Chebfun for a few years, and really admire the work that 
you and that team have done.


Re: [julia-users] Re: Suprises with for loops

2014-09-07 Thread Jason Merrill
I haven't run into this problem in Julia, but making too many things iterable 
can make it hard to write generalized flatten. I.e. you might want to say 
something like "if an element is not iterable, push it onto the accumulator; 
otherwise, flatten it recursively." Doesn't work like you'd expect when 
integers are iterable. Factor had iterable integers and eventually ditched them 
because of problems like this.

Having an expressive way to talk about types maybe mitigates this problem a 
little compared to some other languages.


[julia-users] Re: Suprises with for loops

2014-09-07 Thread me
Sorry, 'cripes' was just me saying that it surprised me. Let me attempt to 
make the case for change.

The suitability of the any language feature depends on how well it stacks 
up to Julia's goals. I think consistency, orthogonality, and finding errors 
early are good goals, but I admit I've chosen these arbitrarily.

*Consistency*: I would expect a n-dimensional array to have n for loops in 
order to iterate over it by item. If I view an integer as a 0-dimensional 
array, I therefore wouldn't expect any for loops.

Being able to iterate over numbers also means I don't always get a simpler 
type when I iterate over a value. This makes the following slightly 
surprising code legal:

julia> for a in 1
   for b in a
   for c in b
   println(c)
   end
   end
   end
1

*Orthogonality:  *If we do allow a simple value to be iterated over, what 
is the underlying principle that says which value types can be iterated 
over? Integers and floats are iterable, but so too are booleans and complex 
numbers. On what principle are booleans and complex numbers iterable (are 
they scalar)? Could I expect symbols to be iterable too?

*Catching errors early:* If you can design a language such that not all 
possible combinations of symbols are legitimate programs, it's easier to 
spot mistakes. It reduces the likelihood that a programmer's mistake 
produces a different, but legal program. I'm concerned that it's too easy 
to use an integer when you should have used a range, leading to subtle 
bugs. Here's an example:

julia> function sumto(n)
   total = 0
   for i in n
   total = total + i
   end
   return total
   end

I think that's the strongest case I can make, I'm open to being persuaded 
otherwise.

Wilfred


Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Steven Sagaert


On Sunday, September 7, 2014 7:28:18 PM UTC+2, Harlan Harris wrote:
>
> This was a feature that sorta existed for a while (see 
> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was 
> very happy with it, and I think John ripped it out as part of one of his 
> simplification passes. It's tricky to think about how best to implement 
> this sort of feature when you aspirationally want to support memory-mapped 
> and distributed structures too,
>
I was more thinking along the lines of a simple in-memory db. If you want 
out-of-memory & distributed it's probably best to interface systems like 
Spark SQL or Scidb rather than develop that yourselves from scratch. Maybe 
write something in the spirit of Blaze (blaze.pydata.org)? Right now Blaze 
supports Spark but I was just discussing with them about scidb and they are 
also looking into that.
 

> and where you want a semantics that's explicitly set-like, cf Pandas or 
> R's data.tables. 
>
R's data.table is nice but unfortunately only supports just one index. 

>
> Also worth thinking about this in the context of John's just-announced 
> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>
>
>
> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  > wrote:
>
>> No, DataFrames are not indexed. For now, you’d need to build a wrapper 
>> that indexes a DataFrame to get that kind of functionality.
>>
>>  — John
>>
>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert > > wrote:
>>
>> > Hi,
>> > I was wondering if searching in a dataframe is indexed (in the DB 
>> sense, not array sense. e.g. a tree index structure) or not? If so can you 
>> have multiple indices (on multiple columns) or not?
>>
>>
>

Re: [julia-users] For Loop over set of vector names

2014-09-07 Thread Alex
Hi John, 

I don't actually want to generate variables like that, but perform actions 
on list of variables and I thought that example was a good way of boiling 
down the problem I was having. So what I'm really trying to do is something 
more like this. I guess I thought that ["foo", "bar"] was behaving like a 
macro list of things I want this action to be done on, which is apparently 
not the right way of thinking. 

n=5
x_foo=zeros(n,n)
x_bar=zeros(n,n)

for i in ["foo","bar"]

x_$i = x_$i + n
println("x_$i")

end

x_foo


On Sunday, September 7, 2014 3:07:10 PM UTC-7, John Myles White wrote:
>
> Hi Alex, 
>
> You can’t use things like x_$i as variable names. The $i interpolation 
> trick applies only to strings — no other construct in the entire language 
> will perform this kind of interpolation. 
>
> You could use a macro to generate variables like this, but it’s not clear 
> to me why you’d want to. Why are you creating variables in a loop? 
>
> Perhaps you’d prefer using a Dict instead? 
>
> n = 5 
> vars = Dict() 
> for name in [“foo”, “bar”] 
> vars[“x_$(name)”] = zeros(n, n) 
> end 
> vars[“x_bar”] 
>
>  — John 
>
> On Sep 7, 2014, at 3:03 PM, Alex > 
> wrote: 
>
> > Hi Everyone, 
> > 
> > I've been having some trouble using a for loop to perform tasks over 
> similarly named vectors. This simple example below illustrates my problem 
> pretty well. I would like to create two 5x5 arrays of zeros, but with 
> dynamic names. In this case x_foo and x_bar would be the names. When I run 
> this code, it clearly is looping over the string set, but it is not 
> actually creating the array. I have had similar problem trying to call 
> arrays into functions dynamically based on their names. Clearly I am just 
> incorrectly referencing i, but I cannot figure it where the error is. I am 
> trying to port a complicated version of this code from Stata, where this is 
> quite easy to do by referencing i in your code as `i'. Sorry for such a 
> novice question, but this has been driving me nuts all day! 
> > 
> > Thanks in advance! 
> > 
> > Alex 
> > 
> > n=5 
> > for i in ["foo","bar"] 
> > x_$i=zeros(n,n) 
> > println("x_$i") 
> > end 
> > x_bar 
>
>

Re: [julia-users] For Loop over set of vector names

2014-09-07 Thread John Myles White
Yeah, this is definitely not how Julia works. Why not write a function that 
does what you want, then call it on x_foo and then later on x_bar?

 -- John

On Sep 7, 2014, at 4:34 PM, Alex  wrote:

> Hi John, 
> 
> I don't actually want to generate variables like that, but perform actions on 
> list of variables and I thought that example was a good way of boiling down 
> the problem I was having. So what I'm really trying to do is something more 
> like this. I guess I thought that ["foo", "bar"] was behaving like a macro 
> list of things I want this action to be done on, which is apparently not the 
> right way of thinking. 
> 
> n=5
> x_foo=zeros(n,n)
> x_bar=zeros(n,n)
> 
> for i in ["foo","bar"]
> 
>   x_$i = x_$i + n
>   println("x_$i")
> 
> end
> 
> x_foo
> 
> 
> On Sunday, September 7, 2014 3:07:10 PM UTC-7, John Myles White wrote:
> Hi Alex, 
> 
> You can’t use things like x_$i as variable names. The $i interpolation trick 
> applies only to strings — no other construct in the entire language will 
> perform this kind of interpolation. 
> 
> You could use a macro to generate variables like this, but it’s not clear to 
> me why you’d want to. Why are you creating variables in a loop? 
> 
> Perhaps you’d prefer using a Dict instead? 
> 
> n = 5 
> vars = Dict() 
> for name in [“foo”, “bar”] 
> vars[“x_$(name)”] = zeros(n, n) 
> end 
> vars[“x_bar”] 
> 
>  — John 
> 
> On Sep 7, 2014, at 3:03 PM, Alex  wrote: 
> 
> > Hi Everyone, 
> > 
> > I've been having some trouble using a for loop to perform tasks over 
> > similarly named vectors. This simple example below illustrates my problem 
> > pretty well. I would like to create two 5x5 arrays of zeros, but with 
> > dynamic names. In this case x_foo and x_bar would be the names. When I run 
> > this code, it clearly is looping over the string set, but it is not 
> > actually creating the array. I have had similar problem trying to call 
> > arrays into functions dynamically based on their names. Clearly I am just 
> > incorrectly referencing i, but I cannot figure it where the error is. I am 
> > trying to port a complicated version of this code from Stata, where this is 
> > quite easy to do by referencing i in your code as `i'. Sorry for such a 
> > novice question, but this has been driving me nuts all day! 
> > 
> > Thanks in advance! 
> > 
> > Alex 
> > 
> > n=5 
> > for i in ["foo","bar"] 
> > x_$i=zeros(n,n) 
> > println("x_$i") 
> > end 
> > x_bar 
> 



Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread John Myles White
Well, you can write an interface to sqlite to generate in-memory DB's. The only 
restriction is that you won't get some of the semantics you might want relative 
to DataFrames, which allow entries of all types.

Personally, I'm much less interested in Spark and SciDB and much more 
interested in Hive. Blaze's approach is very interesting.

 -- John

On Sep 7, 2014, at 4:32 PM, Steven Sagaert  wrote:

> 
> 
> On Sunday, September 7, 2014 7:28:18 PM UTC+2, Harlan Harris wrote:
> This was a feature that sorta existed for a while (see 
> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was very 
> happy with it, and I think John ripped it out as part of one of his 
> simplification passes. It's tricky to think about how best to implement this 
> sort of feature when you aspirationally want to support memory-mapped and 
> distributed structures too,
> I was more thinking along the lines of a simple in-memory db. If you want 
> out-of-memory & distributed it's probably best to interface systems like 
> Spark SQL or Scidb rather than develop that yourselves from scratch. Maybe 
> write something in the spirit of Blaze (blaze.pydata.org)? Right now Blaze 
> supports Spark but I was just discussing with them about scidb and they are 
> also looking into that.
>  
> and where you want a semantics that's explicitly set-like, cf Pandas or R's 
> data.tables. 
> R's data.table is nice but unfortunately only supports just one index. 
> 
> Also worth thinking about this in the context of John's just-announced goals: 
> https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
> 
> 
> 
> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
> wrote:
> No, DataFrames are not indexed. For now, you’d need to build a wrapper that 
> indexes a DataFrame to get that kind of functionality.
> 
>  — John
> 
> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
> 
> > Hi,
> > I was wondering if searching in a dataframe is indexed (in the DB sense, 
> > not array sense. e.g. a tree index structure) or not? If so can you have 
> > multiple indices (on multiple columns) or not?
> 
> 



Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Steven Sagaert


On Sunday, September 7, 2014 7:53:15 PM UTC+2, Jason Merrill wrote:
>
> John, if you haven't already, you might want to read up a bit on column 
> oriented databases. It seems like these map more closely to dataframes in 
> their current form, and it'd be good to understand what's been done with 
> them, and what is/isn't possible before deciding to move to a row-oriented 
> approach for dataframes.
>
> See e.g. 
> https://en.wikipedia.org/wiki/Column-oriented_DBMS#Row-oriented_systems 
> which unfortunately is not the greatest article. I believe that one of the 
> proprietary APL derivatives (K?) that's used in finance has a highly 
> regarded integrated column oriented database.
>
> Unfortunately, I've already said more than I know about the topic. But 
> I've heard claims that column oriented databases have at least some 
> interesting advantages over row oriented systems.
>
The advantage is that they can calculate aggregates much more quickly than 
row storage RDBs. So they are useful for data 
warehouses/analytics/scientific stuff. That's why R's dataframe is also 
column oriented I guess. Vertica is one such system. Monet db 
(www.*monetdb*.com) 
 is another open source one.

>
> On Sunday, September 7, 2014 10:32:53 AM UTC-7, John Myles White wrote:
>>
>> FWIW, I think it’s much easier to index structures if every row has an 
>> atomic existence that is independent of the table it is currently part of. 
>> (This is a big part of my interest in moving away from matrix semantics and 
>> towards relational model semantics.)
>>
>> It’s a little harder to index DataFrames because the row indices change 
>> over time, so your index can’t just map values to indices. (Well, it can: 
>> but then it needs to be updated very frequently: potentially the entire 
>> index has to be rewritten if you delete the first row of a DataFrame.)
>>
>>  — John
>>
>> On Sep 7, 2014, at 10:27 AM, Harlan Harris  wrote:
>>
>> This was a feature that sorta existed for a while (see 
>> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was 
>> very happy with it, and I think John ripped it out as part of one of his 
>> simplification passes. It's tricky to think about how best to implement 
>> this sort of feature when you aspirationally want to support memory-mapped 
>> and distributed structures too, and where you want a semantics that's 
>> explicitly set-like, cf Pandas or R's data.tables. 
>>
>> Also worth thinking about this in the context of John's just-announced 
>> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>>
>>
>>
>> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
>> wrote:
>>
>>> No, DataFrames are not indexed. For now, you’d need to build a wrapper 
>>> that indexes a DataFrame to get that kind of functionality.
>>>
>>>  — John
>>>
>>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
>>>
>>> > Hi,
>>> > I was wondering if searching in a dataframe is indexed (in the DB 
>>> sense, not array sense. e.g. a tree index structure) or not? If so can you 
>>> have multiple indices (on multiple columns) or not?
>>>
>>>
>>
>>

Re: [julia-users] Suprises with for loops

2014-09-07 Thread John Myles White
One problem with your consistency point, Wilfred: you can iterate over an array 
of arbitrary order with a single for loop.

 -- John

On Sep 7, 2014, at 4:19 PM, m...@wilfred.me.uk wrote:

> Sorry, 'cripes' was just me saying that it surprised me. Let me attempt to 
> make the case for change.
> 
> The suitability of the any language feature depends on how well it stacks up 
> to Julia's goals. I think consistency, orthogonality, and finding errors 
> early are good goals, but I admit I've chosen these arbitrarily.
> 
> Consistency: I would expect a n-dimensional array to have n for loops in 
> order to iterate over it by item. If I view an integer as a 0-dimensional 
> array, I therefore wouldn't expect any for loops.
> 
> Being able to iterate over numbers also means I don't always get a simpler 
> type when I iterate over a value. This makes the following slightly 
> surprising code legal:
> 
> julia> for a in 1
>for b in a
>for c in b
>println(c)
>end
>end
>end
> 1
> 
> Orthogonality:  If we do allow a simple value to be iterated over, what is 
> the underlying principle that says which value types can be iterated over? 
> Integers and floats are iterable, but so too are booleans and complex 
> numbers. On what principle are booleans and complex numbers iterable (are 
> they scalar)? Could I expect symbols to be iterable too?
> 
> Catching errors early: If you can design a language such that not all 
> possible combinations of symbols are legitimate programs, it's easier to spot 
> mistakes. It reduces the likelihood that a programmer's mistake produces a 
> different, but legal program. I'm concerned that it's too easy to use an 
> integer when you should have used a range, leading to subtle bugs. Here's an 
> example:
> 
> julia> function sumto(n)
>total = 0
>for i in n
>total = total + i
>end
>return total
>end
> 
> I think that's the strongest case I can make, I'm open to being persuaded 
> otherwise.
> 
> Wilfred



Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Steven Sagaert
As far as Spark/Spark SQL is concerned: there is now a  very nice high 
level API that's in the process of being open sourced called "distributed 
dataframe" http://ddf.io/. It's java based but also has R & Python 
interfaces. You could wrap that via JavaCall or via PyCall.

On Monday, September 8, 2014 1:32:28 AM UTC+2, Steven Sagaert wrote:
>
>
>
> On Sunday, September 7, 2014 7:28:18 PM UTC+2, Harlan Harris wrote:
>>
>> This was a feature that sorta existed for a while (see 
>> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was 
>> very happy with it, and I think John ripped it out as part of one of his 
>> simplification passes. It's tricky to think about how best to implement 
>> this sort of feature when you aspirationally want to support memory-mapped 
>> and distributed structures too,
>>
> I was more thinking along the lines of a simple in-memory db. If you want 
> out-of-memory & distributed it's probably best to interface systems like 
> Spark SQL or Scidb rather than develop that yourselves from scratch. Maybe 
> write something in the spirit of Blaze (blaze.pydata.org)? Right now 
> Blaze supports Spark but I was just discussing with them about scidb and 
> they are also looking into that.
>  
>
>> and where you want a semantics that's explicitly set-like, cf Pandas or 
>> R's data.tables. 
>>
> R's data.table is nice but unfortunately only supports just one index. 
>
>>
>> Also worth thinking about this in the context of John's just-announced 
>> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>>
>>
>>
>> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
>> wrote:
>>
>>> No, DataFrames are not indexed. For now, you’d need to build a wrapper 
>>> that indexes a DataFrame to get that kind of functionality.
>>>
>>>  — John
>>>
>>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
>>>
>>> > Hi,
>>> > I was wondering if searching in a dataframe is indexed (in the DB 
>>> sense, not array sense. e.g. a tree index structure) or not? If so can you 
>>> have multiple indices (on multiple columns) or not?
>>>
>>>
>>

[julia-users] Problem Generating Matrices of random data using Distributions with Julia 0.3

2014-09-07 Thread Christopher Fisher
Hi all-

I recently upgraded to Julia 0.3 and encountered a problem generating 
matrices of random data using Distributions. I did not receive this error 
with Julia 0.2. I receive the following error in both IJulia and terminal:

using Distributions
x = rand(Normal(0,1),10,10)

`rand` has no method matching rand(::Normal, ::Int64, ::Int64)
while loading In[8], in expression starting on line 2





However, the following works:


using Distributions
x = rand(Normal(0,1),10)


10-element Array{Float64,1}:
 -1.27113 
  0.81187 
  0.250986
  1.01228 
 -1.77785 
  0.328616
  0.122259
  0.926345
 -1.11857 
  0.462382


Any help would be much appreciated. 


Chris





Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread Steven Sagaert


On Monday, September 8, 2014 1:37:50 AM UTC+2, John Myles White wrote:
>
> Well, you can write an interface to sqlite to generate in-memory DB's. The 
> only restriction is that you won't get some of the semantics you might want 
> relative to DataFrames, which allow entries of all types.
>
> Personally, I'm much less interested in Spark and SciDB and much more 
> interested in Hive.
>

Well Spark has a Hive clone called Shark which can run HiveQL queries. It's 
just a lot faster ;) But they are moving more towards  a general SQL system 
called Spark SQL and will reimplement Shark also on top of that in the 
future.
 

> Blaze's approach is very interesting.
>
I agree. 

>
>  -- John
>
> On Sep 7, 2014, at 4:32 PM, Steven Sagaert  > wrote:
>
>
>
> On Sunday, September 7, 2014 7:28:18 PM UTC+2, Harlan Harris wrote:
>>
>> This was a feature that sorta existed for a while (see 
>> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was 
>> very happy with it, and I think John ripped it out as part of one of his 
>> simplification passes. It's tricky to think about how best to implement 
>> this sort of feature when you aspirationally want to support memory-mapped 
>> and distributed structures too,
>>
> I was more thinking along the lines of a simple in-memory db. If you want 
> out-of-memory & distributed it's probably best to interface systems like 
> Spark SQL or Scidb rather than develop that yourselves from scratch. Maybe 
> write something in the spirit of Blaze (blaze.pydata.org)? Right now 
> Blaze supports Spark but I was just discussing with them about scidb and 
> they are also looking into that.
>  
>
>> and where you want a semantics that's explicitly set-like, cf Pandas or 
>> R's data.tables. 
>>
> R's data.table is nice but unfortunately only supports just one index. 
>
>>
>> Also worth thinking about this in the context of John's just-announced 
>> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>>
>>
>>
>> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
>> wrote:
>>
>>> No, DataFrames are not indexed. For now, you’d need to build a wrapper 
>>> that indexes a DataFrame to get that kind of functionality.
>>>
>>>  — John
>>>
>>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
>>>
>>> > Hi,
>>> > I was wondering if searching in a dataframe is indexed (in the DB 
>>> sense, not array sense. e.g. a tree index structure) or not? If so can you 
>>> have multiple indices (on multiple columns) or not?
>>>
>>>
>>
>

Re: [julia-users] Are dataframes indexed?

2014-09-07 Thread John Myles White
I kind of suspect my team (which is the team that invented Hive) isn't likely 
to stop using Hive anytime soon.

 -- John

On Sep 7, 2014, at 4:50 PM, Steven Sagaert  wrote:

> 
> 
> On Monday, September 8, 2014 1:37:50 AM UTC+2, John Myles White wrote:
> Well, you can write an interface to sqlite to generate in-memory DB's. The 
> only restriction is that you won't get some of the semantics you might want 
> relative to DataFrames, which allow entries of all types.
> 
> Personally, I'm much less interested in Spark and SciDB and much more 
> interested in Hive.
> 
> Well Spark has a Hive clone called Shark which can run HiveQL queries. It's 
> just a lot faster ;) But they are moving more towards  a general SQL system 
> called Spark SQL and will reimplement Shark also on top of that in the future.
>  
> Blaze's approach is very interesting.
> I agree. 
> 
>  -- John
> 
> On Sep 7, 2014, at 4:32 PM, Steven Sagaert  wrote:
> 
>> 
>> 
>> On Sunday, September 7, 2014 7:28:18 PM UTC+2, Harlan Harris wrote:
>> This was a feature that sorta existed for a while (see 
>> https://github.com/JuliaStats/DataFrames.jl/issues/24 ), but nobody was very 
>> happy with it, and I think John ripped it out as part of one of his 
>> simplification passes. It's tricky to think about how best to implement this 
>> sort of feature when you aspirationally want to support memory-mapped and 
>> distributed structures too,
>> I was more thinking along the lines of a simple in-memory db. If you want 
>> out-of-memory & distributed it's probably best to interface systems like 
>> Spark SQL or Scidb rather than develop that yourselves from scratch. Maybe 
>> write something in the spirit of Blaze (blaze.pydata.org)? Right now Blaze 
>> supports Spark but I was just discussing with them about scidb and they are 
>> also looking into that.
>>  
>> and where you want a semantics that's explicitly set-like, cf Pandas or R's 
>> data.tables. 
>> R's data.table is nice but unfortunately only supports just one index. 
>> 
>> Also worth thinking about this in the context of John's just-announced 
>> goals: https://gist.github.com/johnmyleswhite/ad5305ecaa9de01e317e
>> 
>> 
>> 
>> On Sun, Sep 7, 2014 at 12:54 PM, John Myles White  
>> wrote:
>> No, DataFrames are not indexed. For now, you’d need to build a wrapper that 
>> indexes a DataFrame to get that kind of functionality.
>> 
>>  — John
>> 
>> On Sep 7, 2014, at 9:53 AM, Steven Sagaert  wrote:
>> 
>> > Hi,
>> > I was wondering if searching in a dataframe is indexed (in the DB sense, 
>> > not array sense. e.g. a tree index structure) or not? If so can you have 
>> > multiple indices (on multiple columns) or not?
>> 
>> 
> 



[julia-users] Re: Problem Generating Matrices of random data using Distributions with Julia 0.3

2014-09-07 Thread curiouslearn


Have you tried:


using Distributions

x = rand(Normal(0,1),(10,10))


That should work.


On Sunday, September 7, 2014 7:47:24 PM UTC-4, Christopher Fisher wrote:
>
> Hi all-
>
> I recently upgraded to Julia 0.3 and encountered a problem generating 
> matrices of random data using Distributions. I did not receive this error 
> with Julia 0.2. I receive the following error in both IJulia and terminal:
>
> using Distributions
> x = rand(Normal(0,1),10,10)
>
> `rand` has no method matching rand(::Normal, ::Int64, ::Int64)
> while loading In[8], in expression starting on line 2
>
>
>
>
>
> However, the following works:
>
>
> using Distributions
> x = rand(Normal(0,1),10)
>
>
> 10-element Array{Float64,1}:
>  -1.27113 
>   0.81187 
>   0.250986
>   1.01228 
>  -1.77785 
>   0.328616
>   0.122259
>   0.926345
>  -1.11857 
>   0.462382
>
>
> Any help would be much appreciated. 
>
>
> Chris
>
>
>
>

Re: [julia-users] Re: Problem Generating Matrices of random data using Distributions with Julia 0.3

2014-09-07 Thread John Myles White
I'm pretty sure you shouldn't have to write an explicit tuple. If 
rand(Normal(0, 1), 10, 10) doesn't work, I believe that's a bug.

 -- John

On Sep 7, 2014, at 4:54 PM, curiousle...@gmail.com wrote:

> Have you tried:
> 
> using Distributions
> x = rand(Normal(0,1),(10,10))
> 
> That should work.
> 
> On Sunday, September 7, 2014 7:47:24 PM UTC-4, Christopher Fisher wrote:
> Hi all-
> 
> I recently upgraded to Julia 0.3 and encountered a problem generating 
> matrices of random data using Distributions. I did not receive this error 
> with Julia 0.2. I receive the following error in both IJulia and terminal:
> 
> using Distributions
> x = rand(Normal(0,1),10,10)
> `rand` has no method matching rand(::Normal, ::Int64, ::Int64)
> while loading In[8], in expression starting on line 2
> 
> 
> 
> 
> However, the following works:
> 
> using Distributions
> x = rand(Normal(0,1),10)
> 
> 10-element Array{Float64,1}:
>  -1.27113 
>   0.81187 
>   0.250986
>   1.01228 
>  -1.77785 
>   0.328616
>   0.122259
>   0.926345
>  -1.11857 
>   0.462382
> 
> Any help would be much appreciated. 
> 
> Chris
> 
> 



Re: [julia-users] Importing the Distributions module gives error UnitRange not defined

2014-09-07 Thread Iain Dunning
I'm confused, because it looks to me that Distributions and ArrayViews 
haven't been bumped in months - when exactly did it go wrong?
versioninfo(true) output would be very helpful

On Sunday, September 7, 2014 4:48:54 PM UTC-4, Ivar Nesje wrote:
>
> This should not happen and as Tim said, the cause version incompatibility 
> between the installed version of Distributions and Julia 0.2.X.
>
> Our Package system has great support for version requirements, but it is a 
> manual process to ensure that one update requirements before tagging a new 
> release that depends on new APIs, and it is sometimes forgotten. Please 
> open an issue on https://github.com/JuliaLang/METADATA.jl/issues/new and 
> ping @ivarne, and I might remember to fix it tomorrow. In the mean time you 
> might try Pkg.pin to manually use older versions of the package.
>
> Updating to 0.3 is still recommended, but we should not break people's 
> Julia 0.2.X installations on Pkg.update like this regardless. 
>
>

Re: [julia-users] Re: GtkInteract

2014-09-07 Thread j verzani
It would be nice. I sorted out the Gtk code from the Interact code. But I 
would need to remove the output widgets to have any luck with having the 
same @manipulate commands working in both environments. I couldn't figure 
out how to generate these automatically.

On Sunday, September 7, 2014 2:56:02 AM UTC-4, Shashi Gowda wrote:
>
> It would be nice if the same code that begins with `using Interact` can 
> run in multiple environments. But this arrangement is cool too. Right now, 
> all IJulia specific stuff is in Interact/src/IJulia. It was initially a 
> separate package, then we put it inside Interact for convenience. The main 
> thing the IJulia specific part does is override writemime(::IO, ::MIME, 
> ::Signal) and  writemime(::IO, ::MIME, ::Widget) to set up communication 
> and invoke IPython widgets.
>
> This highly dated document 
> https://github.com/JuliaLang/Interact.jl/blob/master/DESIGN.md describes 
> some of the initial ideas about separating environment specifics from 
> widget models.
>
>
> On Sun, Sep 7, 2014 at 12:15 PM, Shashi Gowda  > wrote:
>
>> This is very cool!
>>
>> I really love how there is no lag in the example and things seem so 
>> responsive. Added a link in the Interact.jl README.
>>
>> One of Interact's goals is to make such adaptions hassle-free. Please do 
>> file issues if you think some change to Interact can make your code neater.
>>
>>
>> On Sun, Sep 7, 2014 at 11:41 AM, Iain Dunning > > wrote:
>>
>>> Don't think I need this personally, but just wanted to say - looks cool!
>>>
>>> On Saturday, September 6, 2014 4:35:33 PM UTC-4, j verzani wrote:

 The new Interact.jl package allows you to use interactive widgets such 
 as sliders, dropdowns and checkboxes to play with your Julia code within 
 an 
 IJulia session. It is pretty neat, in particular the `@manipulate` macro. 
 For those times where IJulia is not convenient, but the console is, I've 
 made a small wrapper package GtkInteract.jl that creates these widgets in 
 Gtk with the expectation that Winston will be used for graphics. If you 
 are 
 interested in such a thing, you can try it out by cloning the package: 
 Pkg.clone("https://github.com/jverzani/GtkInteract.jl.git";). 


>>
>

Re: [julia-users] GtkInteract

2014-09-07 Thread j verzani
Tim it is useful for really simple things, but ImageView would be too 
complicated.

On Sunday, September 7, 2014 8:05:09 AM UTC-4, Tim Holy wrote:
>
> John, this sounds very interesting. At some point I will need to do a bit 
> of 
> an overhaul on ImageView, and I certainly plan to take a close look at 
> this 
> package. 
>
> Best, 
> --Tim 
>
> On Saturday, September 06, 2014 01:35:33 PM j verzani wrote: 
> > The new Interact.jl package allows you to use interactive widgets such 
> as 
> > sliders, dropdowns and checkboxes to play with your Julia code within an 
> > IJulia session. It is pretty neat, in particular the `@manipulate` 
> macro. 
> > For those times where IJulia is not convenient, but the console is, I've 
> > made a small wrapper package GtkInteract.jl that creates these widgets 
> in 
> > Gtk with the expectation that Winston will be used for graphics. If you 
> are 
> > interested in such a thing, you can try it out by cloning the package: 
> > Pkg.clone("https://github.com/jverzani/GtkInteract.jl.git";). 
>
>

[julia-users] Parametric type fails

2014-09-07 Thread Zenna Tavares
What am I doing wrong with my parametric types?

I have this Cartesian product function

function cart_product{E}(n, A::Vector{Vector{E}})
  lengths = [length(a) for a in A]
  elems = Array(E, length(A))
  accum_lengths = Array(Integer, length(A))
  accum_lengths[1] = prod(lengths[2:])
  for i = 2:length(A)
accum_lengths[i] = accum_lengths[i-1] / lengths[i]
  end
  
  cycle_lengths = [24/accum_lengths[i] for i = 1:length(A)]
  scales = cycle_lengths ./ lengths
  
  is = [div((n % cycle_lengths[i]),scales[i]) + 1 for i = 1:length(A)]
  
  for i = 1:length(A)
elems[i] = A[i][is[i]]
  end
  elems
end



I am getting type errors with the either of the following

v = Array[["a", "b"],["c", "d", "e"],["f", "g", "h", "i"]]
v = Array[[1, 2],[3, 4, 5],[6, 7, 8, 9]]
cart_product(1,v)

cart_product` has no method matching cart_product(::Int64, 
::Array{Array{T,N},1})

What's going wrong here?


Re: [julia-users] Parametric type fails

2014-09-07 Thread John Myles White
I think the types of your inputs might be wrong. In particular, I think the 
type of the inner containers isn't right: you're getting Array{Array{T,N},1} 
when you wanted Array{Array{E,1},1} for some specific E.

 -- John

On Sep 7, 2014, at 5:50 PM, Zenna Tavares  wrote:

> What am I doing wrong with my parametric types?
> 
> I have this Cartesian product function
> 
> function cart_product{E}(n, A::Vector{Vector{E}})
>   lengths = [length(a) for a in A]
>   elems = Array(E, length(A))
>   accum_lengths = Array(Integer, length(A))
>   accum_lengths[1] = prod(lengths[2:])
>   for i = 2:length(A)
> accum_lengths[i] = accum_lengths[i-1] / lengths[i]
>   end
>   
>   cycle_lengths = [24/accum_lengths[i] for i = 1:length(A)]
>   scales = cycle_lengths ./ lengths
>   
>   is = [div((n % cycle_lengths[i]),scales[i]) + 1 for i = 1:length(A)]
>   
>   for i = 1:length(A)
> elems[i] = A[i][is[i]]
>   end
>   elems
> end
> 
> 
> 
> I am getting type errors with the either of the following
> 
> v = Array[["a", "b"],["c", "d", "e"],["f", "g", "h", "i"]]
> v = Array[[1, 2],[3, 4, 5],[6, 7, 8, 9]]
> cart_product(1,v)
> 
> cart_product` has no method matching cart_product(::Int64, 
> ::Array{Array{T,N},1})
> 
> What's going wrong here?



[julia-users] Re: Problem Generating Matrices of random data using Distributions with Julia 0.3

2014-09-07 Thread Christopher Fisher
Thank you John and curiou...@gmail.com. The syntax below worked just fine. 
Thanks again!

On Sunday, September 7, 2014 7:54:53 PM UTC-4, curiou...@gmail.com wrote:
>
> Have you tried:
>
>
> using Distributions
>
> x = rand(Normal(0,1),(10,10))
>
>
> That should work.
>
>
> On Sunday, September 7, 2014 7:47:24 PM UTC-4, Christopher Fisher wrote:
>>
>> Hi all-
>>
>> I recently upgraded to Julia 0.3 and encountered a problem generating 
>> matrices of random data using Distributions. I did not receive this error 
>> with Julia 0.2. I receive the following error in both IJulia and terminal:
>>
>> using Distributions
>> x = rand(Normal(0,1),10,10)
>>
>> `rand` has no method matching rand(::Normal, ::Int64, ::Int64)
>> while loading In[8], in expression starting on line 2
>>
>>
>>
>>
>>
>> However, the following works:
>>
>>
>> using Distributions
>> x = rand(Normal(0,1),10)
>>
>>
>> 10-element Array{Float64,1}:
>>  -1.27113 
>>   0.81187 
>>   0.250986
>>   1.01228 
>>  -1.77785 
>>   0.328616
>>   0.122259
>>   0.926345
>>  -1.11857 
>>   0.462382
>>
>>
>> Any help would be much appreciated. 
>>
>>
>> Chris
>>
>>
>>
>>

[julia-users] Re: Slow startup time on Mac OSX with Julia 0.3 .dmg package

2014-09-07 Thread Jake Bolewski
Unfortunately the only way to "solve" this problem currently is to compile 
Julia from source and include your most commonly used packages in the 
system image build.  If you are adventurous there are posts on this mailing 
list about how to go about doing that.  

On Sunday, September 7, 2014 6:52:22 PM UTC-4, curiou...@gmail.com wrote:
>
>
> Hello,
>
> It takes very long for the julia script to even start running (about a 
> litte over 10 seconds). Looking at some posts here, it appears this problem 
> can be solved if I change how I use other packages. However, it is not 
> clear to me what the solution is. I would appreciate if anyone could give a 
> quick example using the script below. 
>
> If I just have:
>
> function add5(x)
> x + 5
> end
>
> println(add5(3))
>
>
> the script starts quickly.
>
> However, if I have:
>
> import Distributions
> import DataFrames
>
> const Dist = Distributions
> const Df = DataFrames
>
>
> function add5(x)
> x + 5
> end
>
> println(add5(3)) 
>
>
> it take over 10-12 seconds to start up.
>
> Is there something I can do to decrease the startup time? Thank you. 
>
>
>

[julia-users] Re: Why are images generated by IJulia in low resolution?

2014-09-07 Thread Staro Pickle
Thank you for your reply.

I have followed the steps under 
http://stackoverflow.com/questions/17582137/ipython-notebook-svg-figures-by-default.
 
I found ~.ipython/profile_julia/ipython_notebook_config.py and uncommented 
and changed several lines:

c.InlineBackend.figure_format = 'svg'
c.InlineBackend.figure_formats = set(['svg'])
c.IPKernelApp.matplotlib = 'inline'

I also added "PyPlot.svg(true)" to my code. But still, my image was not 
switched to svg. I don't know why.

Besides, I tried Winston as well. The same problem.


On Sunday, September 7, 2014 6:58:14 PM UTC+8, gael@gmail.com wrote:
>
> Hi, this is matplotlib-related (the python lib behind PyPlot). You have to 
> change the figsize or the dpi either this way:
>
>
> http://stackoverflow.com/questions/17230797/how-to-set-the-matplotlib-figure-default-size-in-ipython-notebook
>
> Or that way:
>
>
> http://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib
>
> I don't know if this is wrapped directly in PyPlot though. Some persons 
> may give more accurate answer.
>
> Just as a reminder though, if you want to reuse those figure, you might 
> want a more suitable format such as svg (vector graphics).
>
> BTW, you can switch to vector graphics following the indications in this 
> thread (you just have to change Julia's Jupyter profile instead of creating 
> a new one):
>
>
> http://stackoverflow.com/questions/17582137/ipython-notebook-svg-figures-by-default
>
>

Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
Done: https://github.com/JuliaLang/julia/issues/8269

 — John

On Sep 7, 2014, at 1:38 PM, Kevin Squire  wrote:

> Interesting read!  How about opening an issue?
> 
> On Sunday, September 7, 2014, John Myles White  
> wrote:
> Since we’re on this topic, I recently discovered this document in one of FB’s 
> open source libraries for C++: 
> https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
> 
> It makes an interesting argument for growing arrays by a factor smaller than 
> 2 when resizing them so that you can reuse memory more easily. Not sure how 
> much you also need to use a custom malloc routine to get the benefits being 
> claimed, though.
> 
>  — John
> 
> On Sep 7, 2014, at 11:38 AM, Kevin Squire  wrote:
> 
>> More specifically, the underlying array size starts at 16 elements and 
>> doubles whenever it grows beyond it's underlying size. (This might change 
>> when the array gets large, but I haven't looked at that code recently, so I 
>> forget the details.)
>> 
>> Cheers,
>>Kevin
>> 
>> On Sunday, September 7, 2014, John Myles White  
>> wrote:
>> It gets expanded in chunks.
>> 
>>  — John
>> 
>> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:
>> 
>> > When you start with an empty array and grow it one element at a time with 
>> > push!, does the underlying array memory block get copied & expanded by one 
>> > or in larger chunks (like ArrayList in Java)?
>> 
> 



[julia-users] Re: how to use union!(s, iterable)

2014-09-07 Thread K Leo

Any ideas please?

On 2014年09月05日 08:55, K Leo wrote:
Say I have a 2-dimensional array B, I suppose it is an iterable, but 
how do I construct s?