[julia-users] Meaty example of using singleton types

2015-12-09 Thread milktrader
Trying to wrap my mind around singleton types to see if they might be 
useful for something I'm working on, but running into some confusion. Here 
is an example that I started working with:

julia> type BadInt
   end

julia> import Base.+

julia> +(x::BadInt, y::Int64) = x - y
+ (generic function with 172 methods)

julia> BadInt() = 2
BadInt

julia> BadInt + 2
ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, ::Int64)
Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...)
  +(::Int64, ::Int64)
  +(::Complex{Bool}, ::Real)
  ...

As I understand, a singleton type can only take on a single value. What's 
the utility in supporting this?


Re: [julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread milktrader
Thanks, that's something to look at.

On Wednesday, December 9, 2015 at 9:28:13 AM UTC-5, Eric Forgy wrote:
>
> How about this?
>
>
> https://github.com/JuliaLang/julia/blob/2d821670d2516cd38b51710b07b3eb18f191cd1b/base/multimedia.jl
>
>
> On Wednesday, December 9, 2015 at 10:22:06 PM UTC+8, milktrader wrote:
>>
>> I'd like a somewhat clever example (or boring one for that matter) that 
>> shows:
>>
>> 1. How to create an instance of a singleton type
>>
>> 2. How to write methods that use this type in a meaningful way.
>>
>> 3. How it's used in Base code (I seem to recall Void is a singleton type)
>>
>> On Wednesday, December 9, 2015 at 9:02:31 AM UTC-5, tshort wrote:
>>>
>>> I'm not sure what you want, either. How about this?
>>>
>>> julia> type BadInt{X} end
>>>
>>> julia> BadInt{3}()
>>> BadInt{3}()
>>>
>>> julia> f{X}(::Type{BadInt{X}}, y) = X - y
>>> f (generic function with 1 method)
>>>
>>> julia> f(BadInt{10}, 3)
>>> 7
>>>
>>> julia> f{X}(::BadInt{X}, y) = X - y
>>> f (generic function with 2 methods)
>>>
>>> julia> f(BadInt{10}(), 3)
>>> 7
>>>
>>>
>>> On Wed, Dec 9, 2015 at 8:56 AM, Eric Forgy <eric@gmail.com> wrote:
>>>
>>>> Not sure I follow, but does this help?
>>>>
>>>> julia> type BadInt
>>>>end
>>>>
>>>> julia> bi = BadInt()
>>>> BadInt()
>>>>
>>>> julia> typeof(bi)
>>>> BadInt
>>>>
>>>>
>>>> On Wednesday, December 9, 2015 at 9:46:01 PM UTC+8, milktrader wrote:
>>>>>
>>>>> How do you create an instance of type BadInt then?
>>>>>
>>>>> On Wednesday, December 9, 2015 at 7:01:25 AM UTC-5, milktrader wrote:
>>>>>>
>>>>>> Trying to wrap my mind around singleton types to see if they might be 
>>>>>> useful for something I'm working on, but running into some confusion. 
>>>>>> Here 
>>>>>> is an example that I started working with:
>>>>>>
>>>>>> julia> type BadInt
>>>>>>end
>>>>>>
>>>>>> julia> import Base.+
>>>>>>
>>>>>> julia> +(x::BadInt, y::Int64) = x - y
>>>>>> + (generic function with 172 methods)
>>>>>>
>>>>>> julia> BadInt() = 2
>>>>>> BadInt
>>>>>>
>>>>>> julia> BadInt + 2
>>>>>> ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, 
>>>>>> ::Int64)
>>>>>> Closest candidates are:
>>>>>>   +(::Any, ::Any, ::Any, ::Any...)
>>>>>>   +(::Int64, ::Int64)
>>>>>>   +(::Complex{Bool}, ::Real)
>>>>>>   ...
>>>>>>
>>>>>> As I understand, a singleton type can only take on a single value. 
>>>>>> What's the utility in supporting this?
>>>>>>
>>>>>
>>>

Re: [julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread milktrader
I'd like a somewhat clever example (or boring one for that matter) that 
shows:

1. How to create an instance of a singleton type

2. How to write methods that use this type in a meaningful way.

3. How it's used in Base code (I seem to recall Void is a singleton type)

On Wednesday, December 9, 2015 at 9:02:31 AM UTC-5, tshort wrote:
>
> I'm not sure what you want, either. How about this?
>
> julia> type BadInt{X} end
>
> julia> BadInt{3}()
> BadInt{3}()
>
> julia> f{X}(::Type{BadInt{X}}, y) = X - y
> f (generic function with 1 method)
>
> julia> f(BadInt{10}, 3)
> 7
>
> julia> f{X}(::BadInt{X}, y) = X - y
> f (generic function with 2 methods)
>
> julia> f(BadInt{10}(), 3)
> 7
>
>
> On Wed, Dec 9, 2015 at 8:56 AM, Eric Forgy <eric@gmail.com 
> > wrote:
>
>> Not sure I follow, but does this help?
>>
>> julia> type BadInt
>>end
>>
>> julia> bi = BadInt()
>> BadInt()
>>
>> julia> typeof(bi)
>> BadInt
>>
>>
>> On Wednesday, December 9, 2015 at 9:46:01 PM UTC+8, milktrader wrote:
>>>
>>> How do you create an instance of type BadInt then?
>>>
>>> On Wednesday, December 9, 2015 at 7:01:25 AM UTC-5, milktrader wrote:
>>>>
>>>> Trying to wrap my mind around singleton types to see if they might be 
>>>> useful for something I'm working on, but running into some confusion. Here 
>>>> is an example that I started working with:
>>>>
>>>> julia> type BadInt
>>>>end
>>>>
>>>> julia> import Base.+
>>>>
>>>> julia> +(x::BadInt, y::Int64) = x - y
>>>> + (generic function with 172 methods)
>>>>
>>>> julia> BadInt() = 2
>>>> BadInt
>>>>
>>>> julia> BadInt + 2
>>>> ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, 
>>>> ::Int64)
>>>> Closest candidates are:
>>>>   +(::Any, ::Any, ::Any, ::Any...)
>>>>   +(::Int64, ::Int64)
>>>>   +(::Complex{Bool}, ::Real)
>>>>   ...
>>>>
>>>> As I understand, a singleton type can only take on a single value. 
>>>> What's the utility in supporting this?
>>>>
>>>
>

[julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread milktrader
How do you create an instance of type BadInt then?

On Wednesday, December 9, 2015 at 7:01:25 AM UTC-5, milktrader wrote:
>
> Trying to wrap my mind around singleton types to see if they might be 
> useful for something I'm working on, but running into some confusion. Here 
> is an example that I started working with:
>
> julia> type BadInt
>end
>
> julia> import Base.+
>
> julia> +(x::BadInt, y::Int64) = x - y
> + (generic function with 172 methods)
>
> julia> BadInt() = 2
> BadInt
>
> julia> BadInt + 2
> ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, ::Int64)
> Closest candidates are:
>   +(::Any, ::Any, ::Any, ::Any...)
>   +(::Int64, ::Int64)
>   +(::Complex{Bool}, ::Real)
>   ...
>
> As I understand, a singleton type can only take on a single value. What's 
> the utility in supporting this?
>


