Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread Stefan Karpinski
You should NOT use parse to parse your data. Is that how you're doing it?


On Sat, Jul 12, 2014 at 11:54 PM, Paul Analyst 
wrote:

>  What about "space" ?
> the data:
> a,a,conj+interj+prep:nom+qub
> aa,aa,interj
>
> AA,AA,subst:pl:acc:m3+subst:pl:acc:n2+subst:pl:acc:p1+subst:pl:dat:m3+subst:pl:dat:n2+subst:pl:dat:p1+subst:pl:gen:m3+subst:pl:gen:n2+subst:pl:gen:p1+subst:pl:inst:m3+subst:pl:inst:n2+subst:pl:inst:p1+subst:pl:loc:m3+subst:pl:loc:n2+subst:pl:loc:p1+subst:pl:nom:m3+subst:pl:nom:n2+subst:pl:nom:p1+subst:pl:voc:m3+subst:pl:voc:n2+subst:pl:voc:p1+subst:sg:acc:m3+subst:sg:acc:n2+subst:sg:dat:m3+subst:sg:dat:n2+subst:sg:gen:m3+subst:sg:gen:n2+subst:sg:inst:m3+subst:sg:inst:n2+subst:sg:loc:m3+subst:sg:loc:n2+subst:sg:nom:m3+subst:sg:nom:n2+subst:sg:voc:m3+subst:sg:voc:n2
> aa,*ad acta*,brev:npun
>
> Aachen,Aachen,subst:pl:acc:m3+subst:pl:acc:n2+subst:pl:dat:m3+subst:pl:dat:n2+subst:pl:gen:m3+subst:pl:gen:n2+subst:pl:inst:m3+subst:pl:inst:n2+subst:pl:loc:m3+subst:pl:loc:n2+su
> in line 5 Error
> julia> for i=1:k, j=1:l
>yp[i,j]=parse(y[i,j]; raise=true)
>println(i)
>end
> 1
> 1
> 2
> 2
> 3
> 3
> 4
> ERROR: ParseError("extra token \"acta\" after end of expression")
>  in parse at string.jl:1221
>  in parse at string.jl:1234
> Paul
>
>
>
> W dniu 2014-07-12 21:08, Stefan Karpinski pisze:
>
> Yes, parse(str; raise=true) is the kind of thing I mean. How does Inf get
> turned into a floating-point value if you're not doing any parsing? If you
> just read the input as strings using readlines then Inf will just be a
> string like all the other data.
>
>
> On Sat, Jul 12, 2014 at 11:58 AM, programista wpf <
> programista...@gmail.com> wrote:
>
>>  no prasing,
>> for what is parsing  ? Like : parse(str; raise=true) ?
>> Paul ?
>> W dniu 2014-07-12 19:59, Stefan Karpinski pisze:
>>
>> You probably shouldn't be parsing these the way you're parsing them. Are
>> you using parse?
>>
>>
>> On Sat, Jul 12, 2014 at 9:56 AM,  wrote:
>>
>>> Not,
>>> i found this:
>>> it was row with "inf"
>>>
>>> inerwacjom
>>> *Inf*
>>> infam
>>> infama
>>>
>>> how to defend against such cases? I have a dynamic dictionaries from
>>> the network.
>>> Paul
>>>
>>>
>>> W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan Karpinski
>>> napisał:

  The problem here seems to be that you're comparing types of values
 that are incomparable like a float and a string.


 On Sat, Jul 12, 2014 at 7:17 AM, paul analyst 
 wrote:

>  I have a very long vector (5*10^6 ) with the words in a
> foreign language. I can not sort
> julia> sort (y1u)
> ERROR: no method isless (Float64, substring {UTF8String})
>   in the sort! at sort.jl: 233
>   in the sort! at sort.jl: 277
>   in next at string.jl: 630
> Probably there is a word reserved for Julia. How to find them? Where
> is the list of such words?
> Paul
>


>>
>>
>
>


Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread Paul Analyst

What about "space" ?
the data:
a,a,conj+interj+prep:nom+qub
aa,aa,interj
AA,AA,subst:pl:acc:m3+subst:pl:acc:n2+subst:pl:acc:p1+subst:pl:dat:m3+subst:pl:dat:n2+subst:pl:dat:p1+subst:pl:gen:m3+subst:pl:gen:n2+subst:pl:gen:p1+subst:pl:inst:m3+subst:pl:inst:n2+subst:pl:inst:p1+subst:pl:loc:m3+subst:pl:loc:n2+subst:pl:loc:p1+subst:pl:nom:m3+subst:pl:nom:n2+subst:pl:nom:p1+subst:pl:voc:m3+subst:pl:voc:n2+subst:pl:voc:p1+subst:sg:acc:m3+subst:sg:acc:n2+subst:sg:dat:m3+subst:sg:dat:n2+subst:sg:gen:m3+subst:sg:gen:n2+subst:sg:inst:m3+subst:sg:inst:n2+subst:sg:loc:m3+subst:sg:loc:n2+subst:sg:nom:m3+subst:sg:nom:n2+subst:sg:voc:m3+subst:sg:voc:n2
aa,*ad acta*,brev:npun
Aachen,Aachen,subst:pl:acc:m3+subst:pl:acc:n2+subst:pl:dat:m3+subst:pl:dat:n2+subst:pl:gen:m3+subst:pl:gen:n2+subst:pl:inst:m3+subst:pl:inst:n2+subst:pl:loc:m3+subst:pl:loc:n2+su
in line 5 Error
julia> for i=1:k, j=1:l
   yp[i,j]=parse(y[i,j]; raise=true)
   println(i)
   end
