Re: [julia-users] Spectrum of a tridiagonal matrix with the Sturm sequence method

2014-03-21 Thread Ivar Nesje
There is nothing wrong with for loops in julia. I think sturm would be prettier if you removed `n=length(D)` and instead used `t=zeros(D)` and `for i=2:length(D)`. Julia creates a Range object for iteration, so the length function will only execute once. countnegatives+=1 Do you really need

Re: [julia-users] Re: Not fun

2014-03-21 Thread Keith Campbell
There is also MutableStrings.jl at https://github.com/tanmaykm/MutableStrings.jl.

[julia-users] Remaining GSoC projects

2014-03-21 Thread Oliver Lylloff
Hello all, After seeing all the good project proposals for GSoC, I realized than only one or two lucky projects will eventually be worked on during the summer. What will happen to the remaining? Would it be a good idea to keep them at julialang.org as inspiration for e.g. a bachelor's or

Re: [julia-users] Re: I had an idea to (ab)use the type system. It failed miserably. Why?

2014-03-21 Thread andrew cooke
above is typed code is wrong. it's actually: $(Expr(:lambda, {:r}, {{:n,:#s7,:#s6,:i},{{:r,TypedRange{S,I,E},0},{:n,Any,2},{:#s7,Any,2},{:#s6,(Any,Any),18},{:i,Any,18}},{}}, :(begin # /home/andrew/.julia/v0.3/IntModN/src/Range.jl, line 44: n = 0 # line 45: #s7 =

[julia-users] Re: OpenGL issue

2014-03-21 Thread Robert Ennis
Hey Alex, Sorry for the huge delay on this. Not sure if you've tried an updated version of the package since, but this should be fixed now. Best, Rob On Monday, January 20, 2014 6:45:34 AM UTC+1, Alex Zlov wrote: I'm trying to run NeHe examples from GLUT package and get following console

[julia-users] Re: Some pointers for installing SDL 1.2 on Windows for Julia?

2014-03-21 Thread Robert Ennis
Just posting a link to the relevant issue for any others that might come across this: https://github.com/rennis250/SDL.jl/issues/3 Best, Rob On Tuesday, February 25, 2014 4:26:20 AM UTC+1, Joshua Olson wrote: The SDL package looks promising, except I don't know which SDL 1.2 library to

Re: [julia-users] Re: I had an idea to (ab)use the type system. It failed miserably. Why?