Re: [julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread milktrader
Ok, thanks. Can you do the following then?

1. restrict the value of Foo to an Int64?
2. assign the value of 6 to the singleton?



On Wednesday, December 9, 2015 at 1:09:08 PM UTC-5, Yichao Yu wrote:
>
> On Wed, Dec 9, 2015 at 12:50 PM, milktrader <milkt...@gmail.com 
> > wrote: 
> > Can you provide a Foo example of how this works, with both construction 
> and 
> > method definition? 
>
> julia> type Foo 
>end 
>
> julia> Base.(:+)(::Foo, x) = x 
> + (generic function with 175 methods) 
>
> julia> Foo() + 1 
> 1 
>
> julia> Foo() + "bar" 
> "bar" 
>
>
> > 
> > On Wednesday, December 9, 2015 at 9:32:36 AM UTC-5, Yichao Yu wrote: 
> >> 
> >> On Wed, Dec 9, 2015 at 9:22 AM, milktrader <milkt...@gmail.com> wrote: 
> >> > I'd like a somewhat clever example (or boring one for that matter) 
> that 
> >> > shows: 
> >> > 
> >> > 1. How to create an instance of a singleton type 
> >> 
> >> Call the constructor just like any other types. 
> >> 
> >> The only special thing about singleton type is that two instance of a 
> >> mutable singleton type are identical. Other than this, they are simply 
> >> types that doesn't have a field. 
> >> 
> >> > 
> >> > 2. How to write methods that use this type in a meaningful way. 
> >> 
> >> Just like any other types. As long as you are not comparing them, they 
> >> are exactly the same with everything else. 
> >> 
> >> > 
> >> > 3. How it's used in Base code (I seem to recall Void is a singleton 
> >> > type) 
> >> > 
> >> > On Wednesday, December 9, 2015 at 9:02:31 AM UTC-5, tshort wrote: 
> >> >> 
> >> >> I'm not sure what you want, either. How about this? 
> >> >> 
> >> >> julia> type BadInt{X} end 
> >> >> 
> >> >> julia> BadInt{3}() 
> >> >> BadInt{3}() 
> >> >> 
> >> >> julia> f{X}(::Type{BadInt{X}}, y) = X - y 
> >> >> f (generic function with 1 method) 
> >> >> 
> >> >> julia> f(BadInt{10}, 3) 
> >> >> 7 
> >> >> 
> >> >> julia> f{X}(::BadInt{X}, y) = X - y 
> >> >> f (generic function with 2 methods) 
> >> >> 
> >> >> julia> f(BadInt{10}(), 3) 
> >> >> 7 
> >> >> 
> >> >> 
> >> >> On Wed, Dec 9, 2015 at 8:56 AM, Eric Forgy <eric@gmail.com> 
> wrote: 
> >> >>> 
> >> >>> Not sure I follow, but does this help? 
> >> >>> 
> >> >>> julia> type BadInt 
> >> >>>end 
> >> >>> 
> >> >>> julia> bi = BadInt() 
> >> >>> BadInt() 
> >> >>> 
> >> >>> julia> typeof(bi) 
> >> >>> BadInt 
> >> >>> 
> >> >>> 
> >> >>> On Wednesday, December 9, 2015 at 9:46:01 PM UTC+8, milktrader 
> wrote: 
> >> >>>> 
> >> >>>> How do you create an instance of type BadInt then? 
> >> >>>> 
> >> >>>> On Wednesday, December 9, 2015 at 7:01:25 AM UTC-5, milktrader 
> wrote: 
> >> >>>>> 
> >> >>>>> Trying to wrap my mind around singleton types to see if they 
> might 
> >> >>>>> be 
> >> >>>>> useful for something I'm working on, but running into some 
> >> >>>>> confusion. Here 
> >> >>>>> is an example that I started working with: 
> >> >>>>> 
> >> >>>>> julia> type BadInt 
> >> >>>>>end 
> >> >>>>> 
> >> >>>>> julia> import Base.+ 
> >> >>>>> 
> >> >>>>> julia> +(x::BadInt, y::Int64) = x - y 
> >> >>>>> + (generic function with 172 methods) 
> >> >>>>> 
> >> >>>>> julia> BadInt() = 2 
> >> >>>>> BadInt 
> >> >>>>> 
> >> >>>>> julia> BadInt + 2 
> >> >>>>> ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, 
> >> >>>>> ::Int64) 
> >> >>>>> Closest candidates are: 
> >> >>>>>   +(::Any, ::Any, ::Any, ::Any...) 
> >> >>>>>   +(::Int64, ::Int64) 
> >> >>>>>   +(::Complex{Bool}, ::Real) 
> >> >>>>>   ... 
> >> >>>>> 
> >> >>>>> As I understand, a singleton type can only take on a single 
> value. 
> >> >>>>> What's the utility in supporting this? 
> >> >> 
> >> >> 
> >> > 
>


Re: [julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread milktrader
Can you provide a Foo example of how this works, with both construction and 
method definition?

On Wednesday, December 9, 2015 at 9:32:36 AM UTC-5, Yichao Yu wrote:
>
> On Wed, Dec 9, 2015 at 9:22 AM, milktrader <milkt...@gmail.com 
> > wrote: 
> > I'd like a somewhat clever example (or boring one for that matter) that 
> > shows: 
> > 
> > 1. How to create an instance of a singleton type 
>
> Call the constructor just like any other types. 
>
> The only special thing about singleton type is that two instance of a 
> mutable singleton type are identical. Other than this, they are simply 
> types that doesn't have a field. 
>
> > 
> > 2. How to write methods that use this type in a meaningful way. 
>
> Just like any other types. As long as you are not comparing them, they 
> are exactly the same with everything else. 
>
> > 
> > 3. How it's used in Base code (I seem to recall Void is a singleton 
> type) 
> > 
> > On Wednesday, December 9, 2015 at 9:02:31 AM UTC-5, tshort wrote: 
> >> 
> >> I'm not sure what you want, either. How about this? 
> >> 
> >> julia> type BadInt{X} end 
> >> 
> >> julia> BadInt{3}() 
> >> BadInt{3}() 
> >> 
> >> julia> f{X}(::Type{BadInt{X}}, y) = X - y 
> >> f (generic function with 1 method) 
> >> 
> >> julia> f(BadInt{10}, 3) 
> >> 7 
> >> 
> >> julia> f{X}(::BadInt{X}, y) = X - y 
> >> f (generic function with 2 methods) 
> >> 
> >> julia> f(BadInt{10}(), 3) 
> >> 7 
> >> 
> >> 
> >> On Wed, Dec 9, 2015 at 8:56 AM, Eric Forgy <eric@gmail.com> wrote: 
> >>> 
> >>> Not sure I follow, but does this help? 
> >>> 
> >>> julia> type BadInt 
> >>>end 
> >>> 
> >>> julia> bi = BadInt() 
> >>> BadInt() 
> >>> 
> >>> julia> typeof(bi) 
> >>> BadInt 
> >>> 
> >>> 
> >>> On Wednesday, December 9, 2015 at 9:46:01 PM UTC+8, milktrader wrote: 
> >>>> 
> >>>> How do you create an instance of type BadInt then? 
> >>>> 
> >>>> On Wednesday, December 9, 2015 at 7:01:25 AM UTC-5, milktrader wrote: 
> >>>>> 
> >>>>> Trying to wrap my mind around singleton types to see if they might 
> be 
> >>>>> useful for something I'm working on, but running into some 
> confusion. Here 
> >>>>> is an example that I started working with: 
> >>>>> 
> >>>>> julia> type BadInt 
> >>>>>end 
> >>>>> 
> >>>>> julia> import Base.+ 
> >>>>> 
> >>>>> julia> +(x::BadInt, y::Int64) = x - y 
> >>>>> + (generic function with 172 methods) 
> >>>>> 
> >>>>> julia> BadInt() = 2 
> >>>>> BadInt 
> >>>>> 
> >>>>> julia> BadInt + 2 
> >>>>> ERROR: MethodError: `+` has no method matching +(::Type{BadInt}, 
> >>>>> ::Int64) 
> >>>>> Closest candidates are: 
> >>>>>   +(::Any, ::Any, ::Any, ::Any...) 
> >>>>>   +(::Int64, ::Int64) 
> >>>>>   +(::Complex{Bool}, ::Real) 
> >>>>>   ... 
> >>>>> 
> >>>>> As I understand, a singleton type can only take on a single value. 
> >>>>> What's the utility in supporting this? 
> >> 
> >> 
> > 
>