1
1
2
2
3
3
4
ERROR: ParseError("extra token \"acta\" after end of expression")
 in parse at string.jl:1221
 in parse at string.jl:1234
Paul



W dniu 2014-07-12 21:08, Stefan Karpinski pisze:
Yes, parse(str; raise=true) is the kind of thing I mean. How does Inf 
get turned into a floating-point value if you're not doing any 
parsing? If you just read the input as strings using readlines then 
Inf will just be a string like all the other data.



On Sat, Jul 12, 2014 at 11:58 AM, programista wpf 
mailto:programista...@gmail.com>> wrote:


no prasing,
for what is parsing  ? Like : parse(str; raise=true) ?
Paul ?
W dniu 2014-07-12 19:59, Stefan Karpinski pisze:

You probably shouldn't be parsing these the way you're parsing
them. Are you using parse?


On Sat, Jul 12, 2014 at 9:56 AM, mailto:programista...@gmail.com>> wrote:

Not,
i found this:
it was row with "inf"

inerwacjom
*Inf*
infam
infama

how to defend against such cases? I have a dynamic
dictionaries from the network.
Paul


W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan
Karpinski napisał:

The problem here seems to be that you're comparing types
of values that are incomparable like a float and a string.


On Sat, Jul 12, 2014 at 7:17 AM, paul analyst
 wrote:

I have a very long vector (5*10^6 ) with the words in
a foreign language. I can not sort
julia> sort (y1u)
ERROR: no method isless (Float64, substring
{UTF8String})
in the sort! at sort.jl: 233
in the sort! at sort.jl: 277
in next at string.jl: 630
Probably there is a word reserved for Julia. How to
find them? Where is the list of such words?
Paul










Re: [julia-users] essay on the history of programming languages

2014-07-12 Thread Tobias Knopp
Indeed, this has been a great read. Thanks for sharing Stefan.

Tobi

Am Sonntag, 13. Juli 2014 08:02:19 UTC+2 schrieb John Myles White:
>
> I loved this two-part essay. Highly recommend it to anyone who hasn’t read 
> it.
>
>  — John
>
> On Jul 12, 2014, at 7:55 PM, Stefan Karpinski  > wrote:
>
> Graydon Hoare (original author of Rust) wrote a truly lovely essay in two 
> parts about the history of programming languages, the predominance of 
> two-language systems – or "Ousterhout-dichotomy languages," as he puts it – 
> Lisp's historical defiance of this dichotomy, Dylan as a successor to Lisp, 
> and finally Julia as a modern successor to Lisp and Dylan:
>
> http://graydon2.dreamwidth.org/3186.html
> http://graydon2.dreamwidth.org/189377.html
>
>
> This is a great read and an edifying historical perspective, regardless of 
> the Julia bit at the end, but may be especially interesting to folks on 
> julia-users.
>
>
>

Re: [julia-users] essay on the history of programming languages

2014-07-12 Thread John Myles White
I loved this two-part essay. Highly recommend it to anyone who hasn’t read it.

 — John

On Jul 12, 2014, at 7:55 PM, Stefan Karpinski  wrote:

> Graydon Hoare (original author of Rust) wrote a truly lovely essay in two 
> parts about the history of programming languages, the predominance of 
> two-language systems – or "Ousterhout-dichotomy languages," as he puts it – 
> Lisp's historical defiance of this dichotomy, Dylan as a successor to Lisp, 
> and finally Julia as a modern successor to Lisp and Dylan:
> 
> http://graydon2.dreamwidth.org/3186.html
> http://graydon2.dreamwidth.org/189377.html
> 
> This is a great read and an edifying historical perspective, regardless of 
> the Julia bit at the end, but may be especially interesting to folks on 
> julia-users.



[julia-users] essay on the history of programming languages

2014-07-12 Thread Stefan Karpinski
Graydon Hoare (original author of Rust) wrote a truly lovely essay in two
parts about the history of programming languages, the predominance of
two-language systems – or "Ousterhout-dichotomy languages," as he puts it –
Lisp's historical defiance of this dichotomy, Dylan as a successor to Lisp,
and finally Julia as a modern successor to Lisp and Dylan:

http://graydon2.dreamwidth.org/3186.html
http://graydon2.dreamwidth.org/189377.html


This is a great read and an edifying historical perspective, regardless of
the Julia bit at the end, but may be especially interesting to folks on
julia-users.


Re: [julia-users] Canonical way of reading STDIN

2014-07-12 Thread Stefan Karpinski
Looks reasonable to me too. One very minimal stylistic point is that I
would write

for line in eachline(STDIN)
print("Found: $line")
end


instead of using the = form of the for loop, which I really only use when
the thing that's being iterated over is an immediate range object.


On Sat, Jul 12, 2014 at 4:57 PM, Leah Hanson  wrote:

> Those look pretty reasonable to me. :)
>
> Thanks for contributing to the documentation.
>
> -- Leah
>
>
> On Sat, Jul 12, 2014 at 11:21 AM, Matthew Wood  wrote:
>
>> I didn't find any examples in the docs for processing STDIN for more than
>> one read. I'm happy to contribute an example, but I wanted to make sure I
>> knew the best way.
>>
>> Reading lines from STDIN:
>>
>> for line = eachline(STDIN)
>> print("Found: $line")
>> end
>>
>> Reading Chars:
>>
>> while !eof(STDIN)
>> x = read(STDIN, Char)
>> println("Found: $x")
>> end
>>
>> Does that look pretty reasonable?
>>
>> Thanks.
>> Matt Wood
>>
>
>


