[julia-users] Difference between {a b; c d} and Any[a b; c d]

2016-01-11 Thread Jerry Xiong
Seems that Any[...] is not exactly equal to {...} in Julia 0.4. What is the best way to rewrite {a b;c d} ? julia> {1 [1,2];[1,2,3] 4} WARNING: deprecated syntax "{a b; c d}". Use "Any[a b; c d]" instead. 2x2 Array{Any,2}: 1 [1,2] [1,2,3] 4 julia> Any[1 [1,2];[1,2,3] 4] ERRO

[julia-users] How to define function f(x::(Int...)) in Julia 0.4?

2015-10-11 Thread Jerry Xiong
For example, in Julia 0.3, I can use below function definition: julia> f(::(Int...))="This is an Int tuple." julia> f((1,2)) "This is an Int tuple." julia> f((1,2,3)) "This is an Int tuple." How to define a function with unlimited tuple length in Julia 0.4?

[julia-users] Re: X.2=X*0.2, easy to make mistake.

2015-06-17 Thread Jerry Xiong
Great, looking forward the next version!! My Julia is 0.3.9 so far. On Wednesday, June 17, 2015 at 3:14:24 PM UTC+2, Seth wrote: > > > > On Wednesday, June 17, 2015 at 8:04:11 AM UTC-5, Jerry Xiong wrote: >> >> Today I spend many time to find a bug in my cod

[julia-users] X.2=X*0.2, easy to make mistake.

2015-06-17 Thread Jerry Xiong
Today I spend many time to find a bug in my code. It is turn out that I mistakenly wrote sum(X,2) as sum(X.2). No any error information is reported and Julia regarded X.2 as X*0.2. The comma "," is quite close to dot "." in the keyboard and looks quite similar in some fonts. As there is no any

Re: [julia-users] Re: How to call the original method that was overloaded?

2015-04-26 Thread Jerry Xiong
pril 26, 2015 at 10:22:34 AM UTC+2, Jerry Xiong wrote: > > Yes. I tried it, and it indeed went into an infinite recursion. > > On Sunday, April 26, 2015 at 10:06:57 AM UTC+2, Mauro wrote: >> >> > Thank you! For this question, invoke indeed a good solution :) >> >

Re: [julia-users] Re: How to call the original method that was overloaded?

2015-04-26 Thread Jerry Xiong
generic function. So above gets you into an infinite recursion. > > > On Sunday, April 26, 2015 at 8:40:06 AM UTC+2, Sam L wrote: > >> > >> See ?invoke. > >> > >> display(X::Vector)=length(X)>10?print("Too long to show."): > >>

[julia-users] Re: How to call the original method that was overloaded?

2015-04-26 Thread Jerry Xiong
(X::Vector)=length(X)>10?print("Too long to show."): > invoke(display, (Any,), X) > > On Saturday, April 25, 2015 at 10:41:39 PM UTC-7, Jerry Xiong wrote: >> >> For example, if I want to overload the Base.display(::Vector) to repress >> the display when t

[julia-users] How to call the original method that was overloaded?

2015-04-25 Thread Jerry Xiong
For example, if I want to overload the Base.display(::Vector) to repress the display when the vector is too long, I coded as below: julia> import Base.display julia> display(X::Vector)=length(X)>10?print("Too long to show."):Base. display(X) display (generic function with 17 methods) julia> disp

[julia-users] Re: Bioinformatics in Julia

2015-04-25 Thread Jerry Xiong
Hi, I am a computational biologist and I do my majority of jobs using Julia right now. So far biojulia is not so practical but you can using BioPython package. It is quite convenient and painless to call python package so far. R packages are also necessary for bioinformatics. However, as I known

[julia-users] Why X.>0 & X.<1 equal to X .> (0 & X) .< 1 rather than (X.>0) & (X.<1)?

2015-04-02 Thread Jerry Xiong
I notice that the logical operations in Julia have a different precedence order from R and Matlab. & and | have higher precedence than .<, .>, etc. For example, X.>0 & X.<1 will be parse as X .> (0 & X) .< 1 rather than (X.>0) & (X.<1). I think there must be a reason for this anti-intuition des

Re: [julia-users] Any plan to support dict$key as abbreviation of dict["key"] ?

2015-04-01 Thread Jerry Xiong
ct("foo"=>1, "bar"=>2) > x≀:foo+2 #3 > > In this case ≀: would pretend to be the operator you wanted. > > Thanks, > > Jiahao Chen > Staff Research Scientist > MIT Computer Science and Artificial Intelligence Laboratory > > On Wed, Apr 1, 2015 a