Re: [julia-users] Convert SubString{ASCIIString} to String

2015-12-07 Thread milktrader
Can you post the first 10 lines or so of the file you'd like to parse?

Dan

On Sunday, December 6, 2015 at 12:34:02 PM UTC-5, Charles Santana wrote:
>
> Hi, thanks for all your suggestions!
>
> @Eric: unfortunately readcsv and readtable give me the same situation as 
> readdlm. 
>
> @Milan: thanks for the suggestion. Just created it: 
> https://github.com/milktrader/Quandl.jl/issues/91
>
> Best,
>
> Charles
>
> On 5 December 2015 at 23:07, Milan Bouchet-Valat <nali...@club.fr 
> > wrote:
>
>> Le vendredi 04 décembre 2015 à 23:47 +0100, Charles Novaes de Santana a
>> écrit :
>> > Hi people,
>> >
>> > Maybe it is a trivial question for most of you, but I really could
>> > not find a way to solve my problem.
>> >
>> > I am using the function quandlget(id::ASCIIString) from the library
>> > https://github.com/milktrader/Quandl.jl (a great contribution, by the
>> > way!)
>> >
>> > Everything works fine when I use it in a straightforward way:
>> >
>> > julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
>> > 100x6 DataFrames.DataFrame
>> > | Row | Date   | Open   | High   | Low| Close  | Volume|
>> > |-||||||---|
>> > | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>> > | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>> > | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>> >
>> >
>> > or when I do:
>> >
>> > julia> myid = "GOOG/NASDAQ_GOOG"
>> > "GOOG/NASDAQ_GOOG"
>> >
>> > julia> typeof(myid)
>> > ASCIIString
>> >
>> > julia> mydat = quandl(myid,rows=100,format="DataFrame")
>> > 100x6 DataFrames.DataFrame
>> > | Row | Date   | Open   | High   | Low| Close  | Volume|
>> > |-||||||---|
>> > | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
>> > | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
>> > | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
>> >
>> >
>> > However, I get an error when I read my data from an external file.
>> > Assume I have an ascii file containing only one line:
>> >
>> > $ echo "GOOG/NASDAQ_GOOG" > portfolio.txt
>> >
>> > $ cat portfolio.txt
>> > GOOG/NASDAQ_GOOG
>> >
>> >
>> > I just read the content of this file by using readdlm and try to use
>> > it to call the same function quandl, but it does not work.
>> >
>> > julia> myportfolio = readdlm("./portfolio.txt",'\n')
>> > 1x1 Array{Any,2}:
>> >  "GOOG/NASDAQ_GOOG"
>> >
>> > julia> typeof(myportfolio[1])
>> > SubString{ASCIIString}
>> >
>> > julia> mydat = quandl(myportfolio[1],rows=100,format="DataFrame")
>> > ERROR: MethodError: `quandlget` has no method matching
>> > quandlget(::SubString{ASCIIString})
>> Though the other posts give good solutions to your problem, you could
>> also file an issue against Quandl.jl to change quandlget() to accept
>> any AbstractString, and not only ASCIIString. That would be helpful in
>> legitimate cases.
>>
>>
>> Regards
>>
>> > I suppose the easiest way to solve this problem is to convert my
>> > SubString{ASCIIString} variable to ASCIIString. Am I right here? How
>> > can I do it?
>> >
>> > Does any of you have another suggestion? May be I could read my data
>> > in a different way instead of using readdlm?
>> >
>> > Thanks for any tip!
>> >
>> > best,
>> >
>> > Charles
>> > --
>> > Um axé! :)
>> >
>> > --
>> > Charles Novaes de Santana, PhD
>> > http://www.imedea.uib-csic.es/~charles
>>
>
>
>
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


Re: [julia-users] Re: Access Bloomberg data with Julia

2015-11-19 Thread milktrader
I'll start on this package but not promising I have time to devote right 
now. https://github.com/milktrader/Bloomberg.jl

Stop by and check the progress though and feel free to contribute.

Cheers,

Dan

On Thursday, November 19, 2015 at 4:46:42 PM UTC-5, Charles Santana wrote:
>
> Hi, 
>
> Thanks for the tips! I am taking a look at their python api and my first 
> idea was to use PyCall.jl to call their functions. But I will also consider 
> the option to adapt Quandl.jl functions. 
>
> I forgot to send the link for the bloomberg open source initiative: 
> http://www.bloomberglabs.com/api/libraries/
>
> Thanks!
>
>
> On 19 November 2015 at 22:12, milktrader <milkt...@gmail.com 
> > wrote:
>
>> Hmm, looking at the Bloomberg API it appears you'll need to wrap their C 
>> API, so a bit more involved than what Quandl.jl does. 
>>
>> I didn't realize Bloomberg had an open source initiative. 
>>
>>
>> On Thursday, November 19, 2015 at 3:21:31 PM UTC-5, milktrader wrote:
>>>
>>> It wouldn't take much to make a Julia package for this. Bloomberg data 
>>> is subscription-based, no? You could copy how Quandl.jl does this and 
>>> simply replace the Quandl api with the Bloomberg api.
>>>
>>> Good luck
>>>
>>>
>>>
>>> On Wednesday, November 18, 2015 at 5:58:56 PM UTC-5, Charles Santana 
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Does anyone know a way to access Bloomberg data with Julia? 
>>>>
>>>> I know there is a library in R (
>>>> http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
>>>>  
>>>> but I think it is no longer updated. 
>>>>
>>>> There is also an API for Python, available here: 
>>>> https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl  
>>>>
>>>> However, I would prefer to use some library in Julia, if it exists. I 
>>>> found some packages to work with finances, but I didn't see any mention to 
>>>> Bloomberg database. 
>>>>
>>>> Thanks for any tip!
>>>>
>>>> Charles
>>>>
>>>> -- 
>>>> Um axé! :)
>>>>
>>>> --
>>>> Charles Novaes de Santana, PhD
>>>> http://www.imedea.uib-csic.es/~charles
>>>>
>>>
>
>
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


