Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Scott Jones
I wasn't trying to say that it was specific to strings, I was saying that 
it is not specific to I/O, which the name would seem to indicate...
and it keeps getting brought up as something that should be used for basic 
mutable string operations.

On Sunday, May 3, 2015 at 3:20:43 PM UTC-4, Tamas Papp wrote:
>
> consider 
>
> let io = IOBuffer() 
>   write(io,rand(10)) 
>   takebuf_array(io) 
> end 
>
> IOBuffer() is not specific to strings at all. 
>
> Best, 
>
> Tamas 
>
> On Sun, May 03 2015, Scott Jones > 
> wrote: 
>
> > Because you can have binary strings and text strings... there is even a 
> > special literal for binary strings... 
> > b"\xffThis is a binary\x01\string" 
> > "This is a \u307 text string" 
> > 
> > Calling it an IOBuffer makes it sound like it is specific to I/O, not 
> just 
> > strings (binary or text) that you might never do I/O on... 
> > 
> > On Sunday, May 3, 2015 at 2:43:14 PM UTC-4, Kristoffer Carlsson wrote: 
> >> 
> >> Why should it be called StringBuffer when another common use of it is 
> to 
> >> write raw binary data? 
>


Re: [julia-users] Re: Indexing over a large matrix (beginner question)

2015-05-03 Thread Tamas Papp

On Mon, May 04 2015, Maco Anshu  wrote:

> I just found this discussion on SO and it was very helpful:
> http://stackoverflow.com/questions/28271308/avoid-memory-allocation-when-indexing-an-array-in-julia
>
>
> Julia allocates a new array on indexing every time.

Strictly speaking, no: singleton indexes like x[1,2] just extract the
element.

See https://github.com/JuliaLang/ArrayViews.jl for an alternative
that does not copy.

> Here is how to achieve it if someone is trying to figure the same thing out

It is documented in the manual, so you don't need to experiment.

Best,

Tamas


[julia-users] Re: Indexing over a large matrix (beginner question)

2015-05-03 Thread Maco Anshu
I just found this discussion on SO and it was very helpful: 
http://stackoverflow.com/questions/28271308/avoid-memory-allocation-when-indexing-an-array-in-julia
 


Julia allocates a new array on indexing every time.

Here is how to achieve it if someone is trying to figure the same thing out 
:

julia> a = [1,2,3,4,5,6,7,8,9,0]
10-element Array{Int64,1}:
 1
 2
 3
 4
 5
 6
 7
 8
 9
 0

julia> b = sub(a,[1,4,7])
3-element SubArray{Int64,1,Array{Int64,1},(Array{Int64,1},),0}:
 1
 4
 7

julia> b[1] = 2
2

julia> a
10-element Array{Int64,1}:
 2
 2
 3
 4
 5
 6
 7
 8
 9
 0



सोमवार, 4 मई 2015 को 3:04:53 पूर्व UTC+5:30 को, Maco Anshu ने लिखा:
>
> Hi,
>
> When I index over a Julia array:
>
> julia> x = reshape(1:16, 4, 4)
> 4x4 Array{Int64,2}:
>  1  5   9  13
>  2  6  10  14
>  3  7  11  15
>  4  8  12  16
>
> julia> b =  x[2:3, 2:end-1]
> 2x2 Array{Int64,2}:
>  6  10
>  7  11
>
> julia> b[1,1] = 3
> 3
>
> julia> b
> 2x2 Array{Int64,2}:
>  3  10
>  7  11
>
> julia> x
> 4x4 Array{Int64,2}:
>  1  5   9  13
>  2  6  10  14
>  3  7  11  15
>  4  8  12  16
>
> When does the indexed part of the array gets copied to a new block of 
> memory ? Is b produced as a different array just after indexing or is it 
> copied when one of its elements are changed or does Julia manage this using 
> some other technique ?
> Another question over this is if we have a very huge array (which somehow 
> just fits in RAM), is it possible to do indexing over it without using more 
> and more RAM (avoiding copies) ?
> Something like Python :
> >>> x = np.array([[1,2,3],[4,5,6],[7,8,9]])
> >>> b = x[1:2,:]
> >>> b
> array([[4, 5, 6]])
> >>> b[0] = 0
> >>> x
> array([[1, 2, 3],
>[0, 0, 0],
>[7, 8, 9]])
>
> I am not aware of how Julia actually works while indexing and it might be 
> doing something cool like clojure to manage such indexes and avoid copies, 
> so please forgive if the question is really stupid.
>
 


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread J Luis

 

> I agree. I might be able to help out, though I'm still not sure how 
> seriously I will be using Julia. I think it's a wonderful language, but I 
> don't really do technical computing, and I tend to favor language/tools 
> that produce standalone native executables. I will at least try out your 
> package, now that I know it exists.
>

Nice. The standalones issue has been raised several times before and there 
is a kind of promise that it will be possible in (not so far) future.
 

>
> --
> Matt Gushee
>


[julia-users] Re: Defining a function in different modules

2015-05-03 Thread David Gold
Hi folks,

I've been working on implementing the "merging" functionality that Jeff 
Bezanson noted earlier in this thread. For those interested, the project 
can be found here: https://github.com/davidagold/MetaMerge.jl. People 
should feel free to do whatever they find useful (if anything) with the 
code. Here's an example of it in action in Julia 3.7:

julia> using MetaMerge

julia> f()=nothing
f (generic function with 1 method)

julia> module A

   export f
   immutable Foo end
   f(::Foo) = print("This is Foo.")
   f(x::Int64) = x

   end

julia> module B

   export f
   immutable Bar end
   f(::Bar) = print("This is Bar.")
   f(x::Int64) = 2x

   end

julia> using A, B
Warning: using A.f in module Main conflicts with an existing identifier.
Warning: using B.f in module Main conflicts with an existing identifier.

julia> methods(f)
# 1 method for generic function "f":
f() at none:1

julia> metamerge(f, A, B)
f (generic function with 3 methods)

julia> methods(f)
# 3 methods for generic function "f":
f() at none:1
f(x1::Foo)
f(x1::Bar)

julia> f(A.Foo())
This is Foo.
julia> f(B.Bar())
This is Bar.
julia> metamerge(f, A, B, conflicts_favor=A)
f (generic function with 4 methods)

julia> methods(f)
# 4 methods for generic function "f":
f() at none:1
f(x1::Foo)
f(x1::Bar)
f(x1::Int64)

julia> f(2)
2

It's currently designed mostly for use in the REPL; I expect that making it 
more suitable for general coding will require taking advantage of some 
updates coming in Julia 4.0. 

Cheers,
David