Re: [julia-users] Canonical way of reading STDIN

2014-07-12 Thread Leah Hanson
Those look pretty reasonable to me. :)

Thanks for contributing to the documentation.

-- Leah


On Sat, Jul 12, 2014 at 11:21 AM, Matthew Wood  wrote:

> I didn't find any examples in the docs for processing STDIN for more than
> one read. I'm happy to contribute an example, but I wanted to make sure I
> knew the best way.
>
> Reading lines from STDIN:
>
> for line = eachline(STDIN)
> print("Found: $line")
> end
>
> Reading Chars:
>
> while !eof(STDIN)
> x = read(STDIN, Char)
> println("Found: $x")
> end
>
> Does that look pretty reasonable?
>
> Thanks.
> Matt Wood
>


Re: [julia-users] how use find ?

2014-07-12 Thread Stefan Karpinski
You can easily make an Array{Int32}. I'm not sure if that's your point or
not.


On Sat, Jul 12, 2014 at 1:51 PM, J Luis  wrote:

> yes, but those are scalars not (potentially big) arrays.
>
> Sábado, 12 de Julho de 2014 21:33:17 UTC+1, Stefan Karpinski escreveu:
>>
>> On 32-bit systems, Int is Int32. 64-bit systems tend to have enough
>> memory, not to mention the fact that pointers, indices, etc. are natively
>> 64-bit on those systems.
>>
>>
>> On Sat, Jul 12, 2014 at 1:21 PM, J Luis  wrote:
>>
>>>
>>>
>>> Sábado, 12 de Julho de 2014 21:16:04 UTC+1, John Myles White escreveu:
>>>
 On Jul 12, 2014, at 1:04 PM, J Luis  wrote:

 > That is also true but a much more rare case, typemax(Int32) is still
 a quite high number for an array size and before an Int64 is needed changes
 are non negligible that a memory requested failed because a big contigous
 chunk of memory was not available. Well, this is my Matlab experience,
 which I would like not have repeated in Julia.

 Have you hit a problem with this in Julia in practice or is it a mostly
 hypothetical concern? I’ve worked with arrays that contain billions of
 entries a bunch of times and haven’t had any problems on a machine with
 sufficient RAM to cope with that kind of workload.

>>>
>>> Regarding the Julia world is only, as you say, an hypothetical concern
>>> ... but based on previous experience. The "sufficient RAM" is the keyword.
>>> With 32 bits less RAM (e.g. as in laptops) may have been the "sufficient".
>>>
>>> Joaquim
>>>
>>
>>


Re: [julia-users] how use find ?

2014-07-12 Thread J Luis
yes, but those are scalars not (potentially big) arrays.

Sábado, 12 de Julho de 2014 21:33:17 UTC+1, Stefan Karpinski escreveu:
>
> On 32-bit systems, Int is Int32. 64-bit systems tend to have enough 
> memory, not to mention the fact that pointers, indices, etc. are natively 
> 64-bit on those systems.
>
>
> On Sat, Jul 12, 2014 at 1:21 PM, J Luis > 
> wrote:
>
>>
>>
>> Sábado, 12 de Julho de 2014 21:16:04 UTC+1, John Myles White escreveu:
>>
>>> On Jul 12, 2014, at 1:04 PM, J Luis  wrote: 
>>>
>>> > That is also true but a much more rare case, typemax(Int32) is still a 
>>> quite high number for an array size and before an Int64 is needed changes 
>>> are non negligible that a memory requested failed because a big contigous 
>>> chunk of memory was not available. Well, this is my Matlab experience, 
>>> which I would like not have repeated in Julia. 
>>>
>>> Have you hit a problem with this in Julia in practice or is it a mostly 
>>> hypothetical concern? I’ve worked with arrays that contain billions of 
>>> entries a bunch of times and haven’t had any problems on a machine with 
>>> sufficient RAM to cope with that kind of workload. 
>>>
>>  
>> Regarding the Julia world is only, as you say, an hypothetical concern 
>> ... but based on previous experience. The "sufficient RAM" is the keyword. 
>> With 32 bits less RAM (e.g. as in laptops) may have been the "sufficient".
>>
>> Joaquim
>>
>
>

Re: [julia-users] how use find ?

2014-07-12 Thread Stefan Karpinski
On 32-bit systems, Int is Int32. 64-bit systems tend to have enough memory,
not to mention the fact that pointers, indices, etc. are natively 64-bit on
those systems.


On Sat, Jul 12, 2014 at 1:21 PM, J Luis  wrote:

>
>
> Sábado, 12 de Julho de 2014 21:16:04 UTC+1, John Myles White escreveu:
>
>> On Jul 12, 2014, at 1:04 PM, J Luis  wrote:
>>
>> > That is also true but a much more rare case, typemax(Int32) is still a
>> quite high number for an array size and before an Int64 is needed changes
>> are non negligible that a memory requested failed because a big contigous
>> chunk of memory was not available. Well, this is my Matlab experience,
>> which I would like not have repeated in Julia.
>>
>> Have you hit a problem with this in Julia in practice or is it a mostly
>> hypothetical concern? I’ve worked with arrays that contain billions of
>> entries a bunch of times and haven’t had any problems on a machine with
>> sufficient RAM to cope with that kind of workload.
>>
>
> Regarding the Julia world is only, as you say, an hypothetical concern ...
> but based on previous experience. The "sufficient RAM" is the keyword. With
> 32 bits less RAM (e.g. as in laptops) may have been the "sufficient".
>
> Joaquim
>