[julia-users] Re: Access Bloomberg data with Julia

2015-11-19 Thread milktrader
It wouldn't take much to make a Julia package for this. Bloomberg data is 
subscription-based, no? You could copy how Quandl.jl does this and simply 
replace the Quandl api with the Bloomberg api.

Good luck



On Wednesday, November 18, 2015 at 5:58:56 PM UTC-5, Charles Santana wrote:
>
> Hi,
>
> Does anyone know a way to access Bloomberg data with Julia? 
>
> I know there is a library in R (
> http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
>  
> but I think it is no longer updated. 
>
> There is also an API for Python, available here: 
> https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl  
>
> However, I would prefer to use some library in Julia, if it exists. I 
> found some packages to work with finances, but I didn't see any mention to 
> Bloomberg database. 
>
> Thanks for any tip!
>
> Charles
>
> -- 
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>


[julia-users] Re: Access Bloomberg data with Julia

2015-11-19 Thread milktrader
Hmm, looking at the Bloomberg API it appears you'll need to wrap their C 
API, so a bit more involved than what Quandl.jl does. 

I didn't realize Bloomberg had an open source initiative. 

On Thursday, November 19, 2015 at 3:21:31 PM UTC-5, milktrader wrote:
>
> It wouldn't take much to make a Julia package for this. Bloomberg data is 
> subscription-based, no? You could copy how Quandl.jl does this and simply 
> replace the Quandl api with the Bloomberg api.
>
> Good luck
>
>
>
> On Wednesday, November 18, 2015 at 5:58:56 PM UTC-5, Charles Santana wrote:
>>
>> Hi,
>>
>> Does anyone know a way to access Bloomberg data with Julia? 
>>
>> I know there is a library in R (
>> http://ftp.auckland.ac.nz/software/CRAN/src/contrib/Descriptions/RBloomberg.html)
>>  
>> but I think it is no longer updated. 
>>
>> There is also an API for Python, available here: 
>> https://github.com/filmackay/blpapi-py  I might try to use PyCall.jl  
>>
>> However, I would prefer to use some library in Julia, if it exists. I 
>> found some packages to work with finances, but I didn't see any mention to 
>> Bloomberg database. 
>>
>> Thanks for any tip!
>>
>> Charles
>>
>> -- 
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> http://www.imedea.uib-csic.es/~charles
>>
>

Re: [julia-users] Why does Tk.jl have pre-compile code and set it to "false"?

2015-11-12 Thread milktrader
Yeah, the message isn't too big, so here it is ...
julia> using Tk
INFO: Precompiling module Tk...
fatal: error thrown and no exception handler available.
ErrorException("Task cannot be serialized")
rec_backtrace at /Users/Administrator/.pantry/julia-0.4.0/src/task.c:644
jl_error at 
/Users/Administrator/.pantry/julia-0.4.0/julia/usr/lib/libjulia.dylib 
(unknown line)
jl_serialize_fptr at /Users/Administrator/.pantry/julia-0.4.0/src/dump.c:439
jl_serialize_value_ at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:738
jl_serialize_value_ at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:900
jl_serialize_value_ at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:900
jl_serialize_module at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:566
jl_serialize_value_ at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:738
jl_finalize_serializer at 
/Users/Administrator/.pantry/julia-0.4.0/src/dump.c:1673
julia_save at /Users/Administrator/.pantry/julia-0.4.0/src/init.c:629
main at /Users/Administrator/.pantry/julia-0.4.0/julia/usr/bin/julia 
(unknown line)
ERROR: Failed to precompile Tk to /Users/Administrator/.julia/lib/v0.4/Tk.ji
 in error at ./error.jl:21
 in compilecache at loading.jl:383
 in require at ./loading.jl:250



On Thursday, November 12, 2015 at 2:02:10 PM UTC-5, Tim Holy wrote:
>
> Try it and see what happens :-). 
>
> Better that Winston switch to Gtk. I have a PR open for that. 
>
> --Tim 
>
> On Thursday, November 12, 2015 10:48:42 AM milktrader wrote: 
> > This is the first line in the module definition: 
> > 
> > VERSION >= v"0.4.0-dev+6521" && __precompile__(false) 
> > 
> > Just curious what the issue here is as this prevents Winston from 
> > pre-compiling and results in long load times for Winston. 
>
>

[julia-users] Why does Tk.jl have pre-compile code and set it to "false"?

2015-11-12 Thread milktrader
This is the first line in the module definition:

VERSION >= v"0.4.0-dev+6521" && __precompile__(false)

Just curious what the issue here is as this prevents Winston from 
pre-compiling and results in long load times for Winston.


[julia-users] Fill below a density plot with color in Winston

2015-11-10 Thread milktrader
Suppose you have a density plot ...

using Winston, KernelDensity

k = kde(rand(100))

Winston.plot(k)

Which would look something similar to this:


1) How can you fill below the curve with color? The two candidates 
for available methods include FillBelow()and FillBetween().

2) Is it then possible to fill below the curve from 0:0.5 with one color 
and below the curve from 0.5:1 with another color?


[julia-users] Re: Fill below a density plot with color in Winston

2015-11-10 Thread milktrader


> The solution to the two-color problem is ...
>

using Winston, KernelDensity
 
k = kde(rand(100))

k1 = k.x[k.x .< .5];

k2 = k.x[k.x .> .5];

f1 = FillBelow(k1, k.density[1:length(k1)], color="blue");

f2 = FillBelow(k2, k.density[length(k1)+1:end], color="red");

p = FramedPlot()

add(p, f1, f2)





Re: [julia-users] Google releases TensorFlow as open source

2015-11-10 Thread milktrader
Yep +1

On Tuesday, November 10, 2015 at 11:05:05 AM UTC-5, Stefan Karpinski wrote:
>
> Time for a JuliaML org?
>
> On Tuesday, November 10, 2015, Tom Breloff  
> wrote:
>
>> I'm interested as well.  Who wants to claim TensorFlow.jl?
>>
>> On Tue, Nov 10, 2015 at 9:11 AM, Ben Moran  wrote:
>>
>>> I'm very interested in this.  I haven't gone through the details yet but 
>>> they say that C++ API currently only supports a subset of the Python API 
>>> (weird!).
>>>
>>> One possibility is to use PyCall to wrap the Python version, like was 
>>> done for PyPlot, SymPy and like I began tentatively for Theano here - 
>>> https://github.com/benmoran/MochaTheano.jl
>>>
>>>
>>> On Monday, 9 November 2015 21:06:41 UTC, Phil Tomson wrote:

 Looks like they used SWIG to create the Python bindings.  I don't see 
 Julia listed as an output target for SWIG.



 On Monday, November 9, 2015 at 1:02:36 PM UTC-8, Phil Tomson wrote:
>
> Google has released it's deep learning library called TensorFlow as 
> open source code:
>
> https://github.com/tensorflow/tensorflow
>
> They include Python bindings, Any ideas about how easy/difficult it 
> would be to create Julia bindings?
>
> Phil
>

>>

[julia-users] Re: Fill below a density plot with color in Winston

2015-11-10 Thread milktrader
To answer question #1 only, this works ...