2014-03-21 Thread andrew cooke
sorry for the noise, but explaining it to someone else made me realise i still didn't have it right. below it the expanded typed. native and llvm code. above are wrong. this is for the 10 -1 1 loop. it's pretty clean - no unboxing in the native code (at least, no QWORDs which i think is

Re: [julia-users] Re: Not fun

2014-03-21 Thread Andreas Lobinger
Hello colleagues, this conversation is covering one of the most dangerous things that you can do in SW engineering: - How can i do X? - This is not meant to be used. But i have a work around for you. You can be absolutely sure that this will propagate and be the new default way. (I'm

[julia-users] Re: Sum of Laguerre polynomials

2014-03-21 Thread Steven G. Johnson
On Thursday, March 20, 2014 5:32:15 PM UTC-4, Paweł Biernat wrote: Taking into account your suggestions I came up with an ad-hoc implementation tailored for my needs. Instead of computing Laguerre(n,1,t-n) I compute the whole expression Laguerre(n,1,t-n)*exp(-(t-n))*(t-n) via a function

Re: [julia-users] Re: Not fun

2014-03-21 Thread Ivar Nesje
We try to be helpful, and answer the questions as asked. We also provide advice for improvements, if the question is likely to lead to a poor program. Julia gives you as a programmer lots of power, and if you don't follow advice, you might end up in trouble. If you change the internal

[julia-users] Re: Remaining GSoC projects

2014-03-21 Thread Mike Innes
Absolutely - the plan is to keep the ideas list around so that people who want to get involved have a nice set of projects to pick from. Aside from anything else it's probably a good idea to separate actual issues and would be cool projects. That said, if we're keeping the ideas list around we

Re: [julia-users] Re: Not fun

2014-03-21 Thread Stefan Karpinski
On Thu, Mar 20, 2014 at 10:59 PM, J Luis jmfl...@gmail.com wrote: Well, ... thanks But naive question though. If we can do it with elaborate tricks, why not just have a clean simple way? The bottom line for whether something should be mutable or not is psychological: is the thing a value

Re: [julia-users] Re: Not fun

2014-03-21 Thread Jacob Quinn
Thanks to Ivar and Stefan for the great explanations. I think often we hear don't do this, don't do that, but it's great to hear some good anecdotes and reasoning. Also excited to see the improvements in Strings under the hood. -Jacob On Fri, Mar 21, 2014 at 11:37 AM, Stefan Karpinski

Re: [julia-users] Re: Not fun

2014-03-21 Thread J Luis
I too want acknowledge all your work to explain why things work the way they do. But I want also say that I did read the docs before asking. It just happened that I missed that first part on the Strings that talk about strings immutability and error message does not help much leading us to the

Re: [julia-users] Re: Not fun

2014-03-21 Thread Andrew Dabrowski
On Friday, March 21, 2014 11:37:33 AM UTC-4, Stefan Karpinski wrote: Getting back to your original example, I would counter that you never really want to just do something like replace the 16th character of this string in isolation. How did you figure out the index 16? What you really

Re: [julia-users] Spectrum of a tridiagonal matrix with the Sturm sequence method

2014-03-21 Thread Jarvist Moore Frost
Ah wonderful, thankyou both. Ivar; you're quite right about being able to get rid of the array for t, I was just following term for term the mathematical expression. Jiahao; your code is indeed much more elegant! Thank you for pointing me in its direction. How efficient is the

[julia-users] Re: Sum of Laguerre polynomials

2014-03-21 Thread Paweł Biernat
W dniu piątek, 21 marca 2014 13:44:17 UTC+1 użytkownik Steven G. Johnson napisał: It would be better to avoid the NaNs in the first place (which come when you multiply 0 * Inf, from an underflow times an overflow). For one thing, floating-point exceptions are slow. For another thing,

[julia-users] pycall error

2014-03-21 Thread Tang Ross
I try to do this: @pyimport Crypto.Cipher.AES as AES @pyimport Crypto.Hash.SHA256 as SHA256 key = hello world hash = SHA256.new() hash[:update](key) secret = hash[:digest]() cipher = AES.new(secret) but I get the following error: PyError (Ptr) type 'exceptions.UnicodeDecodeError'

[julia-users] Array of images

2014-03-21 Thread Paulo Castro
Hi, I am starting using Julia, and I'm having a simple problem. I have some images on a directory, and I want to iterate over each one, open it with Images' imread(), and store it on an array. I cannot create a empty array and append images to it. How can I achieve this? Thanks, Paulo

[julia-users] Scientific papers using Julia

2014-03-21 Thread Jonathan Malmaud
Is someone curating a list somewhere of published work that uses Julia?

[julia-users] Re: Scientific papers using Julia

2014-03-21 Thread Ivar Nesje
It is prominently placed on our homepage: http://julialang.org/publications/ Ivar kl. 19:07:40 UTC+1 fredag 21. mars 2014 skrev Jonathan Malmaud følgende: Is someone curating a list somewhere of published work that uses Julia?

[julia-users] Re: Array of images

2014-03-21 Thread Patrick O'Leary
You can grow arrays, but you need to use push!() to do so. You could also use an array comprehension to construct the array. On Friday, March 21, 2014 1:07:47 PM UTC-5, Paulo Castro wrote: Hi, I am starting using Julia, and I'm having a simple problem. I have some images on a directory,

Re: [julia-users] Array of images

2014-03-21 Thread Jacob Quinn
Actually, you can create an empty array and append (though in Julia vernacular, it's push!). a = Image[] for image in images push!(a, image) end Or something along those lines. -Jacob On Fri, Mar 21, 2014 at 2:07 PM, Paulo Castro p.oliveira.cas...@gmail.comwrote: Hi, I am starting

[julia-users] Re: Array of images

2014-03-21 Thread Ivar Nesje
Why can you not create an empty array? It might not be totally obvious, but `a = []` creates a special array, that can store nothing. You might have better success with specifying a type `a = Any[]`, or use the special Array{Any,1} syntax `a = {}`. kl. 19:07:47 UTC+1 fredag 21. mars 2014 skrev

[julia-users] Re: Array of images

2014-03-21 Thread Ivar Nesje
Also, append is called push!() in Julia push!(a, imread()) Regards Ivar kl. 19:13:49 UTC+1 fredag 21. mars 2014 skrev Ivar Nesje følgende: Why can you not create an empty array? It might not be totally obvious, but `a = []` creates a special array, that can store nothing. You might

[julia-users] Re: Scientific papers using Julia

2014-03-21 Thread Jonathan Malmaud
Well, those are papers about Julia. I meant papers that just use Julia as an implementation language in the course of doing other research. Sorry for not being clear. On Friday, March 21, 2014 11:10:12 AM UTC-7, Ivar Nesje wrote: It is prominently placed on our homepage:

[julia-users] Re: Scientific papers using Julia

2014-03-21 Thread Ivar Nesje
I realised that about 10 seconds after pushing send. Strange how doing something irreversible clears the mind. You might search for citations of those two papers. Ivar kl. 19:19:11 UTC+1 fredag 21. mars 2014 skrev Jonathan Malmaud følgende: Well, those are papers about Julia. I meant papers

Re: [julia-users] Re: Not fun

2014-03-21 Thread Stefan Karpinski
Sure, there are always exceptions. In that particular case, you may want to work with the data as mutable arrays of bytes, rather than as strings. Did you want to replace the 16th byte or replace the *character* starting at the 16th byte? What if that's a multibyte character? What if the 16th byte

Re: [julia-users] Re: Not fun

2014-03-21 Thread Stefan Karpinski
On Fri, Mar 21, 2014 at 12:12 PM, J Luis jmfl...@gmail.com wrote: I too want acknowledge all your work to explain why things work the way they do. But I want also say that I did read the docs before asking. It just happened that I missed that first part on the Strings that talk about strings

Re: [julia-users] Re: Scientific papers using Julia

2014-03-21 Thread Jonathan Malmaud
Levi is the an author on the Foulds paper I mentioned, so maybe that's what you're thinking of. I gather Simon Kornblith and and Tim Holy are using Julia for experimental neuroscience data analysis, so obviously the lead time for any publications that result from that will be longer than the

Re: [julia-users] Re: Scientific papers using Julia

2014-03-21 Thread Ivar Nesje
3 sections is appropriate * About Julia * Using Julia * Using Julia, but non free access (if we are going to list those at all). kl. 21:40:37 UTC+1 fredag 21. mars 2014 skrev Stefan Karpinski følgende: I think we should split the publications page into two sections: papers about Julia at the

Re: [julia-users] Re: Remaining GSoC projects

2014-03-21 Thread Stefan Karpinski
Yes, I think that's a really great idea. I'll change the URL from /gsoc/2014 to /projects once we've decided on which projects we can fund (sadly it won't be nearly enough of them) and then for next year, we can just keep using the /projects URL and it will already be nicely put together and

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Stefan Karpinski
On the other hand, saying 4 == 2 + 2 or go home is perfectly reasonable ;-) On Thu, Mar 20, 2014 at 6:47 PM, John Myles White johnmyleswh...@gmail.comwrote: To me, this actually explains why the i == 1 do_stuff() idiom feels so unnatural: you'd never mix a declarative statement with an

Re: [julia-users] Re: Not fun

2014-03-21 Thread cnbiz850
Well, from this perspective, it makes sense why those strings should not be mutable. But from other perspectives, making strings immutable contradicts with how natural languages are used. For instance, after I said I am a professor, I want to say I am a scientist, or perhaps I change my

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Matt Bauman
I quickly acclimated to Stefan's idiom and now happily read and write code containing it. That said, it did throw me for a loop when first learning the language. I'm not too big of a fan of reserving another keyword for an optional syntax… but I could perhaps support its inclusion if it

Re: [julia-users] Re: Not fun

2014-03-21 Thread Milan Bouchet-Valat
Le samedi 22 mars 2014 à 05:08 +0800, cnbiz850 a écrit : Well, from this perspective, it makes sense why those strings should not be mutable. But from other perspectives, making strings immutable contradicts with how natural languages are used. For instance, after I said I am a

Re: [julia-users] Re: Not fun

2014-03-21 Thread Keno Fischer
Perhaps the right thing to do here then is to make replace accept a range of characters to replace: str = I am a scientist replace(str,8:16,scholar) ? On Fri, Mar 21, 2014 at 5:21 PM, Milan Bouchet-Valat nalimi...@club.frwrote: Le samedi 22 mars 2014 à 05:08 +0800, cnbiz850 a écrit :

Re: [julia-users] Type Parameter Scope Inconsistency?

2014-03-21 Thread Jarrett Revels
I also made a typo in my question; the parameter I'm referring to is the parameter of Vector in x, i.e. T in x::Dict{Int, Vector{T}}. On Friday, March 21, 2014 5:44:19 PM UTC-4, Jarrett Revels wrote: Here's a gist clarifying what I'm trying to do in my second question:

Re: [julia-users] Re: Not fun

2014-03-21 Thread Stefan Karpinski
You're assuming that strings are specifically for holding sentences, which is not the case. That's one possible use case, but certainly not the only one. If you want to do this sort of thing, using a mutable array of words seems much more appropriate anyway. You can easily wrap this in a Sentence

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Stefan Karpinski
I kind of like that idea, actually. On Fri, Mar 21, 2014 at 5:10 PM, Matt Bauman mbau...@gmail.com wrote: I quickly acclimated to Stefan's idiom and now happily read and write code containing it. That said, it did throw me for a loop when first learning the language. I'm not too big of a

Re: [julia-users] Re: Not fun

2014-03-21 Thread ronubi
*The replace() function is pretty cool, but for this case all we need is indexing and concatenation:* *julia **s = I am a scientist.* *I am a scientist.* *julia **s = s[1:7] * scholar * s[end:end]* *I am a scholar.*

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Chris Foster
On Sat, Mar 22, 2014 at 9:23 AM, Stefan Karpinski ste...@karpinski.org wrote: I kind of like that idea, actually. On Fri, Mar 21, 2014 at 5:10 PM, Matt Bauman mbau...@gmail.com wrote: I quickly acclimated to Stefan's idiom and now happily read and write code containing it. That said, it

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Jacob Quinn
What would return from the statement if it were false? nothing? Like if I use it assigning a variable? I definitely see the attraction as a one liner though. -Jacob On Mar 21, 2014 9:52 PM, Chris Foster chris...@gmail.com wrote: On Sat, Mar 22, 2014 at 9:23 AM, Stefan Karpinski

Re: [julia-users] Type Parameter Scope Inconsistency?

2014-03-21 Thread Jameson Nash
It can take a bit of work to get this just right. In many cases, it is not worthwhile to check that the types are the same (to allow duck-typing). But I use the following code pattern to accomplish what you were trying for: type Bar{T} x::T end type Foo{B:Bar, V:Vector} y::Vector{B}

Re: [julia-users] Re: The then keyword

2014-03-21 Thread Chris Foster
Given the similarity in syntax, I'd expect it to behave the same as a normal if ... end On Sat, Mar 22, 2014 at 12:05 PM, Jacob Quinn quinn.jac...@gmail.com wrote: What would return from the statement if it were false? nothing? Like if I use it assigning a variable? I definitely see the