On Tuesday, April 21, 2015 at 9:26:01 AM UTC-4, Michael Turok wrote:
>
> Hi,
>
> What is the idiomatic way to create a function value() in different 
> modules, dispatched on different arguments, without getting the 
> warning/error about conflicting with an existing identifier?
>
> It seems like there is an order dependency with the example below.   Seems 
> like the 2nd module defines value(), unless you had already used value() 
> prior to importing the 2nd module.   
>
> Note that if I do the same with get() a function defined in Base, I don't 
> get an error. 
>
> Code and output from julia REPL below.
>
> Any help appreciated,
> Michael
>
> # this is mike.jl
>
> # --
> module Foo
> # --
> importall Base
> type FooType end
>
> value(x::FooType) = "Foo::value"
> get(x::FooType) = "Foo::get"
>
> export value
>
> end
>
> # --
> module Bar
> # --
> importall Base
>
> type BarType end
>
> value(x::BarType) = "Bar::value"
> get(x::BarType) = "Bar::get"
>
> export value
>
> end
>
> Using this in the REPL: 
> julia> workspace() ; include("mike.jl")
>
> julia> using Foo
>
> julia> value(Foo.FooType())
> "Foo::value"
>
> julia> using Bar
> Warning: using Bar.value in module Main conflicts with an existing 
> identifier.
>
> julia> value(Bar.BarType())
> ERROR: `value` has no method matching value(::BarType)
>
> # -
>
> julia> workspace() ; include("mike.jl")
>
> julia> using Foo
>
> julia> using Bar
>
> julia> value(Foo.FooType())
> ERROR: `value` has no method matching value(::FooType)
>
> julia> value(Bar.BarType())
> "Bar::value"
>
> # -
>
> julia> workspace() ; include("mike.jl")
>
> julia> using Bar
>
> julia> using Foo
>
> julia> value(Foo.FooType())
> "Foo::value"
>
> julia> value(Bar.BarType())
> ERROR: `value` has no method matching value(::BarType)
>
> julia> 
>


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread Matt Gushee
On Sun, May 3, 2015 at 4:15 PM, J Luis  wrote:

> Well, because I believe that for one to register a package it must have at
> minimal decent documentation
>

Okay, that's fair.


> Off course you are most well come to participate. I've ported almost all C
> examples but still think we need a better documentation to IUP.
>

I agree. I might be able to help out, though I'm still not sure how
seriously I will be using Julia. I think it's a wonderful language, but I
don't really do technical computing, and I tend to favor language/tools
that produce standalone native executables. I will at least try out your
package, now that I know it exists.

--
Matt Gushee


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread J Luis
Well, because I believe that for one to register a package it must have at 
minimal decent documentation and that's the hard part here (now that the 
rest is done).
Off course you are most well come to participate. I've ported almost all C 
examples but still think we need a better documentation to IUP.

domingo, 3 de Maio de 2015 às 23:10:21 UTC+1, Matt Gushee escreveu:
>
>
> On Sun, May 3, 2015 at 4:04 PM, J Luis > 
> wrote:
>
>>
>> https://github.com/joa-quim/IUP.jl
>>
>> is a wrapper to the whole IUP lib. As I mentioned above in this thread 
>> the main issue with it is the lack of upstream tutorials be cause otherwise 
>> it's very fast and complete toolkit.
>>
>
> Oh, sorry, I missed that.
>
> Thanks for doing that! Why don't you submit it to the official package 
> registry?
>
> --
> Matt Gushee
>


Re: [julia-users] Re: Help to optimize a loop through a list

2015-05-03 Thread Kevin Squire
Hi Ronan,

Looks like an interesting package!

One minor suggestion: if you ever plan to make this an actual Julia
package, it would be good to name it MGEO.jl.  All Julia packages use this
naming convention, and it has the additional benefit of making such
packages easily searchable.

Cheers!
   Kevin

On Sun, May 3, 2015 at 1:33 PM, Ronan Chagas  wrote:

> Hi guys!
>
> Finally I had time to upload MGEOjulia.
>
> You can see it here:
>
> https://github.com/ronisbr/MGEOjulia
>
> It is available under BSD 3-clause license.
> You can see some test cases under test/mgeojulia_testcases.jl
>
> I would appreciate any suggestion to optimize it :)
>
> Thank you,
> Ronan
>


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread Matt Gushee
On Sun, May 3, 2015 at 4:04 PM, J Luis  wrote:

>
> https://github.com/joa-quim/IUP.jl
>
> is a wrapper to the whole IUP lib. As I mentioned above in this thread the
> main issue with it is the lack of upstream tutorials be cause otherwise
> it's very fast and complete toolkit.
>

Oh, sorry, I missed that.

Thanks for doing that! Why don't you submit it to the official package
registry?

--
Matt Gushee


Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Kevin Squire
One thing I was confused about when I first started using Julia was that
things that are done with strings in other languages are often done
directly with IO objects in Julia.

For example, consider that, in Python, most classes define `__str__()` and
`__repr__()`, which create string representations of objects of this class
(the first more meant for human consumption, the second for parsing
(usually)).

In Julia, the implicit assumption is that most strings are meant for output
in some way, so why not skip the extra memory allocation and write the
string representation directly to output.  For this, types define
`show(io::IO, x::MyType)`.  If you really want to manipulate such strings,
you can (as pointed out in this thread) go through an IOBuffer object
first.  (There is also `repr(x::SomeType)`, but it's not emphasized as
much.)

This was a design decision made early on.  I personally found (and still
find) it somewhat awkward at times, but for many things, it works fine, and
(seemingly) it lets most string output allocate less memory by default.

Now, it certainly is the case that mutable strings may be very useful in
some contexts.  The BioSeq.jl package implements mutable DNA and protein
sequences, which are very useful there, and would be represented by mutable
strings in many other languages.  The best way to test that would probably
be to create a package (say, MutableStrings.jl), and define useful types
and functions there.

Cheers,
   Kevin



On Sun, May 3, 2015 at 12:20 PM, Tamas Papp  wrote:

> consider
>
> let io = IOBuffer()
>   write(io,rand(10))
>   takebuf_array(io)
> end
>
> IOBuffer() is not specific to strings at all.
>
> Best,
>
> Tamas
>
> On Sun, May 03 2015, Scott Jones  wrote:
>
> > Because you can have binary strings and text strings... there is even a
> > special literal for binary strings...
> > b"\xffThis is a binary\x01\string"
> > "This is a \u307 text string"
> >
> > Calling it an IOBuffer makes it sound like it is specific to I/O, not
> just
> > strings (binary or text) that you might never do I/O on...
> >
> > On Sunday, May 3, 2015 at 2:43:14 PM UTC-4, Kristoffer Carlsson wrote:
> >>
> >> Why should it be called StringBuffer when another common use of it is to
> >> write raw binary data?
>


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread J Luis