Re: [julia-users] how use find ?

2014-07-12 Thread J Luis


Sábado, 12 de Julho de 2014 21:16:04 UTC+1, John Myles White escreveu:
>
> On Jul 12, 2014, at 1:04 PM, J Luis > 
> wrote: 
>
> > That is also true but a much more rare case, typemax(Int32) is still a 
> quite high number for an array size and before an Int64 is needed changes 
> are non negligible that a memory requested failed because a big contigous 
> chunk of memory was not available. Well, this is my Matlab experience, 
> which I would like not have repeated in Julia. 
>
> Have you hit a problem with this in Julia in practice or is it a mostly 
> hypothetical concern? I’ve worked with arrays that contain billions of 
> entries a bunch of times and haven’t had any problems on a machine with 
> sufficient RAM to cope with that kind of workload. 
>
 
Regarding the Julia world is only, as you say, an hypothetical concern ... 
but based on previous experience. The "sufficient RAM" is the keyword. With 
32 bits less RAM (e.g. as in laptops) may have been the "sufficient".

Joaquim


Re: [julia-users] how use find ?

2014-07-12 Thread John Myles White
On Jul 12, 2014, at 1:04 PM, J Luis  wrote:

> That is also true but a much more rare case, typemax(Int32) is still a quite 
> high number for an array size and before an Int64 is needed changes are non 
> negligible that a memory requested failed because a big contigous chunk of 
> memory was not available. Well, this is my Matlab experience, which I would 
> like not have repeated in Julia.

Have you hit a problem with this in Julia in practice or is it a mostly 
hypothetical concern? I’ve worked with arrays that contain billions of entries 
a bunch of times and haven’t had any problems on a machine with sufficient RAM 
to cope with that kind of workload.

 — John



Re: [julia-users] how use find ?

2014-07-12 Thread J Luis


I’m really confused. Do you want the indices to be 32-bit integers instead 
> of 64-bit integers? 
>

Yes.
 

> Isn’t that equivalent to asking for your code to be broken anytime your 
> vector has more than typemax(Int32) elements?
>

That is also true but a much more rare case, typemax(Int32) is still a 
quite high number for an array size and before an Int64 is needed changes 
are non negligible that a memory requested failed because a big contigous 
chunk of memory was not available. Well, this is my Matlab experience, 
which I would like not have repeated in Julia.

 

>
>  — John
>
> On Jul 12, 2014, at 12:43 PM, J Luis > 
> wrote:
>
>
> julia> find(x->x>5,a)
>> 5-element Array{Int64,1}:
>>   1
>>   2
>>   7
>>   8
>>  10
>>
>
> which very very sadly are Int64. When dealing with large matrices this may 
> lead to a large memory waste. These almost mandatory 64 bits issue is one 
> the things that annoyed me more in Matlab for many times it was the 
> difference between having something work ... or not
>
>
>

Re: [julia-users] Julia non-negative least squares nnls is 100x slower than R nnls

2014-07-12 Thread Sam L
Base Julia does not have an implementation of NNLS, but there is a version 
in Optim.jl . Is that what you are 
using? I assume so, because that one was the easiest one for me to find.

The issue with the documentation is that there is currently no standard way 
of adding documentation for packages to the in REPL doc system. Optim.nnls 
is documented on the package's github page.

As you say, R and Julia use different algorithms for nnls.  R's is the Lawson 
Hanson  
algorithm which is tailored for the nnls problem. From what I can tell, 
they're using the version from netlib 
, possibly with a few changes.  
The version in Optim.jl applies a more general box constrained minimization 
algorithm.  Optim.nnls was also printing a lot of deprecation warnings, 
which really slowed things down. I just fixed that. Pkg.checkout("Optim") 
should give you the fixed version.

Some timings: 

R:
> system.time(for (i in 1:100) {nnls(A, y)})
   user  system elapsed 
  1.036   0.017   1.054 

julia Optim.nnls:
julia> function test() for i in 1:100; Optim.nnls(A,y) end end
test (generic function with 1 method)

julia> test(); @time test()
elapsed time: 12.383192097 seconds (2330486480 bytes allocated, 13.29% gc 
time)

So after fixing the deprecation warning julia is only about 12x slower. 
It's possible that the difference could be explained by the different 
choice of algorithms, but I'm not sure.