using Winston, KernelDensity

k = kde(rand(100))

fieldnames(k)

# outputs ...

# 2-element Array{Symbol,1}:
# :x  
# :density

f = FillBelow(k.x, k.density, color="blue")
p = FramedPlot()
add(p,f)

<https://lh3.googleusercontent.com/-j5ydICGZNtY/VkIpn7U0oPI/CI8/4USaNIp9h6k/s1600/Screen%2BShot%2B2015-11-10%2Bat%2B12.28.35%2BPM.png>













So now the only question is how to split this into two colors.







On Tuesday, November 10, 2015 at 11:55:20 AM UTC-5, milktrader wrote:
>
> Suppose you have a density plot ...
>
> using Winston, KernelDensity
>
> k = kde(rand(100))
>
> Winston.plot(k)
>
> Which would look something similar to this:
>
>
> <https://lh3.googleusercontent.com/-niF7G-oaS5k/VkIgzW2Z-WI/CIc/lzgixalvsuI/s1600/Screen%2BShot%2B2015-11-10%2Bat%2B11.51.54%2BAM.png>
> 1) How can you fill below the curve with color? The two candidates 
> for available methods include FillBelow()and FillBetween().
>
> 2) Is it then possible to fill below the curve from 0:0.5 with one color 
> and below the curve from 0.5:1 with another color?
>


[julia-users] Re: Fill below a density plot with color in Winston

2015-11-10 Thread milktrader
I'll be honest, the code to do this in R is substantially more 
non-intuitive. Nice work Mike!

On Tuesday, November 10, 2015 at 12:51:32 PM UTC-5, milktrader wrote:
>
>
> The solution to the two-color problem is ...
>>
>
> using Winston, KernelDensity
>  
> k = kde(rand(100))
>
> k1 = k.x[k.x .< .5];
>
> k2 = k.x[k.x .> .5];
>
> f1 = FillBelow(k1, k.density[1:length(k1)], color="blue");
>
> f2 = FillBelow(k2, k.density[length(k1)+1:end], color="red");
>
> p = FramedPlot()
>
> add(p, f1, f2)
>
>
> <https://lh3.googleusercontent.com/-IZGoutLSGZo/VkIubnP-htI/CJQ/lRrZ1hBze9E/s1600/Screen%2BShot%2B2015-11-10%2Bat%2B12.50.17%2BPM.png>
>
>

Re: [julia-users] Re: Avoiding building LLVM with ever Julia release

2015-10-14 Thread milktrader
Thanks for the Make.user suggestion. I have an idea on how to make that 
work. Presumably (and this is not part of the original post) you 
can put linear algebra libraries somewhere too?


On Wednesday, October 14, 2015 at 11:11:56 AM UTC-4, Isaiah wrote:
>
> It should be possible to use an existing LLVM build by setting the 
> following in Make.user:
>
> USE_SYSTEM_LLVM=1
> LLVM_CONFIG=/path/to/llvm-config
>
> If you build LLVM manually you will need to be sure to apply the patches 
> specified in `deps/Makefile`.
>
> On Wed, Oct 14, 2015 at 10:54 AM, milktrader <milkt...@gmail.com 
> > wrote:
>
>> I like this solution and I've been using git from the beginning until I 
>> decided I needed to have multiple versions of Julia around at the same 
>> time, with the ability to open each version whenever I choose.
>>
>> My still rough implementation of this is to rename *julia* to other names 
>> based on version numbers
>>
>> [julia (master)] 
>> ✈  chefs
>>
>> 0.3.11  .  kevin
>> 0.4-rc1 .  wanda
>> 0.4-rc4 .  frida
>> 0.4-0   .  julius
>>
>> So this is straightforward to do the hard way (which is how I'm doing it 
>> now) by simply building each julia version from scratch.
>>
>> How would this work with using git versus tar files?
>>
>> On Wednesday, October 14, 2015 at 10:37:06 AM UTC-4, Tero Frondelius 
>> wrote:
>>>
>>> git clone https://github.com/JuliaLang/julia.git
>>> cd julia
>>> make
>>>
>>>
>>> after update in julia folder:
>>> git fetch
>>> git branch v0.4.1
>>> make
>>>
>>>
>>> Maybe some fine tuning in commands, but basically drop the method of 
>>> downloading tar and start using git. 
>>>
>>>
>>>
>>> On Wednesday, October 14, 2015 at 5:21:36 PM UTC+3, milktrader wrote:
>>>>
>>>> I'm downloading full tar files for each new Julia version and of course 
>>>> it comes with LLVM. I'd like to avoid building LLVM every single time and 
>>>> have it compiled once, and available for all the new Julia releases (that 
>>>> use that LLVM version of course).
>>>>
>>>> Any pointers?
>>>>
>>>> Dan
>>>>
>>>
>

[julia-users] Re: Avoiding building LLVM with ever Julia release

2015-10-14 Thread milktrader
I like this solution and I've been using git from the beginning until I 
decided I needed to have multiple versions of Julia around at the same 
time, with the ability to open each version whenever I choose.

My still rough implementation of this is to rename *julia* to other names 
based on version numbers

[julia (master)] 
✈  chefs

0.3.11  .  kevin
0.4-rc1 .  wanda
0.4-rc4 .  frida
0.4-0   .  julius

So this is straightforward to do the hard way (which is how I'm doing it 
now) by simply building each julia version from scratch.

How would this work with using git versus tar files?

On Wednesday, October 14, 2015 at 10:37:06 AM UTC-4, Tero Frondelius wrote:
>
> git clone https://github.com/JuliaLang/julia.git
> cd julia
> make
>
>
> after update in julia folder:
> git fetch
> git branch v0.4.1
> make
>
>
> Maybe some fine tuning in commands, but basically drop the method of 
> downloading tar and start using git. 
>
>
>
> On Wednesday, October 14, 2015 at 5:21:36 PM UTC+3, milktrader wrote:
>>
>> I'm downloading full tar files for each new Julia version and of course 
>> it comes with LLVM. I'd like to avoid building LLVM every single time and 
>> have it compiled once, and available for all the new Julia releases (that 
>> use that LLVM version of course).
>>
>> Any pointers?
>>
>> Dan
>>
>

[julia-users] Avoiding building LLVM with ever Julia release

2015-10-14 Thread milktrader
I'm downloading full tar files for each new Julia version and of course it 
comes with LLVM. I'd like to avoid building LLVM every single time and have 
it compiled once, and available for all the new Julia releases (that use 
that LLVM version of course).

Any pointers?

Dan


[julia-users] Re: The unique function and iterables of custom composite types

2015-07-16 Thread milktrader
How did you get  foos?

On Thursday, July 16, 2015 at 9:16:01 AM UTC-4, Marc Gallant wrote:

 The unique function doesn't appear to work using iterables of custom 
 composite types, e.g.,

 julia type Foo
x::Int
end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 85 methods)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true


 Is this the intended behaviour?



Re: [julia-users] The unique function and iterables of custom composite types

2015-07-16 Thread milktrader
Julia 0.4- has different behavior ...

First, with 0.3.9

