Re: [julia-users] @async weirdness

2015-03-10 Thread Sam Lendle
Baz shows up then.  From OS X:

julia> t = @async (println("foo");println("bar"); println("baz"));
foo

julia> bar
julia> baz
_



On Tue, Mar 10, 2015 at 9:28 PM, Amit Murthy  wrote:

> What about if you don't print t .
>
> t = @async (println("foo");println("bar"); println("baz"));
>
> On Wed, Mar 11, 2015 at 9:31 AM, Sam L  wrote:
>
>> Same thing on arch linux actually:
>>
>>   | | |_| | | | (_| |  |  Version 0.3.7-pre+15 (2015-03-02 23:43 UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Commit 0f0b136 (8 days old release-0.3)
>> |__/   |  x86_64-unknown-linux-gnu
>>
>> julia> t = @async (println("foo");println("bar"); println("baz"))
>> foo
>> Task (queued) @0x03c57080bar
>>
>>
>> julia>
>> _
>>
>>
>>
>> On Tuesday, March 10, 2015 at 8:59:52 PM UTC-7, Sam L wrote:
>>>
>>> I see the behavior on OS X.  It also occurs with three println's.
>>>
>>>   | | |_| | | | (_| |  |  Version 0.3.7-pre+1 (2015-02-17 22:12 UTC)
>>>  _/ |\__'_|_|_|\__'_|  |  Commit d15f183* (21 days old release-0.3)
>>> |__/   |  x86_64-apple-darwin13.4.0
>>>
>>> julia> t = @async (println("foo");println("bar"); println("baz"))
>>> foo
>>> Task (queued) @0x7fa0faf0e520bar
>>>
>>>
>>> julia>
>>> _
>>>
>>> The _ indicates the cursor position after running the line of code. I
>>> hit return only once after the first line starting with 't = @async...',
>>> and I got two blank lines after Task was displayed, before the julia>
>>> prompt, and the cursor ended up in the first column on a new line after the
>>> julia> prompt.
>>>
>>>
>>> On Tuesday, March 10, 2015 at 8:17:30 PM UTC-7, Amit Murthy wrote:

 Works fine on Linux.



 On Tue, Mar 10, 2015 at 11:28 PM, Ben Arthur 
 wrote:

> in my continuing quest to understand Julia tasks, i have created the
> following contrived example which does not behave as i would expect. can
> anyone help explain please? thanks in advance.
>
> julia> function printfoobar()
>  println("foo")
>  println("bar")
>  end
>
> printfoobar (generic function with 1 method)
>
> julia> printfoobar()   # great, it works
> foo
> bar
>
> julia> println("honey"); println("wagon")   # no surprise again
> honey
> wagon
>
> julia> t = @async (println("honey"); println("wagon"))  #  works too,
> modulo 'Task' being inbetween
> honey
> Task (queued) @0x7fb59e832500wagon
>
> julia> t = @async printfoobar()   # ditto:  foo and bar both printed,
> albeit with 'Task' inbetween
> foo
> Task (queued) @0x7fb59f2e1720bar
>
> julia> t = @async (println("honey"); printfoobar(); println("wagon"))
>   # WHERE ARE bar AND wagon ???
> honey
> Task (queued) @0x7fb59f2e1840foo
>
> julia> #   #nope, they still don't appear
>
> julia> # 
>
> julia> # 
>
> julia> wait(t)   # nope, still no further printed output
>
> julia> yield()   # still no joy
>
> julia> istaskdone(t)
> true
>
> is it that println("foo") and println("wagon") never get executed?  or
> that the output stream is just not making it to the REPL?  this is in 
> 0.3.6
> by the way.  similar things happen on a 0 day old master.
>


>


Re: [julia-users] Set of tuples?

2014-09-05 Thread Sam Lendle
Oh right, thanks! I forgot that works. I'd just used that like an hour ago
for strings.


On Fri, Sep 5, 2014 at 5:02 PM, John Myles White 
wrote:

> How do you feel about using Set( [(1, 2)] )?
>
>  — John
>
> On Sep 5, 2014, at 5:01 PM, Sam L  wrote:
>
> > I can't figure out how to make a set of tuples in a very clean way.
> >
> > This works:
> >
> > julia> push!(Set{(Int, Int)}(), (1,2))
> > Set{(Int64,Int64)}({(1,2)})
> >
> > but this doesn't:
> >
> > julia> Set((1,2))
> > Set{Int64}({2,1})
> >
> > because that calls Set{eltype(itr)}(itr).
> >
> > And this doesn't work:
> >
> > julia> Set{(Int, Int)}((1,2))
> > ERROR: `convert` has no method matching convert(::Type{(Int64,Int64)},
> ::Int64)
> >  in setindex! at dict.jl:545
> >  in union! at set.jl:23
> >  in Set at set.jl:5
> >
> > Any suggestions?
>
>


Re: [julia-users] Re: ERROR: no method chomp(Array{Uint8,1})??

2014-03-03 Thread Sam Lendle
That's a relief. I thought I was going nuts. I must have updated packages
on my laptop right before v0.2.11 and right after on my desktop.

Thanks!
Sam


On Mon, Mar 3, 2014 at 8:38 PM, Kevin Squire  wrote:

> This was a recently introduced bug in GZip.jl.  It should be fixed in a
> few minutes.
>
> Kevin
>
>
> On Mon, Mar 3, 2014 at 4:29 PM, Sam L  wrote:
>
>> Hmm thanks for the response. I've also tried rebuilding julia from
>> scratch in a freshly cloned repo and still no luck.
>>
>>
>> On Monday, March 3, 2014 11:03:45 AM UTC-8, Ivar Nesje wrote:
>>>
>>> It looks like the problem is in https://github.com/
>>> JuliaStats/DataFrames.jl/blob/master/src/RDA.jl#L258 where
>>> readline(io::IO) sometimes returns a String and sometims returns a
>>> Array{Uint8}. How would that happen? I can't find any documented return
>>> type for readline.
>>>
>>> Ivar
>>>
>>> kl. 19:29:17 UTC+1 mandag 3. mars 2014 skrev Sam L følgende:

 Hello everyone,

 I updated and rebuilt julia on Ubuntu and this is happening:

 julia> using RDatasets

 julia> dataset("datasets", "iris")
 ERROR: no method chomp(Array{Uint8,1})
  in gzopen at /home/sam/.julia/v0.3/GZip/src/GZip.jl:253
  in read_rda at /home/sam/.julia/v0.3/DataFrames/src/RDA.jl:272
  in dataset at /home/sam/.julia/v0.3/RDatasets/src/dataset.jl:6

 julia> versioninfo()
 Julia Version 0.3.0-prerelease+1824
 Commit d36bb08* (2014-03-03 17:58 UTC)
 Platform Info:
   System: Linux (x86_64-linux-gnu)
   CPU: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
   WORD_SIZE: 64
   BLAS: libmkl_rt
   LAPACK: libmkl_rt
   LIBM: libopenlibm



 I've tried moving ~/.julia and reinstalling packages, and also checking
 out older commits of julia. I'm not having any problems on the same commit
 on a different machine on OS X, so I'm really confused.

 Anyone have any suggestions?

 Thanks!
 Sam

>>>
>