It would be interesting to see how an optimized implementation of Lawson 
Hanson (or one of the variants on the wikipedia page) does. (I tried to 
implement the algorithm in psuedo code form Wikipeida, but I do not think 
it is correct.  I've Lawson Hanson psuedocode in a textbook somewhere, but 
I don't recall where.)


On Friday, July 11, 2014 11:31:30 AM UTC-7, Kevin Squire wrote:
>
> It would also be useful to know how you are timing your code. 
>
> Cheers,
>   Kevin 
>
> On Friday, July 11, 2014, Keith Campbell > 
> wrote:
>
>> Implementation details can make a very big difference in the performance 
>> of Julia code.  You can see some considerations at 
>> http://docs.julialang.org/en/latest/manual/performance-tips/.  
>>
>> Also, if you post your test code, perhaps as a Gist, that will make it 
>> easier for folks to provide useful feedback.
>> cheers,
>> Keith
>>
>> On Friday, July 11, 2014 12:28:15 PM UTC-4, David C Cohen wrote:
>>>
>>> Hi,
>>>
>>> I understand that Julia and R nnls do not use the same algorithm. A 
>>> 400x300 problem on my machine takes about 0.02 s on R nnls, and about 2 s 
>>> on Julia nnls.
>>>
>>> The documentations on nnls is rather poor:
>>>
>>> ?nnls
>>>
>>> nnls (generic function with 2 methods)
>>>
>>>
>>> Am I missing something here, or is this implementation is meant to be slow?
>>>
>>>  

Re: [julia-users] how use find ?

2014-07-12 Thread John Myles White
I’m really confused. Do you want the indices to be 32-bit integers instead of 
64-bit integers? Isn’t that equivalent to asking for your code to be broken 
anytime your vector has more than typemax(Int32) elements?

 — John

On Jul 12, 2014, at 12:43 PM, J Luis  wrote:

> 
> julia> find(x->x>5,a)
> 5-element Array{Int64,1}:
>   1
>   2
>   7
>   8
>  10
> 
> which very very sadly are Int64. When dealing with large matrices this may 
> lead to a large memory waste. These almost mandatory 64 bits issue is one the 
> things that annoyed me more in Matlab for many times it was the difference 
> between having something work ... or not



Re: [julia-users] how use find ?

2014-07-12 Thread J Luis


> julia> find(x->x>5,a)
> 5-element Array{Int64,1}:
>   1
>   2
>   7
>   8
>  10
>

which very very sadly are Int64. When dealing with large matrices this may 
lead to a large memory waste. These almost mandatory 64 bits issue is one 
the things that annoyed me more in Matlab for many times it was the 
difference between having something work ... or not


Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread Stefan Karpinski
Yes, parse(str; raise=true) is the kind of thing I mean. How does Inf get
turned into a floating-point value if you're not doing any parsing? If you
just read the input as strings using readlines then Inf will just be a
string like all the other data.


On Sat, Jul 12, 2014 at 11:58 AM, programista wpf 
wrote:

>  no prasing,
> for what is parsing  ? Like : parse(str; raise=true) ?
> Paul ?
> W dniu 2014-07-12 19:59, Stefan Karpinski pisze:
>
> You probably shouldn't be parsing these the way you're parsing them. Are
> you using parse?
>
>
> On Sat, Jul 12, 2014 at 9:56 AM,  wrote:
>
>> Not,
>> i found this:
>> it was row with "inf"
>>
>> inerwacjom
>> *Inf*
>> infam
>> infama
>>
>> how to defend against such cases? I have a dynamic dictionaries from the
>> network.
>> Paul
>>
>>
>> W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan Karpinski
>> napisał:
>>>
>>>  The problem here seems to be that you're comparing types of values
>>> that are incomparable like a float and a string.
>>>
>>>
>>> On Sat, Jul 12, 2014 at 7:17 AM, paul analyst 
>>> wrote:
>>>
  I have a very long vector (5*10^6 ) with the words in a
 foreign language. I can not sort
 julia> sort (y1u)
 ERROR: no method isless (Float64, substring {UTF8String})
   in the sort! at sort.jl: 233
   in the sort! at sort.jl: 277
   in next at string.jl: 630
 Probably there is a word reserved for Julia. How to find them? Where
 is the list of such words?
 Paul

>>>
>>>
>
>


Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread programista wpf

no prasing,
for what is parsing  ? Like : parse(str; raise=true) ?
Paul ?
W dniu 2014-07-12 19:59, Stefan Karpinski pisze:
You probably shouldn't be parsing these the way you're parsing them. 
Are you using parse?



On Sat, Jul 12, 2014 at 9:56 AM, > wrote:


Not,
i found this:
it was row with "inf"

inerwacjom
*Inf*
infam
infama

how to defend against such cases? I have a dynamic dictionaries
from the network.
Paul


W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan
Karpinski napisał:

The problem here seems to be that you're comparing types of
values that are incomparable like a float and a string.


On Sat, Jul 12, 2014 at 7:17 AM, paul analyst
 wrote:

I have a very long vector (5*10^6 ) with the words in a
foreign language. I can not sort
julia> sort (y1u)
ERROR: no method isless (Float64, substring {UTF8String})
in the sort! at sort.jl: 233
in the sort! at sort.jl: 277
in next at string.jl: 630
Probably there is a word reserved for Julia. How to find
them? Where is the list of such words?
Paul







Re: [julia-users] how use find ?

2014-07-12 Thread Leah Hanson
The problem is that `a .> 5` is a BitArray, not a function.

~~~
julia> a = rand(10) * 10
10-element Array{Float64,1}:
 5.5408
 5.52724
 2.87541
 1.59491
 0.278013
 1.56604
 8.29388
 8.27159
 0.737642
 7.40957

julia> find(x->x>5,a)
5-element Array{Int64,1}:
  1
  2
  7
  8
 10
~~~

When you call `find(a .> 5)`, you're using a different method of find:
~~~
julia> help(find)
Base.find(A)

   Return a vector of the linear indexes of the non-zeros in "A"
   (determined by "A[i]!=0").  A common use of this is to convert a
   boolean array to an array of indexes of the "true" elements.
~~~

-- Leah



On Sat, Jul 12, 2014 at 12:00 PM,  wrote:

> Big thx.
> In documentation is :
> find(f, A)
> Return a vector of the linear indexes of A where f returns true.
> (function, OBJECT)
> What You think, s it error in documention ?
> Paul
>
>
> W dniu sobota, 12 lipca 2014 17:52:05 UTC+2 użytkownik Cameron McBride
> napisał:
>>
>> julia> find( a .> 5 )
>>
>> cheers,
>>
>> Cameron
>>
>>
>> On Sat, Jul 12, 2014 at 11:40 AM, paul analyst 
>> wrote:
>>
>>> I need all indexes where a[:] >5
>>>
>>> julia> a=rand(10)*10
>>> 10-element Array{Float64,1}:
>>>  4.84005
>>>  8.29994
>>>  8.8531
>>>  3.42319
>>>  2.60318
>>>  7.25313
>>>  0.816263
>>>  4.44463
>>>  6.71836
>>>  4.65337
>>>
>>> julia> a.>5
>>> 10-element BitArray{1}:
>>>  false
>>>   true
>>>   true
>>>  false
>>>  false
>>>   true
>>>  false
>>>  false
>>>   true
>>>  false
>>>
>>> julia> find(a.>5,a)
>>> ERROR: no method find(BitArray{1}, Array{Float64,1})
>>>
>>> julia> find([a.>5],a)
>>> ERROR: no method find(BitArray{1}, Array{Float64,1})
>>>
>>> julia>
>>>
>>>
>>


Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread Stefan Karpinski
You probably shouldn't be parsing these the way you're parsing them. Are
you using parse?


On Sat, Jul 12, 2014 at 9:56 AM,  wrote:

> Not,
> i found this:
> it was row with "inf"
>
> inerwacjom
> *Inf*
> infam
> infama
>
> how to defend against such cases? I have a dynamic dictionaries from the
> network.
> Paul
>
>
> W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan Karpinski
> napisał:
>>
>> The problem here seems to be that you're comparing types of values that
>> are incomparable like a float and a string.
>>
>>
>> On Sat, Jul 12, 2014 at 7:17 AM, paul analyst  wrote:
>>
>>>  I have a very long vector (5*10^6 ) with the words in a foreign
>>> language. I can not sort
>>> julia> sort (y1u)
>>> ERROR: no method isless (Float64, substring {UTF8String})
>>>   in the sort! at sort.jl: 233
>>>   in the sort! at sort.jl: 277
>>>   in next at string.jl: 630
>>> Probably there is a word reserved for Julia. How to find them? Where is
>>> the list of such words?
>>> Paul
>>>
>>
>>


[julia-users] Re: Macros: noob mistakes or julia bugs?

2014-07-12 Thread Abraham Egnor
Here's what I've ended up with:
https://gist.github.com/abe-egnor/5886315f61b5d9ae5ba5  It provides nice
enum-type semantics: method dispatch and a convenience ALL constant for
iterating over the values.

It seems that doing eval() to build up module state is a bit more reliable
at the moment than trying to build the entire AST of the desired result in
one go.
On Sat Jul 12 2014 at 12:13:47 PM, Abraham Egnor 
wrote:

> Addendum the second - the version I'm using is:
>
> Version 0.3.0-prerelease+3921 (2014-06-28 02:01 UTC)
> Commit 0b46af5* (14 days old master)
> x86_64-linux-gnu
>
>
> On Sat Jul 12 2014 at 10:21:10 AM, Abraham Egnor 
> wrote:
>
>> Mistake copy-pasting to the gist: the final line should read
>>
>> eval(enum_f(:Rotation, :CW, :CCW))
>>
>> On Sat Jul 12 2014 at 10:19:21 AM, Abraham Egnor 
>> wrote:
>>
>>> Gist is here: https://gist.github.com/abe-egnor/7b1fadfe2197512ab91b
>>>
>>> I'm very unexperienced with macros, so I can't tell if I'm doing things
>>> wrong or bumping into bugs.  When attempting to make a simple macro to
>>> capture a particular pattern for implementing an enum type, I ran into
>>> multiple issues:
>>>
>>> A - it looks like, when quoting a baremodule with a spliced name, the
>>> module parsing binds to the $ as the name of the module, and you're left
>>> with a raw variable name in the module body.
>>> B - I couldn't find a way to directly splice in an expression list
>>> C - macro expansion is barfing ("malformed module expression") on exprs
>>> that work just fine when eval()'d.
>>>
>>> Would much appreciate guidance on whether I should update my code or
>>> file bugs :)
>>>
>>