julia versioninfo()
Julia Version 0.3.9
Commit 31efe69 (2015-05-30 11:24 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia type Foo
x::Int
end

julia import Base: ==

julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
== (generic function with 80 methods)

julia foos = [Foo(4), Foo(4)]
2-element Array{Foo,1}:
 Foo(4)
 Foo(4)

julia unique(foos)
2-element Array{Foo,1}:
 Foo(4)
 Foo(4)

julia unique(foos)[1] == unique(foos)[2]
true

And now 0.4-dev

julia versioninfo()
Julia Version 0.4.0-dev+5587
Commit 78760e2 (2015-06-25 14:27 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia type Foo
x::Int
end

julia import Base: ==

julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
== (generic function with 108 methods)

julia foos = [Foo(4), Foo(4)]
2-element Array{Foo,1}:
 Foo(4)
 Foo(4)

julia unique(foos)
1-element Array{Foo,1}:
 Foo(4)

julia unique(foos)[1] == unique(foos)[2]
ERROR: BoundsError: attempt to access 1-element Array{Foo,1}:
 Foo(4)
  at index [2]
 in getindex at array.jl:292



On Thursday, July 16, 2015 at 9:36:21 AM UTC-4, Stefan Karpinski wrote:

 You need to also define a hash method for this type.


 On Jul 16, 2015, at 9:16 AM, Marc Gallant marc.j@gmail.com 
 javascript: wrote:

 The unique function doesn't appear to work using iterables of custom 
 composite types, e.g.,

 julia type Foo
x::Int
end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 85 methods)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true


 Is this the intended behaviour?



Re: [julia-users] The unique function and iterables of custom composite types

2015-07-16 Thread milktrader
julia hash(foos[1]) #and hash(foos[2])
0xfa40ebab47e8bee1

julia hash(foos[2])
0x00ef97f955461671

On Thursday, July 16, 2015 at 11:36:03 AM UTC-4, Stefan Karpinski wrote:

 Dan and/or Seth, can you try that again and check if hash(foos[1]) and 
 hash(foos[2]) have the same last hex digit?

 On Thu, Jul 16, 2015 at 11:30 AM, Matt Bauman mba...@gmail.com 
 javascript: wrote:

 Bizarre.  I happen to have last updated on *exactly* the same commit SHA, 
 but I'm seeing the original (expected) behavior:

 $ julia -q
 julia versioninfo()
 Julia Version 0.4.0-dev+5860
 Commit 7fa43ed (2015-07-08 20:57 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin14.3.0)
   CPU: Intel(R) Core(TM) i5 CPU   M 520  @ 2.40GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
x::Int
end

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 109 methods)

 julia unique([Foo(4),Foo(4)])
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia @which hash(Foo(4), zero(UInt))
 hash(x::ANY, h::UInt64) at hashing.jl:10

 Might there be some package that changes this behavior?  Is the result of 
 `@which hash(Foo(4), zero(Uint))` the same as what I show above?


 On Thursday, July 16, 2015 at 11:02:46 AM UTC-4, Seth wrote:

 I can confirm this works as described by milktrader on 0.4.0-dev+5860 
 (2015-07-08 20:57 UTC) Commit 7fa43ed (7 days old master).

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)


 On Thursday, July 16, 2015 at 7:52:03 AM UTC-7, Stefan Karpinski wrote:

 I don't see that on 0.4-dev – it also doesn't seem possible without 
 having defined a hash method since unique is implemented with a dict.

 On Thu, Jul 16, 2015 at 10:29 AM, milktrader milkt...@gmail.com 
 wrote:

 Julia 0.4- has different behavior ...

 First, with 0.3.9

 julia versioninfo()
 Julia Version 0.3.9
 Commit 31efe69 (2015-05-30 11:24 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 80 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true

 And now 0.4-dev

 julia versioninfo()
 Julia Version 0.4.0-dev+5587
 Commit 78760e2 (2015-06-25 14:27 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 108 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 ERROR: BoundsError: attempt to access 1-element Array{Foo,1}:
  Foo(4)
   at index [2]
  in getindex at array.jl:292



 On Thursday, July 16, 2015 at 9:36:21 AM UTC-4, Stefan Karpinski wrote:

 You need to also define a hash method for this type.


 On Jul 16, 2015, at 9:16 AM, Marc Gallant marc.j@gmail.com 
 wrote:

 The unique function doesn't appear to work using iterables of custom 
 composite types, e.g.,

 julia type Foo
x::Int
end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 85 methods)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true


 Is this the intended behaviour?





Re: [julia-users] The unique function and iterables of custom composite types

2015-07-16 Thread milktrader
Also, back to the OP question, is the correct solution to simply define 

 Base.hash(f::Foo) = f.x



On Thursday, July 16, 2015 at 12:13:15 PM UTC-4, Seth wrote:

 Ah, ok, thanks. This might cause issues with one of my packages, which is 
 why I'm interested. How would you approach creating the hash dispatch for 
 custom types, and does this impact immutables as well?

 On Thursday, July 16, 2015 at 9:09:08 AM UTC-7, Stefan Karpinski wrote:

 This is just an artifact of memory layout – hashing by identity is based 
 on object_id which is based on memory address. It's not a meaningful 
 behavioral difference between Julia versions. Sticking mutable objects for 
 which hash and == disagree is an undefined behavior and causes dictionaries 
 to do potentially weird things.

 On Thu, Jul 16, 2015 at 12:04 PM, Seth catc...@bromberger.com wrote:

 I can't because I just rebuilt to latest to test 
 https://github.com/JuliaLang/julia/issues/12063 - but I'll try on the 
 latest master...

 ... and Julia Version 0.4.0-dev+6005 Commit 242bf47 does not appear to 
 have the issue (I'm getting two results returned for unique()).

 On Thursday, July 16, 2015 at 8:36:03 AM UTC-7, Stefan Karpinski wrote:

 Dan and/or Seth, can you try that again and check if hash(foos[1]) and 
 hash(foos[2]) have the same last hex digit?

 On Thu, Jul 16, 2015 at 11:30 AM, Matt Bauman mba...@gmail.com wrote:

 Bizarre.  I happen to have last updated on *exactly* the same commit 
 SHA, but I'm seeing the original (expected) behavior:

 $ julia -q
 julia versioninfo()
 Julia Version 0.4.0-dev+5860
 Commit 7fa43ed (2015-07-08 20:57 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin14.3.0)
   CPU: Intel(R) Core(TM) i5 CPU   M 520  @ 2.40GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
x::Int
end

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 109 methods)

 julia unique([Foo(4),Foo(4)])
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia @which hash(Foo(4), zero(UInt))
 hash(x::ANY, h::UInt64) at hashing.jl:10

 Might there be some package that changes this behavior?  Is the result 
 of `@which hash(Foo(4), zero(Uint))` the same as what I show above?


 On Thursday, July 16, 2015 at 11:02:46 AM UTC-4, Seth wrote:

 I can confirm this works as described by milktrader on 0.4.0-dev+5860 
 (2015-07-08 20:57 UTC) Commit 7fa43ed (7 days old master).

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)


 On Thursday, July 16, 2015 at 7:52:03 AM UTC-7, Stefan Karpinski 
 wrote:

 I don't see that on 0.4-dev – it also doesn't seem possible without 
 having defined a hash method since unique is implemented with a dict.

 On Thu, Jul 16, 2015 at 10:29 AM, milktrader milkt...@gmail.com 
 wrote:

 Julia 0.4- has different behavior ...

 First, with 0.3.9

 julia versioninfo()
 Julia Version 0.3.9
 Commit 31efe69 (2015-05-30 11:24 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 80 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true

 And now 0.4-dev

 julia versioninfo()
 Julia Version 0.4.0-dev+5587
 Commit 78760e2 (2015-06-25 14:27 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 108 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 ERROR: BoundsError: attempt to access 1-element Array{Foo,1}:
  Foo(4)
   at index [2]
  in getindex at array.jl:292



 On Thursday, July 16, 2015 at 9:36:21 AM UTC-4, Stefan Karpinski 
 wrote:

 You need to also define a hash method for this type.


 On Jul 16, 2015, at 9:16 AM, Marc Gallant marc.j@gmail.com 
 wrote:

 The unique function doesn't appear to work using iterables of 
 custom composite types, e.g.,

 julia type Foo
x::Int
end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 85 methods)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1

Re: [julia-users] The unique function and iterables of custom composite types

2015-07-16 Thread milktrader
Yep, restarting I don't get the one-element array

julia type Foo
x::Int
end

julia import Base: ==

julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
== (generic function with 108 methods)

julia foos = [Foo(4), Foo(4)]
2-element Array{Foo,1}:
 Foo(4)
 Foo(4)

julia unique(foos)
2-element Array{Foo,1}:
 Foo(4)
 Foo(4)


On Thursday, July 16, 2015 at 11:50:52 AM UTC-4, Stefan Karpinski wrote:

 Well, that's it then. Cause: accidental hash collision. The fix is to 
 define hash for the type. This makes me wonder if we shouldn't just leave 
 hash undefined for custom mutable types and make it easy to opt into 
 hashing by identity. At least then you'll get a clear no method error (and 
 we could trap that and add more helpful information), instead of weird 
 behavior when you define == but not hash for your types.

 On Thu, Jul 16, 2015 at 11:39 AM, milktrader milkt...@gmail.com 
 javascript: wrote:

 julia hash(foos[1]) #and hash(foos[2])
 0xfa40ebab47e8bee1

 julia hash(foos[2])
 0x00ef97f955461671

 On Thursday, July 16, 2015 at 11:36:03 AM UTC-4, Stefan Karpinski wrote:

 Dan and/or Seth, can you try that again and check if hash(foos[1]) and 
 hash(foos[2]) have the same last hex digit?

 On Thu, Jul 16, 2015 at 11:30 AM, Matt Bauman mba...@gmail.com wrote:

 Bizarre.  I happen to have last updated on *exactly* the same commit 
 SHA, but I'm seeing the original (expected) behavior:

 $ julia -q
 julia versioninfo()
 Julia Version 0.4.0-dev+5860
 Commit 7fa43ed (2015-07-08 20:57 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin14.3.0)
   CPU: Intel(R) Core(TM) i5 CPU   M 520  @ 2.40GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