[julia-users] Any plan to support dict$key as abbreviation of dict["key"] ?

2015-04-01 Thread Jerry Xiong
I sometimes miss the concise way to fetch the element in a dictionary, such as dict$key in R and dict.key in Matlab. In Julia, I have to use dict["key"] or dict[:key]. Although they are logically identical, the concise way has both typing and visual conveniences. I can regard dict.key1 and dict

[julia-users] Re: Could it be a bug of PyCall or PyPlot?

2015-03-10 Thread Jerry Xiong
Many thanks! On Monday, March 9, 2015 at 10:24:42 PM UTC+1, Steven G. Johnson wrote: > > > > On Monday, March 9, 2015 at 5:24:22 PM UTC-4, Steven G. Johnson wrote: >> >> On Monday, March 9, 2015 at 5:18:52 PM UTC-4, Steven G. Johnson wrote: >>> >>> Yes, I should probably define a "pycall" method f

[julia-users] Re: Could it be a bug of PyCall or PyPlot?

2015-03-09 Thread Jerry Xiong
My Julia version is : Julia Version 0.3.6 Commit 0c24dca* (2015-02-17 22:12 UTC) Platform Info: System: Linux (x86_64-redhat-linux) CPU: Intel(R) Xeon(R) CPU E7- 4830 @ 2.13GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem) LAPACK: libopenblas LIBM: lib

[julia-users] Could it be a bug of PyCall or PyPlot?

2015-03-09 Thread Jerry Xiong
When I ran below codes: using PyCall @pyimport pylab as plb cmap1=plb.get_cmap("jet") pycall(cmap1,PyAny,0.5) Every thing goes fine, output result (0.4901960784313725,1.0,0.4775458570524984,1.0) However, after I loaded PyPlot: require("PyPlot") cmap2=plb.get_cmap("jet") pycall(cmap2,PyAny,0.5) A

Re: [julia-users] Re: Is string in Julia extendable?

2015-02-26 Thread Jerry Xiong
gt; > > N = 1 > > @time concat1(N); > > @time concat2(N); > > > > With N = 10, concat2 is almost instantaneous, and I couldn't be > > bothered to wait for concat1 to finish. > > > > David. > > > > > On Thursday, Fe

[julia-users] Re: Is string in Julia extendable?

2015-02-26 Thread Jerry Xiong
0 > println(concat1(N)) > println(concat2(N)) > > N = 1 > @time concat1(N); > @time concat2(N); > > With N = 10, concat2 is almost instantaneous, and I couldn't be > bothered to wait for concat1 to finish. > > David. > > >> >> On Thursd

[julia-users] Re: Julia users Berlin

2015-02-26 Thread Jerry Xiong
I'll work in Berlin in this May. I work in computational biology. Right now I almost do all my job in Julia instead Matlab. I'd happy to share if the date is availble for me :) Jerry On Wednesday, February 25, 2015 at 2:35:13 PM UTC+1, David Higgins wrote: > > Hi all, > > I'm based at the Techn

[julia-users] Is string in Julia extendable?

2015-02-26 Thread Jerry Xiong
Considering below code: str="abc" str*="def" Is the new string "def" just be appended after the memory space of "abc", or both strings were copied to a new momory space? Is str*="def" equal to str=str*"def" and str="$(str)def" in speed and memory level? Is below code in O(n) or in O(n^2) speed?

[julia-users] Is julia string extendable?

2015-02-26 Thread Jerry Xiong
str="abc" str*="def" Is the new string "def" just be appended after the memory space of "abc", or both strings were copied to a new momory space? Is str=str*"def" equal to str*="def" in speed and memory level? Is below code O(n) or O(n^2)? s="" for i=1:1 end

[julia-users] Re: Calculate 95% confidential intervals of p in binomial distribution

2015-01-02 Thread Jerry Xiong
Many thanks! We have two solutions now :) The BinomialTest Package seems cool, hope that it can be more powerful than, meanwhile as easy-understandable as, matlab statistics toolbox.

[julia-users] Calculate 95% confidential intervals of p in binomial distribution

2014-12-31 Thread Jerry Xiong
I want to calculate the 95% confidential intervals of the parameter p of a binomial distribution, for a given x and n. I known that in MATLAT, it could be got in the 2nd output of binofit(x,n,0.95) Is there any way to do it in Julia, using Distributions.jl or any python package?