Re: [julia-users] how use find ?

2014-07-12 Thread programistawpf
Big thx. 
In documentation is :
find(f, A)
Return a vector of the linear indexes of A where f returns true.
(function, OBJECT) 
What You think, s it error in documention ?
Paul


W dniu sobota, 12 lipca 2014 17:52:05 UTC+2 użytkownik Cameron McBride 
napisał:
>
> julia> find( a .> 5 )
>
> cheers, 
>
> Cameron
>
>
> On Sat, Jul 12, 2014 at 11:40 AM, paul analyst  > wrote:
>
>> I need all indexes where a[:] >5 
>>
>> julia> a=rand(10)*10
>> 10-element Array{Float64,1}:
>>  4.84005
>>  8.29994
>>  8.8531
>>  3.42319
>>  2.60318
>>  7.25313
>>  0.816263
>>  4.44463
>>  6.71836
>>  4.65337
>>
>> julia> a.>5
>> 10-element BitArray{1}:
>>  false
>>   true
>>   true
>>  false
>>  false
>>   true
>>  false
>>  false
>>   true
>>  false
>>
>> julia> find(a.>5,a)
>> ERROR: no method find(BitArray{1}, Array{Float64,1})
>>
>> julia> find([a.>5],a)
>> ERROR: no method find(BitArray{1}, Array{Float64,1})
>>
>> julia>
>>
>>
>

Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread programistawpf
Not, 
i found this:
it was row with "inf"