x::Int
end

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 109 methods)

 julia unique([Foo(4),Foo(4)])
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia @which hash(Foo(4), zero(UInt))
 hash(x::ANY, h::UInt64) at hashing.jl:10

 Might there be some package that changes this behavior?  Is the result 
 of `@which hash(Foo(4), zero(Uint))` the same as what I show above?


 On Thursday, July 16, 2015 at 11:02:46 AM UTC-4, Seth wrote:

 I can confirm this works as described by milktrader on 0.4.0-dev+5860 
 (2015-07-08 20:57 UTC) Commit 7fa43ed (7 days old master).

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)


 On Thursday, July 16, 2015 at 7:52:03 AM UTC-7, Stefan Karpinski wrote:

 I don't see that on 0.4-dev – it also doesn't seem possible without 
 having defined a hash method since unique is implemented with a dict.

 On Thu, Jul 16, 2015 at 10:29 AM, milktrader milkt...@gmail.com 
 wrote:

 Julia 0.4- has different behavior ...

 First, with 0.3.9

 julia versioninfo()
 Julia Version 0.3.9
 Commit 31efe69 (2015-05-30 11:24 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 80 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true

 And now 0.4-dev

 julia versioninfo()
 Julia Version 0.4.0-dev+5587
 Commit 78760e2 (2015-06-25 14:27 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.4.0)
   CPU: Intel(R) Core(TM)2 Duo CPU P7350  @ 2.00GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3

 julia type Foo
 x::Int
 end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 108 methods)

 julia foos = [Foo(4), Foo(4)]
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)
 1-element Array{Foo,1}:
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 ERROR: BoundsError: attempt to access 1-element Array{Foo,1}:
  Foo(4)
   at index [2]
  in getindex at array.jl:292



 On Thursday, July 16, 2015 at 9:36:21 AM UTC-4, Stefan Karpinski 
 wrote:

 You need to also define a hash method for this type.


 On Jul 16, 2015, at 9:16 AM, Marc Gallant marc.j@gmail.com 
 wrote:

 The unique function doesn't appear to work using iterables of 
 custom composite types, e.g.,

 julia type Foo
x::Int
end

 julia import Base: ==

 julia ==(f1::Foo, f2::Foo) = f1.x == f2.x
 == (generic function with 85 methods)

 julia unique(foos)
 2-element Array{Foo,1}:
  Foo(4)
  Foo(4)

 julia unique(foos)[1] == unique(foos)[2]
 true


 Is this the intended behaviour?






Re: [julia-users] Re: Too many packages?

2015-07-13 Thread milktrader
I echo Tom Breloff's sentiment that Pkg.add() should simply be expanded to 
allow various repos of repos in a kwarg argument. This is an open issue here 
https://github.com/JuliaLang/julia/issues/11914.

The default repo of repos would be METADATA or maybe it's possible new name 
of CuratedPackages, and third parties would be welcome to add their own 
repo of repos which I'm sure could be coded into the method (i.e., JewelBox 
would map to https://github.com/JuliaJulia/JewelBox.jl) or alternatively 
the url can be provided as a string.  

On Monday, July 13, 2015 at 2:57:14 PM UTC-4, Jacob Quinn wrote:

 Note there's also an open issue for requiring a higher overall standard 
 for officially registered packages in the JuliaLang/METADATA.jl package 
 repository. It's a big issue with a lot of work required to get to the 
 proposal, but it would lead to (hopefully) instilling more confidence in 
 users knowing that anything they add through `Pkg.add()` would meet some 
 acceptable level of quality and robustness.

 -Jacob

 On Mon, Jul 13, 2015 at 11:11 AM, Christoph Ortner christop...@gmail.com 
 javascript: wrote:

 I seem to be in the minority too many packages camp. I would prefer 
 stable updates of julia version which means that key functionality should 
 be included in core, e.g. BLAS, sparse solvers, eig, eigs, basic plotting 
 and so on and so forth. But at some point there was an idea of having core 
 and Stdlib, which I think is equally acceptable.
 Christoph




[julia-users] Re: Job posting: high performance computing (image analysis and acquisition)

2015-03-06 Thread Milktrader
Are job posting part of a dev mailing list?