domingo, 3 de Maio de 2015 às 20:53:16 UTC+1, Matt Gushee escreveu:
>
> Another possibility is IUP [http://webserver2.tecgraf.puc-rio.br/iup/]. 
> It is a cross-platform GUI library that takes a 'wrapper' approach: like 
> wxWidgets, it uses GTK widgets on X11 platforms and native widgets on 
> Windows. Unlike wxWidgets, it has a straight C API, and I believe is a good 
> deal simpler to use. It possibly lacks some features you would want if you 
> were building an office suite or a full-featured IDE, but for most purposes 
> I think it is quite sufficient.
>
> I created a Gist showing how you might use IUP from Julia to create a text 
> editor with a Scintilla editing pane: 
> https://gist.github.com/mgushee/3a3f032440219bc045b0 . I think my code is 
> mostly correct; in fact, most parts of it work in isolation, but it 
> segfaults when you try to create a menu from a list of menu items. I must 
> be doing something wrong, but I'm a Julia newbie and not much of a C 
> programmer, so I have no idea why.
>


https://github.com/joa-quim/IUP.jl

is a wrapper to the whole IUP lib. As I mentioned above in this thread the 
main issue with it is the lack of upstream tutorials be cause otherwise 
it's very fast and complete toolkit.
 

>
> But anyway, have a look and see what you think!
>
> --
> Matt Gushee
>
> On Tue, Apr 28, 2015 at 1:46 AM, Andreas Lobinger  > wrote:
>
>> Hello colleagues,
>>
>> what is status of availability and usecases for GUI toolkits.
>>
>> I see Tk and Gtk on the pkg.julialang.org. Gtk has the tag 'doesn't 
>> load' from testing, Tk seems OK.
>> In a recent discussion here, Tim Holy mentioned himself tesing Qwt and Qt 
>> in general seem to be a testcase for Cxx.
>>
>> Do i miss something here?
>>
>> Wishing a happy day,
>>  Andreas
>>
>>
>>
>

[julia-users] Indexing over a large matrix (beginner question)

2015-05-03 Thread Maco Anshu
Hi,

When I index over a Julia array:

julia> x = reshape(1:16, 4, 4)
4x4 Array{Int64,2}:
 1  5   9  13
 2  6  10  14
 3  7  11  15
 4  8  12  16

julia> b =  x[2:3, 2:end-1]
2x2 Array{Int64,2}:
 6  10
 7  11

julia> b[1,1] = 3
3

julia> b
2x2 Array{Int64,2}:
 3  10
 7  11

julia> x
4x4 Array{Int64,2}:
 1  5   9  13
 2  6  10  14
 3  7  11  15
 4  8  12  16

When does the indexed part of the array gets copied to a new block of 
memory ? Is b produced as a different array just after indexing or is it 
copied when one of its elements are changed or does Julia manage this using 
some other technique ?
Another question over this is if we have a very huge array (which somehow 
just fits in RAM), is it possible to do indexing over it without using more 
and more RAM (avoiding copies) ?
Something like Python :
>>> x = np.array([[1,2,3],[4,5,6],[7,8,9]])
>>> b = x[1:2,:]
>>> b
array([[4, 5, 6]])
>>> b[0] = 0
>>> x
array([[1, 2, 3],
   [0, 0, 0],
   [7, 8, 9]])

I am not aware of how Julia actually works while indexing and it might be 
doing something cool like clojure to manage such indexes and avoid copies, 
so please forgive if the question is really stupid.


Re: [julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Dominique Orban
https://gist.github.com/dpo/11000433

[julia-users] Re: Help to optimize a loop through a list

2015-05-03 Thread Ronan Chagas
Hi guys!

Finally I had time to upload MGEOjulia.

You can see it here:

https://github.com/ronisbr/MGEOjulia

It is available under BSD 3-clause license.
You can see some test cases under test/mgeojulia_testcases.jl

I would appreciate any suggestion to optimize it :)

Thank you,
Ronan


Re: [julia-users] using SortingAlgorithms: UndefVarError: Range1 not defined

2015-05-03 Thread jansen . gerald
Perfect. Many thanks!



Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread Jameson Nash
Has anyone used the GNUstep framework before? Unlike many of the other
options (which are written in C++), this one is easy to access through C
bindings, and therefore easy to access from Julia (
https://github.com/one-more-minute/ObjectiveC.jl). It also happens to be
native on one platform (Apple), so it is quite full featured.


On Sun, May 3, 2015 at 3:53 PM Matt Gushee  wrote:

> Another possibility is IUP [http://webserver2.tecgraf.puc-rio.br/iup/].
> It is a cross-platform GUI library that takes a 'wrapper' approach: like
> wxWidgets, it uses GTK widgets on X11 platforms and native widgets on
> Windows. Unlike wxWidgets, it has a straight C API, and I believe is a good
> deal simpler to use. It possibly lacks some features you would want if you
> were building an office suite or a full-featured IDE, but for most purposes
> I think it is quite sufficient.
>
> I created a Gist showing how you might use IUP from Julia to create a text
> editor with a Scintilla editing pane:
> https://gist.github.com/mgushee/3a3f032440219bc045b0 . I think my code is
> mostly correct; in fact, most parts of it work in isolation, but it
> segfaults when you try to create a menu from a list of menu items. I must
> be doing something wrong, but I'm a Julia newbie and not much of a C
> programmer, so I have no idea why.
>
> But anyway, have a look and see what you think!
>
> --
> Matt Gushee
>
> On Tue, Apr 28, 2015 at 1:46 AM, Andreas Lobinger 
> wrote:
>
>> Hello colleagues,
>>
>> what is status of availability and usecases for GUI toolkits.
>>
>> I see Tk and Gtk on the pkg.julialang.org. Gtk has the tag 'doesn't
>> load' from testing, Tk seems OK.
>> In a recent discussion here, Tim Holy mentioned himself tesing Qwt and Qt
>> in general seem to be a testcase for Cxx.
>>
>> Do i miss something here?
>>
>> Wishing a happy day,
>>  Andreas
>>
>>
>>
>


Re: [julia-users] Re: Building Julia 0.3.7 in OSX 10.6.8 (Snow Leopard).

2015-05-03 Thread Jameson Nash
Error 127 is file-not-found. Error 2 is something-went-wrong (in this case,
it was the error 127).

On Sun, May 3, 2015 at 1:48 PM Tony Kelman  wrote:

> Did you clone from the release-0.3 branch? Have you done `git submodule
> init && git submodule update` ? What does `ls deps/libuv` say?
>
>
> On Sunday, May 3, 2015 at 8:14:32 AM UTC-7, Ismael VC wrote:
>>
>> Hello everyone!
>>
>> I just got an old MacBook with OSX *10.6.8* Snow Leopard at work and I
>> want to use the latest Julia release. I noticed that the latest supported
>> release for this OS was 2.1, which is what I’m using for now.
>>
>> The build fails with the following error:
>>
>> $ make -j1# previously used `make cleanall`
>> /bin/sh: ./configure: No such file or directory
>> make[2]: *** [libuv/config.status] Error 127
>> make[1]: *** [julia-release] Error 2
>> make: *** [release] Error 2
>>
>> There indeed isn’t a .configure file. I just red that I need
>> USE_SYSTEM_LIBUNWIND=1 for this OS version, so I will try that, but I
>> don’t think that s related to this error.
>>
>> Please note that I’ve never ever used a Mac before, so I’m not sure how
>> to proceed. I saw there is brew and probably other methods to build
>> julia, but I choose to try building it myself since that’s what I do in
>> Arch Linux for the development branch, but I will also try the other
>> options today (HomeBrew and MacPorts as far as I’m aware).
>>
>> How can I tell what Error 127 and Error 2 are?
>>
>> Cheers!
>> ​
>>
>


Re: [julia-users] the state of GUI toolkits?

2015-05-03 Thread Matt Gushee
Another possibility is IUP [http://webserver2.tecgraf.puc-rio.br/iup/]. It
is a cross-platform GUI library that takes a 'wrapper' approach: like
wxWidgets, it uses GTK widgets on X11 platforms and native widgets on
Windows. Unlike wxWidgets, it has a straight C API, and I believe is a good
deal simpler to use. It possibly lacks some features you would want if you
were building an office suite or a full-featured IDE, but for most purposes
I think it is quite sufficient.

I created a Gist showing how you might use IUP from Julia to create a text
editor with a Scintilla editing pane:
https://gist.github.com/mgushee/3a3f032440219bc045b0 . I think my code is
mostly correct; in fact, most parts of it work in isolation, but it
segfaults when you try to create a menu from a list of menu items. I must
be doing something wrong, but I'm a Julia newbie and not much of a C
programmer, so I have no idea why.

But anyway, have a look and see what you think!

--
Matt Gushee

On Tue, Apr 28, 2015 at 1:46 AM, Andreas Lobinger 
wrote:

> Hello colleagues,
>
> what is status of availability and usecases for GUI toolkits.
>
> I see Tk and Gtk on the pkg.julialang.org. Gtk has the tag 'doesn't load'
> from testing, Tk seems OK.
> In a recent discussion here, Tim Holy mentioned himself tesing Qwt and Qt
> in general seem to be a testcase for Cxx.
>
> Do i miss something here?
>
> Wishing a happy day,
>  Andreas
>
>
>


Re: [julia-users] Defining a function in different modules

2015-05-03 Thread Tobias Knopp
Dear Scott,

I don't understand this GPL discussion. If you want to use Julia in a 
commercial product you will have to think about deployment. I doubt that 
you want to use the regular Julia installers for that. At this point its 
about deleting two shared libraries (fftw and these sparse solvers). Thats 
it. The entire Julia code is GPL free.

When I would distribute a commercial Julia package I would further generate 
a custom system image where all the "commercial" code is compiled in.

Regards,

Tobi


Am Freitag, 1. Mai 2015 16:35:53 UTC+2 schrieb Scott Jones:
>
>
>
> On Friday, May 1, 2015 at 12:10:32 AM UTC-4, Jeff Bezanson wrote:
>>
>> On Thu, Apr 30, 2015 at 5:26 PM, Scott Jones  
>> wrote: 
>> > Maybe because it seems that a lot of the major packages have been put 
>> into 
>> > Base, so it isn't a problem, as MA Laforge pointed out, leading to Base 
>> > being incredibly large, 
>>
>> That's absurd. There are 500 packages. We added Dates and...what else? 
>> We would like Base to be a bit smaller 
>> (https://github.com/JuliaLang/julia/issues/5155), but "incredibly 
>> large" is a bit of an overstatement. It's *nothing* compared to 
>> matlab's default namespace for example. 
>>
>
> 1) Anything with a GPL license... that is really nasty to anybody would 
> like to use Julia on a commercial project...
> (I have nothing against GPL, I do like OSS, but I much prefer the way 
> the MIT license works, and don't have the luxury of being able to use GPL 
> software in what I do for a living... [use in the sense of using a library, 
> if it's not under the LGPL]... I *use* a lot of GPL'ed software, Emacs, 
> gcc, ...)
>
> 2) multimedia.jl, linalg.jl, statistics.jl, sparse.jl
>[fftw.jl, dsp.jl - I know these are also under my above GPL list, but 
> if a non-GPLed alternative is found, I still think it doesn't need to be in 
> "Julia-lite"]
> quadgk.jl, profile.jl, Dates.jl
>
> pkg.jl I'm not sure about... you'd need a way of loading it, to load other 
> packages, but... doesn't it use GPLed software, which could get people 
> using it into legal hot water?
>
> I'm not sure about: reducedlm.jl, combinatorics.jl, don't know what they 
> do, or how basic their functionality is...
>
> Also Markdown, I think there is a lot there that isn't needed just for 
> getting ? help documentation (or with @doc) at the terminal...
> Anything not needed for @doc, I think should be optional, in a package.
>
>
> > with stuff that means Julia's MIT license doesn't mean all that much, 
>> > because it includes GPL code by default... 
>>
>> So the license of the entire compiler, runtime, and 90%+ of the 
>> standard library doesn't "mean much"? Ouch. 
>> In any case Viral started adding a flag to exclude GPL libs last week. 
>> The changes for that are tiny. 
>>
>
> Yes, and I'm very grateful to Viral, because otherwise we'd probably have 
> had to totally stop planning on using Julia...
> However, I feel that the developers should be very careful to not let GPL 
> get into the base distribution...
> (I think the default for 0.4 release should be without the GPL encumbered 
> parts)
>  
>
>> I'm still confused about MongoDB vs. TokuMX. In your last post about 
>> them you mentioned using them as drop-in replacements for each other. 
>> But before that you said they are competitors, and won't necessarily 
>> implement the same interface. If they have incompatible interfaces, 
>> how can they be drop-in replacements? I don't get it. 
>>
>
> Do you remember the lawsuits about Java vs. Microsoft's version of Java?
> Or go look at the cringing README.md for the matlab compatibility package 
> for Julia...
> Think about how AMD and Intel battled over extending the x86 instruction 
> set from 32-bits to 64...
> Intel's approach was to introduce the Itanium chip... (real winner there! 
> ;-) We called it the Titanium chip... going down like the Titanic!)
> AMD went and extended the x86 instruction set... then Intel went back and 
> introduced a new instruction set that was mostly compatible with the AMD
> 64-bit instructions...
> That is life outside of academia!
>
> TokuMX recreated the MongoDB's API...  but that doesn't mean that 
> MongoDB's developers are going to stop adding new things (sometimes 
> precisely in an attempt to lock people into using MongoDB, make it harder 
> to switch to some other platform), or that TokuMX hasn't added it's own new 
> things.
> I had a part in playing this sort of game for years... with multiple 
> vendors of an ANSI standard language, each adding their own extensions, 
> sometimes having those extensions copied by other competitors...
>
> Scott
>


Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Tamas Papp
consider

let io = IOBuffer()
  write(io,rand(10))
  takebuf_array(io)
end

IOBuffer() is not specific to strings at all.

Best,

Tamas

On Sun, May 03 2015, Scott Jones  wrote:

> Because you can have binary strings and text strings... there is even a
> special literal for binary strings...
> b"\xffThis is a binary\x01\string"
> "This is a \u307 text string"
>
> Calling it an IOBuffer makes it sound like it is specific to I/O, not just
> strings (binary or text) that you might never do I/O on...
>
> On Sunday, May 3, 2015 at 2:43:14 PM UTC-4, Kristoffer Carlsson wrote:
>>
>> Why should it be called StringBuffer when another common use of it is to
>> write raw binary data?


Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Scott Jones
Because you can have binary strings and text strings... there is even a 
special literal for binary strings...
b"\xffThis is a binary\x01\string"
"This is a \u307 text string"

Calling it an IOBuffer makes it sound like it is specific to I/O, not just 
strings (binary or text) that you might never do I/O on...

On Sunday, May 3, 2015 at 2:43:14 PM UTC-4, Kristoffer Carlsson wrote:
>
> Why should it be called StringBuffer when another common use of it is to 
> write raw binary data?



Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Kristoffer Carlsson
Why should it be called StringBuffer when another common use of it is to write 
raw binary data?

[julia-users] Re: Building Julia 0.3.7 in OSX 10.6.8 (Snow Leopard).

2015-05-03 Thread Tony Kelman
Did you clone from the release-0.3 branch? Have you done `git submodule 
init && git submodule update` ? What does `ls deps/libuv` say?

On Sunday, May 3, 2015 at 8:14:32 AM UTC-7, Ismael VC wrote:
>
> Hello everyone!
>
> I just got an old MacBook with OSX *10.6.8* Snow Leopard at work and I 
> want to use the latest Julia release. I noticed that the latest supported 
> release for this OS was 2.1, which is what I’m using for now.
>
> The build fails with the following error:
>
> $ make -j1# previously used `make cleanall`
> /bin/sh: ./configure: No such file or directory
> make[2]: *** [libuv/config.status] Error 127
> make[1]: *** [julia-release] Error 2
> make: *** [release] Error 2
>
> There indeed isn’t a .configure file. I just red that I need 
> USE_SYSTEM_LIBUNWIND=1 for this OS version, so I will try that, but I 
> don’t think that s related to this error.
>
> Please note that I’ve never ever used a Mac before, so I’m not sure how to 
> proceed. I saw there is brew and probably other methods to build julia, 
> but I choose to try building it myself since that’s what I do in Arch Linux 
> for the development branch, but I will also try the other options today 
> (HomeBrew and MacPorts as far as I’m aware).
>
> How can I tell what Error 127 and Error 2 are?
>
> Cheers!
> ​
>


[julia-users] can someone please explain Type{Float64} <: DataType <: Type

2015-05-03 Thread Toivo Henningsson
Jeff is probably the only one who can give you a complete answer, but I hope I 
can contribute with something. 

I believe Type is a bit special (and maybe DataType also), this couldn't hold 
for any two types in general. I think it does square pretty well with 
invariance though, Type{Any} is a much smaller type than Type, but they would 
be equal with covariance. Where do you feel that this would collide with 
invariance? 

Re: [julia-users] implicit begin for macro

2015-05-03 Thread Toivo Henningsson
Yes, so far that is true. Any suggestions on how such a thing could work in 
practice? I belive that we would still want to be able to parse Julia code 
completely without knowing which macros have been defined.

Re: [julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Daniel Carrera
Hello Tim,

I appreciate the effort. I know about the Formatting module, but it does
not provide printf() or sprintf() -- it only has sprintf1() which only
takes 1 parameter -- and I am really not keen on using the Python
formatting method. But thanks for the link.

Cheers,
Daniel.

On 3 May 2015 at 16:41, Tim Holy  wrote:

> https://github.com/lindahua/Formatting.jl
>
> --Tim
>
> On Sunday, May 03, 2015 06:43:22 AM Daniel Carrera wrote:
> > Hello,
> >
> > My biggest pet-peeve in Julia is that @sprintf is a macro and not a
> > function. That makes it very annoying to use at times because I cannot
> put
> > a format string in a variable, or make a wrapper `printf()` function. I
> > don't understand why this is an issue, since several other languages
> have a
> > printf() function.
> >
> > Is there any chance that I might see a printf() function in Julia in the
> > future?
> >
> > I should clarify that I am aware of the "Formatting" module. I do not
> want
> > to use Python-style formatting strings. I don't like them, I think they
> are
> > confusing, and other languages that I use have traditional C-style
> printf()
> > functions, so I want to stick to those. I realize that the "Formatting"
> > module has one function called "sprintf1()" but that function only
> accepts
> > one parameter, so it is not especially useful.
> >
> > Cheers,
> > Daniel.
>
>


-- 
When an engineer says that something can't be done, it's a code phrase that
means it's not fun to do.


Re: [julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Daniel Carrera
Thanks.

On 3 May 2015 at 16:17, Patrick O'Leary  wrote:

> There are a few issues that get a bit into why this is harder than it
> looks. I'll start you off at
> https://github.com/JuliaLang/julia/issues/5866, and you can see where
> things stand now over at https://github.com/JuliaLang/julia/issues/10610.
> If you search around (maybe here, maybe the dev list, don't recall exactly)
> I think there's at least one mailing list thread as well that has further
> discussion.




-- 
When an engineer says that something can't be done, it's a code phrase that
means it's not fun to do.


[julia-users] Building Julia 0.3.7 in OSX 10.6.8 (Snow Leopard).

2015-05-03 Thread Ismael VC


Hello everyone!

I just got an old MacBook with OSX *10.6.8* Snow Leopard at work and I want 
to use the latest Julia release. I noticed that the latest supported 
release for this OS was 2.1, which is what I’m using for now.

The build fails with the following error:

$ make -j1# previously used `make cleanall`
/bin/sh: ./configure: No such file or directory
make[2]: *** [libuv/config.status] Error 127
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

There indeed isn’t a .configure file. I just red that I need 
USE_SYSTEM_LIBUNWIND=1 for this OS version, so I will try that, but I don’t 
think that s related to this error.

Please note that I’ve never ever used a Mac before, so I’m not sure how to 
proceed. I saw there is brew and probably other methods to build julia, but 
I choose to try building it myself since that’s what I do in Arch Linux for 
the development branch, but I will also try the other options today 
(HomeBrew and MacPorts as far as I’m aware).

How can I tell what Error 127 and Error 2 are?

Cheers!
​


Re: [julia-users] parallel: mutating an object from a worker process

2015-05-03 Thread Tim Holy
Not sure, but I think you'll have to have the remote workers run the push! 
operation in the parent process.

Using push! is going to give you trouble no matter what, though. If you can 
preallocate all sizes, it will work much better. But I suspect at this point 
it might be reasonable to ask yourself, "do I really need parallelism here?"
You could easily lose more time to passing data back and forth than you gain 
by running in multiple processes.

--Tim

On Saturday, May 02, 2015 12:45:19 PM Constantin Berzan wrote:
> On Saturday, May 2, 2015 at 5:54:41 AM UTC-7, Tim Holy wrote:
> > Use a SharedArray.
> 
> This should work in the toy example I posted, but in my real application,
> the object that I'm mutating has a bunch of DataStructures.SortedDict
> values.  The array that causes the "cannot resize array with shared data"
> error is buried deep inside the internals of SortedDict.  So I can't use a
> SharedArray without rewriting the internals of DataStructures.jl...
> 
> Any insight into what goes wrong in the second example from my original
> post?  Am I using RemoteRefs incorrectly?
> 
> Thanks,
> Constantin



Re: [julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Tim Holy
https://github.com/lindahua/Formatting.jl

--Tim

On Sunday, May 03, 2015 06:43:22 AM Daniel Carrera wrote:
> Hello,
> 
> My biggest pet-peeve in Julia is that @sprintf is a macro and not a
> function. That makes it very annoying to use at times because I cannot put
> a format string in a variable, or make a wrapper `printf()` function. I
> don't understand why this is an issue, since several other languages have a
> printf() function.
> 
> Is there any chance that I might see a printf() function in Julia in the
> future?
> 
> I should clarify that I am aware of the "Formatting" module. I do not want
> to use Python-style formatting strings. I don't like them, I think they are
> confusing, and other languages that I use have traditional C-style printf()
> functions, so I want to stick to those. I realize that the "Formatting"
> module has one function called "sprintf1()" but that function only accepts
> one parameter, so it is not especially useful.
> 
> Cheers,
> Daniel.



Re: [julia-users] implicit begin for macro

2015-05-03 Thread Tamas Papp
Thanks --- so in this particular case I can work around it.

But is that true that in general, I cannot write a macro with a syntax

@mymacro
  body...
end

that would get the AST of body...? Ie if the language did not have `for`
or `while`, or any of the constructs which make blocks, I could not
reimplement them with a macro.

Best,

Tamas

On Sun, May 03 2015, Jameson Nash  wrote:

> You can do this with a functional form:
>
> function with_output_to_string(f)
>   f(IOBuffer())
> end
>
> with_output_to_string() do io
>   println(io, "testing")
>   @printf(io, "pi is %.5f", Float64(pi))
> end
>
> see also: https://github.com/JuliaLang/julia/issues/7022
>
> On Sun, May 3, 2015 at 6:18 AM Tamas Papp  wrote:
>
>> Hi,
>>
>> I am trying to write something analogous to
>> COMMON-LISP:WITH-OUTPUT-TO-STRING, what I have so far is
>>
>> macro with_output_to_string(stream, expr)
>>   quote
>> let $(esc(stream)) = IOBuffer()
>>   $expr
>>   takebuf_string($(esc(stream)))
>> end
>>   end
>> end
>>
>> Works fine:
>>
>> @with_output_to_string io begin
>>   println(io, "testing")
>>   @printf(io, "pi is %.5f", Float64(pi))
>> end
>>
>> but I have a couple of questions:
>>
>> 1. Is there a way I can get rid of the `begin`? Julia syntax for
>> built-ins that have implicit blocks (`for`, `function`) has no `begin`,
>> is it possible to write a macro in a similar style? Ie is there
>> something analogous to COMMON-LISP:&BODY in Julia? (in effect, not in
>> syntax, I know about varargs, but they don't look right here).
>>
>> 2. I thought that if I make the first argument STDOUT, I can get rid of
>> the stream name in the body, but it doesn't work (still prints to
>> console). What is the right way?
>>
>> 3. In Common Lisp, it is common for the first argument to be an
>> s-expression that is then destructured. Is that idiomatic in Julia? Can
>> you point me to some examples?
>>
>> Best,
>>
>> Tamas
>>


Re: [julia-users] implicit begin for macro

2015-05-03 Thread Jameson Nash
You can do this with a functional form:

function with_output_to_string(f)
  f(IOBuffer())
end

with_output_to_string() do io
  println(io, "testing")
  @printf(io, "pi is %.5f", Float64(pi))
end

see also: https://github.com/JuliaLang/julia/issues/7022

On Sun, May 3, 2015 at 6:18 AM Tamas Papp  wrote:

> Hi,
>
> I am trying to write something analogous to
> COMMON-LISP:WITH-OUTPUT-TO-STRING, what I have so far is
>
> macro with_output_to_string(stream, expr)
>   quote
> let $(esc(stream)) = IOBuffer()
>   $expr
>   takebuf_string($(esc(stream)))
> end
>   end
> end
>
> Works fine:
>
> @with_output_to_string io begin
>   println(io, "testing")
>   @printf(io, "pi is %.5f", Float64(pi))
> end
>
> but I have a couple of questions:
>
> 1. Is there a way I can get rid of the `begin`? Julia syntax for
> built-ins that have implicit blocks (`for`, `function`) has no `begin`,
> is it possible to write a macro in a similar style? Ie is there
> something analogous to COMMON-LISP:&BODY in Julia? (in effect, not in
> syntax, I know about varargs, but they don't look right here).
>
> 2. I thought that if I make the first argument STDOUT, I can get rid of
> the stream name in the body, but it doesn't work (still prints to
> console). What is the right way?
>
> 3. In Common Lisp, it is common for the first argument to be an
> s-expression that is then destructured. Is that idiomatic in Julia? Can
> you point me to some examples?
>
> Best,
>
> Tamas
>


[julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Patrick O'Leary
There are a few issues that get a bit into why this is harder than it looks. 
I'll start you off at https://github.com/JuliaLang/julia/issues/5866, and you 
can see where things stand now over at 
https://github.com/JuliaLang/julia/issues/10610. If you search around (maybe 
here, maybe the dev list, don't recall exactly) I think there's at least one 
mailing list thread as well that has further discussion.

[julia-users] Re: overloading assignment operator

2015-05-03 Thread Thorsten Dahmen
Hi Toive,
thanks for the quick reply. Concerning my use case, I found that there is 
an even easier solution without using an assignment overload at all in the 
meantime. But it is good to know that it does not exist. Thus, as far as I 
can see, the best alternative is to introduce a function assign(f,x) and 
evoke f = x within together with other custom code. That's not too much of 
a problem in case I need it in future.
Best,
Thorsten

On Monday, April 27, 2015 at 9:52:50 PM UTC+2, Toivo Henningsson wrote:
>
> The answer is basically no. Assignment to an identifier always creates a 
> new binding for that identifier, possibly after converting the right hand 
> side to the type of the variable in question. 
> For an object x, 
>
> x[inds...] = a 
>
> can be overloaded (this is the setindex! function). At some point it might 
> become possible to overload 
>
> x.y = a 
>
> As for alternatives: What is your use case?



[julia-users] Re: Julia and VIM - My working setup

2015-05-03 Thread Sean Marshallsay
Yep, that's a feature of julia-vim.

On Sunday, 3 May 2015 13:11:52 UTC+1, Sisyphuss wrote:
>
> I'd like to know, if you type "\alpha" in vim, will it be replaced by 
> the greek character ?
>
>
> On Saturday, May 2, 2015 at 10:35:38 PM UTC+2, Krishna Subramanian wrote:
>>
>> After a long search, I have finally found a solution for working with the 
>> Julia REPL and vim. I am working in a Windows 7/x64 environment but I 
>> believe my setup can also be used in other situations. I am posting it here 
>> in the hopes of it being useful to some other vimmer getting their hands 
>> dirty with Julia.
>>
>> My earlier setup was a follows - 
>>
>> 1. Manually sync the directories of gvim and julia REPL
>> 2. Open file in gvim, save, in julia, do include("foo.jl") and iterate
>> 3. Keep doing the Alt+Tab to keep going back and forth between the two
>>
>> After a point, it because clear that this setup is not going to fly. My 
>> current setup is as follows-
>>
>> 1. Install Cygwin and in particular bash and GNU/screen
>> 2. Ensure that the bash.exe and screen.exe from cygwin are in your PATH
>> 3. Ensure that julia.exe is in your PATH
>> 4. In vim, install julia-vim , 
>> ervandew/screen  plugins
>> 5. Make some changes to the _vimrc (my setup is below)
>>
>> My current setup helps me work as follows (can be modified using _vimrc 
>> mappings)
>>
>>
>>1. Start gvim
>>2. cd to required directory
>>3. Type  in normal mode
>>4. This starts a julia session that communicates with gvim using 
>>screen. It also automatically changes the directory in the julia REPL to 
>>the directory gvim cwd.
>>5. Open the main script (say run.jl) in gvim
>>6. You can execute commands from this file in two ways 
>>   - Typing  in gvim executes the whole paragraph in 
>>   which the cursor is located, i.e. this paragraph is automatically sent 
>> to 
>>   Julia REPL for execution
>>   - Typing s sends the command 'include("run.jl");' to 
>>   julia, i.e. whatever is the current buffer in gvim
>>7. I have made another modification so that I can designate a file in 
>>gvim as the main file, say, run.jl and then begin editing another script 
>>foo.jl that is including from run.jl. Now typing s sends the 
>>designated main script, i.e. "include("run.jl")" to julia. I can continue 
>>to work on foo.jl and look at the results in the julia REPL
>>8. When I am done with julia, I type x to end the julia 
>>session which automatically closes julia and the screen session
>>
>>
>> This setup has done wonders to my productivity when I am working with 
>> Julia. My demo _vimrc script is here [Gist Link 
>> ].
>>
>> Thanks.
>>
>

[julia-users] Is there a way to get a printf() or sprintf() function in Julia?

2015-05-03 Thread Daniel Carrera
Hello,

My biggest pet-peeve in Julia is that @sprintf is a macro and not a 
function. That makes it very annoying to use at times because I cannot put 
a format string in a variable, or make a wrapper `printf()` function. I 
don't understand why this is an issue, since several other languages have a 
printf() function.

Is there any chance that I might see a printf() function in Julia in the 
future?

I should clarify that I am aware of the "Formatting" module. I do not want 
to use Python-style formatting strings. I don't like them, I think they are 
confusing, and other languages that I use have traditional C-style printf() 
functions, so I want to stick to those. I realize that the "Formatting" 
module has one function called "sprintf1()" but that function only accepts 
one parameter, so it is not especially useful.

Cheers,
Daniel.


[julia-users] Re: Julia and VIM - My working setup

2015-05-03 Thread Sisyphuss
I'd like to know, if you type "\alpha" in vim, will it be replaced by 
the greek character ?


On Saturday, May 2, 2015 at 10:35:38 PM UTC+2, Krishna Subramanian wrote:
>
> After a long search, I have finally found a solution for working with the 
> Julia REPL and vim. I am working in a Windows 7/x64 environment but I 
> believe my setup can also be used in other situations. I am posting it here 
> in the hopes of it being useful to some other vimmer getting their hands 
> dirty with Julia.
>
> My earlier setup was a follows - 
>
> 1. Manually sync the directories of gvim and julia REPL
> 2. Open file in gvim, save, in julia, do include("foo.jl") and iterate
> 3. Keep doing the Alt+Tab to keep going back and forth between the two
>
> After a point, it because clear that this setup is not going to fly. My 
> current setup is as follows-
>
> 1. Install Cygwin and in particular bash and GNU/screen
> 2. Ensure that the bash.exe and screen.exe from cygwin are in your PATH
> 3. Ensure that julia.exe is in your PATH
> 4. In vim, install julia-vim , 
> ervandew/screen  plugins
> 5. Make some changes to the _vimrc (my setup is below)
>
> My current setup helps me work as follows (can be modified using _vimrc 
> mappings)
>
>
>1. Start gvim
>2. cd to required directory
>3. Type  in normal mode
>4. This starts a julia session that communicates with gvim using 
>screen. It also automatically changes the directory in the julia REPL to 
>the directory gvim cwd.
>5. Open the main script (say run.jl) in gvim
>6. You can execute commands from this file in two ways 
>   - Typing  in gvim executes the whole paragraph in 
>   which the cursor is located, i.e. this paragraph is automatically sent 
> to 
>   Julia REPL for execution
>   - Typing s sends the command 'include("run.jl");' to julia, 
>   i.e. whatever is the current buffer in gvim
>7. I have made another modification so that I can designate a file in 
>gvim as the main file, say, run.jl and then begin editing another script 
>foo.jl that is including from run.jl. Now typing s sends the 
>designated main script, i.e. "include("run.jl")" to julia. I can continue 
>to work on foo.jl and look at the results in the julia REPL
>8. When I am done with julia, I type x to end the julia 
>session which automatically closes julia and the screen session
>
>
> This setup has done wonders to my productivity when I am working with 
> Julia. My demo _vimrc script is here [Gist Link 
> ].
>
> Thanks.
>


[julia-users] can someone please explain Type{Float64} <: DataType <: Type

2015-05-03 Thread Tamas Papp
I understand that DataType <: Type, since all types are subclasses of
Type.

Intuitively, I also understand that isa(Float64, DataType). But

1. how can Type be both a super- and a subclass of DataType, when

super(Type{Float64})

and

Any <: DataType is false, and

2. how does this square with invariance? or that doesn't apply to types?

Sorry, I am just having a hard time visualizing the graph of types.

Best,

Tamas


Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Scott Jones
I should be clear, I didn't mean that all strings should be immutable, but 
rather that I also want to have mutable strings available... There is a package 
for that, but 1) I think it's incomplete (I may need to contribute to it), and 
2) I think that they do belong in the base language...
CLU had both, which was very nice...
For many things, IOBuffer is exactly the right way of doing things (the name is 
misleading though... Maybe it should have been StringBuffer...), but there are 
use cases where you are constantly modifying the string while performing other 
string operations on it...

[julia-users] Space sensitive macro parsing in v0.4

2015-05-03 Thread Patrick O'Leary
https://github.com/JuliaLang/julia/issues/4233

Re: [julia-users] using SortingAlgorithms: UndefVarError: Range1 not defined

2015-05-03 Thread Jiahao Chen
I just tagged a new release for SortingAlgorithms that should address this
problem. Please run Pkg.update() and try again.

Thanks,

Jiahao Chen
Staff Research Scientist
MIT Computer Science and Artificial Intelligence Laboratory

On Sun, May 3, 2015 at 3:22 AM,  wrote:

> I've managed to download Julia from git and (after installing cmake)
> managed to compile everything (whew!).
>
> I'm getting a load error from: using SortingAlgorithms
>
> julia> using SortingAlgorithms
> ERROR: LoadError: UndefVarError: Range1 not defined
>  ...
> while loading
> /home/gjansen/.julia/v0.4/SortingAlgorithms/src/SortingAlgorithms.jl, in
> expression starting on line 136
>
> julia> versioninfo()
> Julia Version 0.4.0-dev+4599
> Commit 3f2ed27 (2015-05-02 10:55 UTC)
> Platform Info:
>   System: Linux (x86_64-linux-gnu)
>   CPU: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
>   WORD_SIZE: 64
>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
>   LAPACK: libopenblas
>   LIBM: libopenlibm
>   LLVM: libLLVM-3.3
>
> julia> using SortingAlgorithms
>
> tia
> Gerald Jansen
>


[julia-users] implicit begin for macro

2015-05-03 Thread Tamas Papp
Hi,

I am trying to write something analogous to
COMMON-LISP:WITH-OUTPUT-TO-STRING, what I have so far is

macro with_output_to_string(stream, expr)
  quote
let $(esc(stream)) = IOBuffer()
  $expr
  takebuf_string($(esc(stream)))
end
  end
end

Works fine:

@with_output_to_string io begin
  println(io, "testing")
  @printf(io, "pi is %.5f", Float64(pi))
end

but I have a couple of questions:

1. Is there a way I can get rid of the `begin`? Julia syntax for
built-ins that have implicit blocks (`for`, `function`) has no `begin`,
is it possible to write a macro in a similar style? Ie is there
something analogous to COMMON-LISP:&BODY in Julia? (in effect, not in
syntax, I know about varargs, but they don't look right here).

2. I thought that if I make the first argument STDOUT, I can get rid of
the stream name in the body, but it doesn't work (still prints to
console). What is the right way?

3. In Common Lisp, it is common for the first argument to be an
s-expression that is then destructured. Is that idiomatic in Julia? Can
you point me to some examples?

Best,

Tamas


[julia-users] Space sensitive macro parsing in v0.4

2015-05-03 Thread Avik Sengupta
So in julia v0.3:

julia> @osx?print("A"):print("B")
A

But in julia 0.4:

julia> @osx?print("A"):print("B")
ERROR: wrong number of arguments

A space is now required after the "?"

julia> @osx? print("A"):print("B")
A

Is this intentional, or should I file a bug? 

Regards
-
Avik



Re: [julia-users] Re: Performance variability - can we expect Julia to be the fastest (best) language?

2015-05-03 Thread Steven Sagaert
You really should ask the language designers about this for a definite 
answer but (one of the ) the reason(s) strings are immutable in julia (and 
in Java & others) is that it makes them good keys for Dicts.

On Saturday, May 2, 2015 at 7:16:24 PM UTC+2, Jameson wrote:
>
> IOBuffer does not inherit from string, nor does it implement any of the 
> methods expected of a mutable string (length, endof, insert! / splice! / 
> append!). If you want strings that support all of those operations, then 
> you will need something different from an IOBuffer. If you just wanted a 
> fast string builder, then IOBuffer is the right abstraction (ending with a 
> call to `takebuf_string!`). This dichotomy helps to give a clear 
> distinction in the code between the construction phase and usage phase.
>
> On Sat, May 2, 2015 at 12:49 PM Páll Haraldsson  > wrote:
>
>> 2015-05-01 16:42 GMT+00:00 Steven G. Johnson > >:
>>
>>>
>>> In Julia, Ruby, Java, Go, and many other languages, concatenation 
>>> allocates a new string and hence building a string by repeated 
>>> concatenation is O(n^2).   That doesn't mean that those other languages 
>>> "lose" on string processing to Python, it just means that you have to do 
>>> things slightly differently (e.g. write to an IOBuffer in Julia).
>>>
>>> You can't always expect the *same code* (translated as literally as 
>>> possible) to be the optimal approach in different languages, and it is 
>>> inflammatory to compare languages according to this standard.
>>>
>>> A fairer question is whether it is *much harder* to get good performance 
>>> in one language vs. another for a certain task.   There will certainly be 
>>> tasks where Python is still superior in this sense simply because there are 
>>> many cases where Python calls highly tuned C libraries for operations that 
>>> have not been as optimized in Julia.  Julia will tend to shine the further 
>>> you stray from "built-in" operations in your performance-critical code.
>>>
>>
>> What I would like to know is do you need to make your own string type to 
>> make Julia as fast (by a constant factor) to say Python. In another answer 
>> IOBuffer was said to be not good enough.
>>
>>
>> -- 
>> Palli.
>>
>

[julia-users] using SortingAlgorithms: UndefVarError: Range1 not defined

2015-05-03 Thread jansen . gerald
I've managed to download Julia from git and (after installing cmake) 
managed to compile everything (whew!).

I'm getting a load error from: using SortingAlgorithms

julia> using SortingAlgorithms
ERROR: LoadError: UndefVarError: Range1 not defined
 ...
while loading 
/home/gjansen/.julia/v0.4/SortingAlgorithms/src/SortingAlgorithms.jl, in 
expression starting on line 136

julia> versioninfo()
Julia Version 0.4.0-dev+4599
Commit 3f2ed27 (2015-05-02 10:55 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia> using SortingAlgorithms

tia
Gerald Jansen