[julia-users] Re: Change field value of a composite type when name of the field is in a variable
Thank you Isaiah and Patrick. The source is a Dict{ASCIIstring, Any}. From your answers I realized, I can instead use Dict{Symbol, Any} as the source and then use either Don's or Isaiah's syntax. Yes, I was thinking that may be I should use a Dict. But then I would have to use Dict{ASCIIstring, Any} type. I was not sure (because I don't know about these things) whether that would affect the performance adversely (because of the Any). While Dict{ASCIIstring, Any} is a source that is used to change *inst, inst *is used multiple times in the program. Once it's value is changed, its type is known completely when it is used those multiple times. On Sunday, September 14, 2014 11:09:56 AM UTC-4, Patrick O'Leary wrote: On Saturday, September 13, 2014 6:47:46 PM UTC-5, curiou...@gmail.com wrote: However, suppose the field that has to be changed is determined by the program. Say, I have, varToChange = numLines How can I use *varToChange* to change the value of *numLines* in *inst*? Here are a couple of alternatives. Depending on the source of your numLines, you can assign the symbol directly, rather than via a string and a call to symbol(), combining it with either Don or Isaiah's syntaxes: varToChange = :numLines If this is the sort of thing you find you are doing often, a composite type may not be the correct data structure for your application. Consider a Dict: inst = Dict{String, Any}() inst[numLines] = 10 inst[avgLength] = 8.5 inst[varToChange] = 20 Patrick
[julia-users] Change field value of a composite type when name of the field is in a variable
Hi All, Suppose I have a composite type and an instance of it: type myType numLines::Int avgLength::Float64 end inst = myType(10, 8.5) I want to change, say numLines of inst1 to 20. I know I can do inst.numLines = 20 However, suppose the field that has to be changed is determined by the program. Say, I have, varToChange = numLines How can I use *varToChange* to change the value of *numLines* in *inst*? Thank you.
[julia-users] Re: Slow startup time on Mac OSX with Julia 0.3 .dmg package
Jake, thank you for the answer. Yeah, it is unfortunate. Since the Julia development team is so awesome, I hope they fix it soon. For now, I will have to be more careful with not making errors before I try and run it. On Sunday, September 7, 2014 11:35:31 PM UTC-4, Jake Bolewski wrote: Unfortunately the only way to solve this problem currently is to compile Julia from source and include your most commonly used packages in the system image build. If you are adventurous there are posts on this mailing list about how to go about doing that. On Sunday, September 7, 2014 6:52:22 PM UTC-4, curiou...@gmail.com wrote: Hello, It takes very long for the julia script to even start running (about a litte over 10 seconds). Looking at some posts here, it appears this problem can be solved if I change how I use other packages. However, it is not clear to me what the solution is. I would appreciate if anyone could give a quick example using the script below. If I just have: function add5(x) x + 5 end println(add5(3)) the script starts quickly. However, if I have: import Distributions import DataFrames const Dist = Distributions const Df = DataFrames function add5(x) x + 5 end println(add5(3)) it take over 10-12 seconds to start up. Is there something I can do to decrease the startup time? Thank you.
Re: [julia-users] Re: Slow startup time on Mac OSX with Julia 0.3 .dmg package
That would be awesome. Please do so. On Monday, September 8, 2014 11:16:23 AM UTC-4, Tim Holy wrote: Actually, I believe there are serious intentions of backporting this particular improvement to the release-0.3 branch. For precisely the reasons you give. --Tim On Monday, September 08, 2014 08:10:21 AM Patrick O'Leary wrote: On Monday, September 8, 2014 10:05:31 AM UTC-5, Tim Holy wrote: And Jeff got another 2x speed increase on 0.4 since then. --Tim Here I am, trying to get along with a stable version for a while, and maybe actually start using it for things without being tempted to use the nightlies, and then something like this happens. Can we please stop making stuff better already. Seriously, it's just getting annoying. (And we haven't even gotten stagedfunctions, LLVM 3.5, or Array Nirvana yet.) Patrick
[julia-users] cld not defined in Julia 0.3.0
Is it a bug that when I call *cld* in Julia 0.3.0 on Mac OSX it says: ERROR: cld not defined Thanks.
[julia-users] Re: cld not defined in Julia 0.3.0
Thank you, Simon. I did not know how to look at the docs for that release. On Monday, September 8, 2014 5:05:48 PM UTC-4, Simon Kornblith wrote: This was just added to Julia 0.4 yesterday, which is why it's not defined in Julia 0.3 :). In general if you're using Julia 0.3 you should be looking at the release-0.3 docs and not latest (click at the lower right on julia.readthedocs.org to change). Simon On Monday, September 8, 2014 4:59:28 PM UTC-4, curiou...@gmail.com wrote: Is it a bug that when I call *cld* in Julia 0.3.0 on Mac OSX it says: ERROR: cld not defined Thanks.
[julia-users] Slow startup time on Mac OSX with Julia 0.3 .dmg package
Hello, It takes very long for the julia script to even start running (about a litte over 10 seconds). Looking at some posts here, it appears this problem can be solved if I change how I use other packages. However, it is not clear to me what the solution is. I would appreciate if anyone could give a quick example using the script below. If I just have: function add5(x) x + 5 end println(add5(3)) the script starts quickly. However, if I have: import Distributions import DataFrames const Dist = Distributions const Df = DataFrames function add5(x) x + 5 end println(add5(3)) it take over 10-12 seconds to start up. Is there something I can do to decrease the startup time? Thank you.
[julia-users] Re: Problem Generating Matrices of random data using Distributions with Julia 0.3
Have you tried: using Distributions x = rand(Normal(0,1),(10,10)) That should work. On Sunday, September 7, 2014 7:47:24 PM UTC-4, Christopher Fisher wrote: Hi all- I recently upgraded to Julia 0.3 and encountered a problem generating matrices of random data using Distributions. I did not receive this error with Julia 0.2. I receive the following error in both IJulia and terminal: using Distributions x = rand(Normal(0,1),10,10) `rand` has no method matching rand(::Normal, ::Int64, ::Int64) while loading In[8], in expression starting on line 2 However, the following works: using Distributions x = rand(Normal(0,1),10) 10-element Array{Float64,1}: -1.27113 0.81187 0.250986 1.01228 -1.77785 0.328616 0.122259 0.926345 -1.11857 0.462382 Any help would be much appreciated. Chris
[julia-users] Re: Julia and Python languages
I think the ability to use existing Python libraries in Julia will immensely help Julia's growth. It will encourage people to try it out for serious tasks. I think there is comfort in knowing that if some important functionality is lacking (which a Python library provides), then one can always use the python library for that task in Julia code; that is, there is no need to rewrite everything in Python. Also, Julia community is truly awesome; amazing helpful people. Having played with Julia for some time now, I plan to use it soon on a serious project (at least for the purpose of creating the simulation model and running the simulations, and will perhaps use Pandas for the analysis of the data). On Tuesday, January 7, 2014 4:07:44 PM UTC-5, Steven G. Johnson wrote: On Tuesday, January 7, 2014 2:59:03 PM UTC-5, Erik Engheim wrote: Given that Julia is not even in version 1 and has a lot less libraries than Python I don't think Julia is a serious contender in Scientific Computing today. But I am pretty sure it will be. But that wont happen over night. Note, however, that you can call existing Python libraries from Julia.