inerwacjom
*Inf*
infam
infama

how to defend against such cases? I have a dynamic dictionaries from the 
network.
Paul


W dniu sobota, 12 lipca 2014 18:14:39 UTC+2 użytkownik Stefan Karpinski 
napisał:
>
> The problem here seems to be that you're comparing types of values that 
> are incomparable like a float and a string.
>
>
> On Sat, Jul 12, 2014 at 7:17 AM, paul analyst  > wrote:
>
>>  I have a very long vector (5*10^6 ) with the words in a foreign 
>> language. I can not sort 
>> julia> sort (y1u) 
>> ERROR: no method isless (Float64, substring {UTF8String}) 
>>   in the sort! at sort.jl: 233 
>>   in the sort! at sort.jl: 277 
>>   in next at string.jl: 630 
>> Probably there is a word reserved for Julia. How to find them? Where is 
>> the list of such words?
>> Paul
>>
>
>

Re: [julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread Stefan Karpinski
Teaching on a general page about applications of Julia makes sense to me.


On Sat, Jul 12, 2014 at 9:37 AM, John Myles White 
wrote:

> Maybe we should have Learning and Teaching separately? Or maybe Teaching
> should be under a section about people using Julia?
>
>  — John
>
> On Jul 12, 2014, at 9:35 AM, Stefan Karpinski 
> wrote:
>
> Well, originally, it was actually teaching in the sense of places where
> people have used Julia in teaching courses. Now it seems to be a mix of
> resources for people to learn Julia and resources / examples to teach with
> Julia.
>
>
> On Sat, Jul 12, 2014 at 9:29 AM, David P. Sanders 
> wrote:
>
>> Many thanks to all for your kind comments about the tutorial!
>>
>> I'm wondering if the "Teaching" link should be renamed to "Learning"?
>>
>
>
>


Re: [julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread John Myles White
Maybe we should have Learning and Teaching separately? Or maybe Teaching should 
be under a section about people using Julia?

 — John

On Jul 12, 2014, at 9:35 AM, Stefan Karpinski  wrote:

> Well, originally, it was actually teaching in the sense of places where 
> people have used Julia in teaching courses. Now it seems to be a mix of 
> resources for people to learn Julia and resources / examples to teach with 
> Julia.
> 
> 
> On Sat, Jul 12, 2014 at 9:29 AM, David P. Sanders  wrote:
> Many thanks to all for your kind comments about the tutorial!
> 
> I'm wondering if the "Teaching" link should be renamed to "Learning"?
> 



Re: [julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread Stefan Karpinski
Well, originally, it was actually teaching in the sense of places where
people have used Julia in teaching courses. Now it seems to be a mix of
resources for people to learn Julia and resources / examples to teach with
Julia.


On Sat, Jul 12, 2014 at 9:29 AM, David P. Sanders 
wrote:

> Many thanks to all for your kind comments about the tutorial!
>
> I'm wondering if the "Teaching" link should be renamed to "Learning"?
>


[julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread David P. Sanders
Many thanks to all for your kind comments about the tutorial!

I'm wondering if the "Teaching" link should be renamed to "Learning"?


[julia-users] Canonical way of reading STDIN

2014-07-12 Thread Matthew Wood
I didn't find any examples in the docs for processing STDIN for more than 
one read. I'm happy to contribute an example, but I wanted to make sure I 
knew the best way.

Reading lines from STDIN:

for line = eachline(STDIN)
print("Found: $line")
end

Reading Chars:

while !eof(STDIN)
x = read(STDIN, Char)
println("Found: $x")
end

Does that look pretty reasonable?

Thanks.
Matt Wood


Re: [julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread Stefan Karpinski
The problem here seems to be that you're comparing types of values that are
incomparable like a float and a string.


On Sat, Jul 12, 2014 at 7:17 AM, paul analyst  wrote:

>  I have a very long vector (5*10^6 ) with the words in a foreign language. I
> can not sort
> julia> sort (y1u)
> ERROR: no method isless (Float64, substring {UTF8String})
>   in the sort! at sort.jl: 233
>   in the sort! at sort.jl: 277
>   in next at string.jl: 630
> Probably there is a word reserved for Julia. How to find them? Where is
> the list of such words?
> Paul
>


Re: [julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread Viral Shah
Yes that probably needs to be grouped together.

-viral
On 12 Jul 2014 09:11, "Stefan Karpinski"  wrote:

> That's already on there if you scroll down to "Tutorials". This could be a
> bit better organized though since it seems odd that video tutorials and
> tutorials are in different places.
>
>
> On Sat, Jul 12, 2014 at 1:17 AM, cdm  wrote:
>
>>
>> another potential add:
>>
>> http://forio.com/labs/julia-studio/tutorials/
>>
>>
>> enjoy !!!
>>
>> cdm
>>
>
>


[julia-users] Re: Macros: noob mistakes or julia bugs?

2014-07-12 Thread Abraham Egnor
Addendum the second - the version I'm using is:

Version 0.3.0-prerelease+3921 (2014-06-28 02:01 UTC)
Commit 0b46af5* (14 days old master)
x86_64-linux-gnu


On Sat Jul 12 2014 at 10:21:10 AM, Abraham Egnor 
wrote:

> Mistake copy-pasting to the gist: the final line should read
>
> eval(enum_f(:Rotation, :CW, :CCW))
>
> On Sat Jul 12 2014 at 10:19:21 AM, Abraham Egnor 
> wrote:
>
>> Gist is here: https://gist.github.com/abe-egnor/7b1fadfe2197512ab91b
>>
>> I'm very unexperienced with macros, so I can't tell if I'm doing things
>> wrong or bumping into bugs.  When attempting to make a simple macro to
>> capture a particular pattern for implementing an enum type, I ran into
>> multiple issues:
>>
>> A - it looks like, when quoting a baremodule with a spliced name, the
>> module parsing binds to the $ as the name of the module, and you're left
>> with a raw variable name in the module body.
>> B - I couldn't find a way to directly splice in an expression list
>> C - macro expansion is barfing ("malformed module expression") on exprs
>> that work just fine when eval()'d.
>>
>> Would much appreciate guidance on whether I should update my code or file
>> bugs :)
>>
>


Re: [julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread Stefan Karpinski
That's already on there if you scroll down to "Tutorials". This could be a
bit better organized though since it seems odd that video tutorials and
tutorials are in different places.


On Sat, Jul 12, 2014 at 1:17 AM, cdm  wrote:

>
> another potential add:
>
> http://forio.com/labs/julia-studio/tutorials/
>
>
> enjoy !!!
>
> cdm
>


Re: [julia-users] how use find ?

2014-07-12 Thread Cameron McBride
julia> find( a .> 5 )

cheers,

Cameron


On Sat, Jul 12, 2014 at 11:40 AM, paul analyst 
wrote:

> I need all indexes where a[:] >5
>
> julia> a=rand(10)*10
> 10-element Array{Float64,1}:
>  4.84005
>  8.29994
>  8.8531
>  3.42319
>  2.60318
>  7.25313
>  0.816263
>  4.44463
>  6.71836
>  4.65337
>
> julia> a.>5
> 10-element BitArray{1}:
>  false
>   true
>   true
>  false
>  false
>   true
>  false
>  false
>   true
>  false
>
> julia> find(a.>5,a)
> ERROR: no method find(BitArray{1}, Array{Float64,1})
>
> julia> find([a.>5],a)
> ERROR: no method find(BitArray{1}, Array{Float64,1})
>
> julia>
>
>


[julia-users] how use find ?

2014-07-12 Thread paul analyst
I need all indexes where a[:] >5 

julia> a=rand(10)*10
10-element Array{Float64,1}:
 4.84005
 8.29994
 8.8531
 3.42319
 2.60318
 7.25313
 0.816263
 4.44463
 6.71836
 4.65337

julia> a.>5
10-element BitArray{1}:
 false
  true
  true
 false
 false
  true
 false
 false
  true
 false

julia> find(a.>5,a)
ERROR: no method find(BitArray{1}, Array{Float64,1})

julia> find([a.>5],a)
ERROR: no method find(BitArray{1}, Array{Float64,1})

julia>



[julia-users] Re: Macros: noob mistakes or julia bugs?

2014-07-12 Thread Abraham Egnor
Mistake copy-pasting to the gist: the final line should read

eval(enum_f(:Rotation, :CW, :CCW))

On Sat Jul 12 2014 at 10:19:21 AM, Abraham Egnor 
wrote:

> Gist is here: https://gist.github.com/abe-egnor/7b1fadfe2197512ab91b
>
> I'm very unexperienced with macros, so I can't tell if I'm doing things
> wrong or bumping into bugs.  When attempting to make a simple macro to
> capture a particular pattern for implementing an enum type, I ran into
> multiple issues:
>
> A - it looks like, when quoting a baremodule with a spliced name, the
> module parsing binds to the $ as the name of the module, and you're left
> with a raw variable name in the module body.
> B - I couldn't find a way to directly splice in an expression list
> C - macro expansion is barfing ("malformed module expression") on exprs
> that work just fine when eval()'d.
>
> Would much appreciate guidance on whether I should update my code or file
> bugs :)
>


[julia-users] Macros: noob mistakes or julia bugs?

2014-07-12 Thread Abraham Egnor
Gist is here: https://gist.github.com/abe-egnor/7b1fadfe2197512ab91b

I'm very unexperienced with macros, so I can't tell if I'm doing things
wrong or bumping into bugs.  When attempting to make a simple macro to
capture a particular pattern for implementing an enum type, I ran into
multiple issues:

A - it looks like, when quoting a baremodule with a spliced name, the
module parsing binds to the $ as the name of the module, and you're left
with a raw variable name in the module body.
B - I couldn't find a way to directly splice in an expression list
C - macro expansion is barfing ("malformed module expression") on exprs
that work just fine when eval()'d.

Would much appreciate guidance on whether I should update my code or file
bugs :)


[julia-users] Sort error, How to find reserved word in big text ?

2014-07-12 Thread paul analyst

 I have a very long vector (5*10^6 ) with the words in a foreign language. I 
can not sort 
julia> sort (y1u) 
ERROR: no method isless (Float64, substring {UTF8String}) 
  in the sort! at sort.jl: 233 
  in the sort! at sort.jl: 277 
  in next at string.jl: 630 
Probably there is a word reserved for Julia. How to find them? Where is the 
list 
of such words?
Paul


[julia-users] Re: New Julia tutorial from SciPy now online

2014-07-12 Thread cdm

another potential add:

http://forio.com/labs/julia-studio/tutorials/


enjoy !!!

cdm