On Friday, March 6, 2015 at 1:35:26 PM UTC-5, Tim wrote:

 (Apologies for cross-posting.) 

 We seek candidates with expertise in Julia and/or high-performance 
 computing 
 to develop software for a broad community of users of an imaging facility 
 at 
 Washington University in St. Louis. Challenges include working with big 
 data 
 (multi-terabyte multidimensional images) and the extensive application of 
 machine-learning and numerical algorithms. An ideal candidate would also 
 be 
 comfortable with topics such as developing software interfaces for 
 acquisition 
 hardware, GPU computing, and/or multithreading. Candidates should be 
 prepared 
 to train users of the software, and to interact with them about possible 
 refinements. 

 For more information, please contact Tim Holy (ho...@wustl.edu 
 javascript:). 

 Best, 
 --Tim 



Re: [julia-users] Reviewing a Julia programming book for Packt

2015-01-01 Thread milktrader
I have reviewed the first five chapters and have chapter 6 in hand, which 
I'll be reviewing as well

Dan

On Thursday, January 1, 2015 11:39:11 AM UTC-5, Samuel Colvin wrote:

 I'll email Malcolm and let him know about this. 

 He's active with the meet up group and does seem knowledgeable. 

 I site initially agreed to help review the book then declined when I found 
 how terrible there email+word-doc reviewing workflow was. I subsequently 
 discovered they had sent me chapters before they were ready without telling 
 Malcolm. They then emailed me again on there second spree with the email 
 above. I've also heard bad things about them from other bits of the 
 publishing industry. 

 All seems like a bit of a mess unfortunately. 



[julia-users] Re: Reviewing a Julia programming book for Packt

2014-12-10 Thread milktrader
I've likewise been contacted to review the book and have agreed. 

Dan

On Thursday, December 4, 2014 6:31:13 PM UTC-5, Wilfred Hughes wrote:

 I received an email today about being a technical reviewer for a book on 
 Julia!

 We're currently developing a book titled *Mastering Julia* aiming at 
 building statistical models with linear regressions and analysis of 
 variance (ANOVA) and will be working on probability, probability 
 distributions, and random variables covering  data structures such as 
 matrices, lists, factors, and data frames. This book is targeted at 
 Intermediate 
 level developer in statistical languages and one who will be having 
 understanding of Core elements and applications.

 Would you be interested in acting as reviewer for this book?

 Now, I enjoy Julia, and I'm happy to help promote the language, but I 
 don't think I'm particularly qualified to be a technical reviewer of a book 
 on Julia programming. I found this thread on julia-dev: 
 https://groups.google.com/forum/#!msg/julia-dev/HrdpknFgdfk/SAVMyyacT_sJ 
 where Packt contacted a large number of folks seeking an author.

 Has anyone else received something like this? In principle, I'm all in 
 favour of producing promotional or teaching materials, but I'm surprised it 
 lead to me being contacted.



[julia-users] no method errors from inner constructor

2014-02-04 Thread milktrader
julia immutable Foo{T,N}
   x::Vector{Int}
   y::Array{T,N}
   z::Vector{ASCIIString}

   function Foo(x::Vector{Int}, y::Array{T,N}, z::Vector{ASCIIString})
 new(x,y,z)
   end

   end

julia foo = Foo([1], [2], [bar])
ERROR: no method Foo{T,N}(Array{Int64,1}, Array{Int64,1}, 
Array{ASCIIString,1})

Without the inner constructor, an object is created no problem. 


Re: [julia-users] no method errors from inner constructor

2014-02-04 Thread milktrader
Thanks John, I finally figured it out after hacking around for a couple 
hours. It's not intuitive, that's for sure!

On Tuesday, February 4, 2014 10:57:52 PM UTC-5, John Myles White wrote:

 Yup, this is one of the quirkier things about parametric types. You need 
 to echo the inner constructor as an outer constructor. 

  — John 

 On Feb 4, 2014, at 7:37 PM, milktrader milkt...@gmail.com javascript: 
 wrote: 

  julia immutable Foo{T,N} 
 x::Vector{Int} 
 y::Array{T,N} 
 z::Vector{ASCIIString} 
  
 function Foo(x::Vector{Int}, y::Array{T,N}, 
 z::Vector{ASCIIString}) 
   new(x,y,z) 
 end 
  
 end 
  
  julia foo = Foo([1], [2], [bar]) 
  ERROR: no method Foo{T,N}(Array{Int64,1}, Array{Int64,1}, 
 Array{ASCIIString,1}) 
  
  Without the inner constructor, an object is created no problem. 



Re: [julia-users] no method errors from inner constructor

2014-02-04 Thread milktrader
btw, why don't constraints get handled by an outer constructor in the first 
place?

It makes sense to have inner constructors for unitialized

On Tuesday, February 4, 2014 11:23:51 PM UTC-5, milktrader wrote:

 Thanks John, I finally figured it out after hacking around for a couple 
 hours. It's not intuitive, that's for sure!

 On Tuesday, February 4, 2014 10:57:52 PM UTC-5, John Myles White wrote:

 Yup, this is one of the quirkier things about parametric types. You need 
 to echo the inner constructor as an outer constructor. 

  — John 

 On Feb 4, 2014, at 7:37 PM, milktrader milkt...@gmail.com wrote: 

  julia immutable Foo{T,N} 
 x::Vector{Int} 
 y::Array{T,N} 
 z::Vector{ASCIIString} 
  
 function Foo(x::Vector{Int}, y::Array{T,N}, 
 z::Vector{ASCIIString}) 
   new(x,y,z) 
 end 
  
 end 
  
  julia foo = Foo([1], [2], [bar]) 
  ERROR: no method Foo{T,N}(Array{Int64,1}, Array{Int64,1}, 
 Array{ASCIIString,1}) 
  
  Without the inner constructor, an object is created no problem. 



Re: [julia-users] no method errors from inner constructor

2014-02-04 Thread milktrader
... happy fingers problem ...

it makes sense to have inner constructors for uninitialized *fields*

On Wednesday, February 5, 2014 12:11:10 AM UTC-5, milktrader wrote:

 btw, why don't constraints get handled by an outer constructor in the 
 first place?

 It makes sense to have inner constructors for unitialized

 On Tuesday, February 4, 2014 11:23:51 PM UTC-5, milktrader wrote:

 Thanks John, I finally figured it out after hacking around for a couple 
 hours. It's not intuitive, that's for sure!

 On Tuesday, February 4, 2014 10:57:52 PM UTC-5, John Myles White wrote:

 Yup, this is one of the quirkier things about parametric types. You need 
 to echo the inner constructor as an outer constructor. 

  — John 

 On Feb 4, 2014, at 7:37 PM, milktrader milkt...@gmail.com wrote: 

  julia immutable Foo{T,N} 
 x::Vector{Int} 
 y::Array{T,N} 
 z::Vector{ASCIIString} 
  
 function Foo(x::Vector{Int}, y::Array{T,N}, 
 z::Vector{ASCIIString}) 
   new(x,y,z) 
 end 
  
 end 
  
  julia foo = Foo([1], [2], [bar]) 
  ERROR: no method Foo{T,N}(Array{Int64,1}, Array{Int64,1}, 
 Array{ASCIIString,1}) 
  
  Without the inner constructor, an object is created no problem.