Re: [julia-users] [ANN] QuickTypes.jl: Concise type definitions with default arguments

2016-10-30 Thread Cedric St-Jean
eff's PR to >>> change the `type` keyword to `mutable`, making the naming consistent >>> >>> On Tuesday, October 25, 2016 at 11:00:13 AM UTC-4, Cedric St-Jean wrote: >>>> >>>> Types are central to Julia programming, but the built-in `type` and >>

[julia-users] Re: Dict() how to creat in 5.0 ?

2016-10-30 Thread Cedric St-Jean
Dict(zip(slow[:,1], slow[:,2])) ? On Sunday, October 30, 2016 at 8:34:29 AM UTC-4, program...@gmail.com wrote: > > Dict() how to creat in 5.0 ? > > julia> typeof(slow) > Array{Any,2} > > julia> D=Dict(slow[:,1],slow[:,2]) > ERROR: MethodError: no method matching Dict{K,V}(::Array{Any,1}, >

Re: [julia-users] Re: How would you implement setindices! elegenatly?

2016-10-26 Thread Cedric St-Jean
4215 > 0.707829 0.339795 0.451387 0.358248 > > > julia> ind = [1 1; 2 2; 3 3] > 3×2 Array{Int64,2}: > 1 1 > 2 2 > 3 3 > > > julia> A[ind] > 3×2 Array{Float64,2}: > 0.427998 0.427998 > 0.0333443 0.0333443 > 0.402635 0.402635 > > >

[julia-users] [ANN] QuickTypes.jl: Concise type definitions with default arguments

2016-10-25 Thread Cedric St-Jean
Types are central to Julia programming, but the built-in `type` and `immutable` definitions can be cumbersome to write. QuickTypes.jl provides two alternative macros, *@qtype* and *@qimmutable, *with a more convenient syntax: Pkg.add("QuickTypes") #

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Cedric St-Jean
count_zeros = sum( map(x->(x==0.0), actuals) ) # can be rewritten count_zeros = sum(x==0.0 for x in actuals) This shouldn't allocate, because it's using a generator. I agree with DNF that _v1 is already straight-forward, as far as performance-sensitive code goes. On Tuesday, October 25,

Re: [julia-users] Julia crashes on using PyPlot after workspace() on Mac OSX Yosemite

2016-10-20 Thread Cedric St-Jean
Perhaps not 100% the solution you're looking for, but ClobberingReload.creload is a reload alternative that bypasses (most of) the need for workspace(). On Thursday, October 20, 2016 at 8:40:51 AM UTC-4, Vishnu Raj wrote: > > Thanks Yu! > Seems

[julia-users] Re: Importing Python data to Julia

2016-10-18 Thread Cedric St-Jean
Could you provide a more concrete example of what you're trying to do? On Tuesday, October 18, 2016 at 4:42:51 PM UTC-4, Corbin Foucart wrote: > > Suppose that I have a large Python code; I would like to use Julia to > operate on the python workspace variables at certain locations in the code.

[julia-users] Re: Julia 0.5 Highlights

2016-10-12 Thread Cedric St-Jean
Very nice summary! I assume that there's a mile-long issue discussing this somewhere, but why doesn't the return type also assert that convert returns a value of the correct type? type A end Base.convert(::Type{Int}, ::A) = "hey" foo()::Int = A() foo() # returns "hey" On Wednesday, October

Re: [julia-users] Re: eval in current scope

2016-09-30 Thread Cedric St-Jean
On Friday, September 30, 2016 at 9:59:37 AM UTC-4, Cedric St-Jean wrote: > > This only works if A and type_fields are defined in the same module >> though. Although to be honest it surprised me a bit that it works at all, I >> guess the type definitions are evaluated prior t

Re: [julia-users] Re: eval in current scope

2016-09-30 Thread Cedric St-Jean
> > This only works if A and type_fields are defined in the same module > though. Although to be honest it surprised me a bit that it works at all, I > guess the type definitions are evaluated prior to macro expansions? > Good point. You can use a generated function then: using MacroTools

Re: [julia-users] Re: eval in current scope

2016-09-29 Thread Cedric St-Jean
Would eval'ing the type inside the macro work? This shows [:x, :y] macro type_fields(typ) fields = fieldnames(eval(typ)) @show fields end type A x y end @type_fields A You can use that to generate the right expansion for that type. On Thursday, September 29, 2016 at 6:53:01 PM

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-28 Thread Cedric St-Jean
lia/Jupyter. Will try them. > > On Wednesday, September 28, 2016 at 8:25:37 PM UTC+8, Cedric St-Jean wrote: >> >> I just removed the IJulia dependency from ClobberingReload.jl (made it >> optional - autoreload still works for IJulia users). Thank you for the >> feedback.

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-28 Thread Cedric St-Jean
I just removed the IJulia dependency from ClobberingReload.jl (made it optional - autoreload still works for IJulia users). Thank you for the feedback. If you `Pkg.checkout("ClobberingReload")`, it should automatically remove IJulia and its dependencies. BTW, if you haven't tried

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-27 Thread Cedric St-Jean
> has something to do with it. It's not a big deal; I just thought it was > weird to see the package manager installing stuff like Qt, fontconfig, SSL, > and libxml just to clobber include(). > > But other than that, it works fabulously. Thank you so much! > > Cheers, > Daniel. >

[julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-27 Thread Cedric St-Jean
@Chris: I agree; if warnings were typed, we could selectively activate them. I'm using regexes for now: ClobberingReload.scrub_stderr(r"WARNING\: redefining constant .*\n", r"WARNING\: replacing docs for .*\n", ...) do ... end On Tuesday, September 27, 2016 at 3:43:15 PM UTC-4, Chris

[julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-27 Thread Cedric St-Jean
I wrote a work-around earlier today: Pkg.clone("git://github.com/cstjean/ClobberingReload.jl.git") using ClobberingReload: sinclude # silent include sinclude("foo.jl") # no redefinition warnings It's fresh off the press, so please file an issue if you encounter a problem. It calls

[julia-users] Using redirect_stderr

2016-09-26 Thread Cedric St-Jean
I'd like to scrub away method redefinition warnings, and I'm getting bogged down on how to read from the stream. It sounds simple in theory, but I'm not super familiar with pipes: old_stderr = STDERR outRead, outWrite = redirect_stderr() ... run some code # TODO: read everything from outRead #

Re: [julia-users] Re: ASTs of complete modules/packages?

2016-09-26 Thread Cedric St-Jean
Cool, thank you. On Mon, Sep 26, 2016 at 9:09 AM, Yichao Yu <yyc1...@gmail.com> wrote: > On Mon, Sep 26, 2016 at 8:31 AM, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > It would make sense to put .jl file-parsing code in a separate, > > community-mainta

Re: [julia-users] Re: ASTs of complete modules/packages?

2016-09-26 Thread Cedric St-Jean
:50:44 AM UTC+2, Cedric St-Jean wrote: >> >> I faced very similar issues with ClobberingReload.jl. https://g >> ithub.com/cstjean/ClobberingReload.jl/blob/master/src/ClobberingReload.jl >> Check >> out parse_file (courtesy of @stevengj), parse_module, and creload. I >

[julia-users] Re: ASTs of complete modules/packages?

2016-09-25 Thread Cedric St-Jean
I faced very similar issues with ClobberingReload.jl. https://github.com/cstjean/ClobberingReload.jl/blob/master/src/ClobberingReload.jl Check out parse_file (courtesy of @stevengj), parse_module, and creload. I haven't "expanded" the includes, but it seems straight-forward to do with a

[julia-users] Re: How to deal with methods redefinition warnings in 0.5?

2016-09-22 Thread Cedric St-Jean
I haven't implemented it yet in ClobberinReload.jl, but I suspect that include("file.jl"); IJulia.clear_output() can provide some pain relief (at the cost of missing the meaningful warnings) if you're using IJulia. On Tuesday, September 20, 2016 at 8:59:05 AM UTC-4, Matthieu wrote: > > +1. I

[julia-users] Re: ijulia with multiple versions

2016-09-20 Thread Cedric St-Jean
I have multiple julia versions installed (merely through never deleting them). At every new version I've called `Pkg.build("IJulia")` from the command line. This adds the new kernel to the list of kernels in the Kernel -> Change Kernel menu of the Jupyter notebooks. Does that not work for you?

[julia-users] [ANN] ClobberingReload.jl: a more convenient reload, and an Autoreload for 0.5

2016-09-20 Thread Cedric St-Jean
Hello, ClobberingReload .creload("ModuleName") is an alternative to reload("ModuleName") for interactive development. Instead of creating a new module object, it evaluates the modified code inside the existing module object, clobbering the

Re: [julia-users] Horn clauses

2016-09-20 Thread Cedric St-Jean
eptember 20, 2016 at 12:31:23 AM UTC-3, Kevin Liu wrote: >>> >>> Thanks Cedric, read some of that and LilKanren.jl and this is where I am >>> with the code (attached). Will continue tomorrow. Feel a bit lost, nothing >>> out of the usual. >>> >>

[julia-users] Re: Parsing a Julia file

2016-09-20 Thread Cedric St-Jean
That solved the issue, thank you. I was wondering if there was a Base function to do it, but that's simple enough. On Tuesday, September 20, 2016 at 9:17:04 AM UTC-4, Steven G. Johnson wrote: > > I'm not sure exactly what you want, but: > > function parse_file(filename) > str =

[julia-users] Parsing a Julia file

2016-09-20 Thread Cedric St-Jean
Is there a standard way of parsing a .jl file and getting the AST? Autoreload.jl uses parse(string("begin\n", open(filename) do f; readstring(f) end, "\n end")) but it's not the cleanest, and seems to punt on some files. Cédric

Re: [julia-users] Horn clauses

2016-09-19 Thread Cedric St-Jean
You might want to roll your own, too. It's instructive, and not particularly hard. Russell and Norvig's textbook has a good section on it. On Monday, September 19, 2016 at 5:44:04 PM UTC-4, Kevin Liu wrote: > > Thanks for the direction, Stefan. > > On Monday, September 19, 2016 at 3:10:19 PM

Re: [julia-users] conflicts when reloading module

2016-09-19 Thread Cedric St-Jean
Any progress on that? 0.5 killed Autoreload, and I am looking for alternatives. Have you tried julia with babel? On Wednesday, February 18, 2015 at 9:27:05 AM UTC-5, Tamas Papp wrote: > > The problem with workspace() is that if I am loading a few modules, then > re-initialization time is

Re: [julia-users] 0.5rc4: TypeError: non-boolean (Bool) used in boolean context

2016-09-18 Thread Cedric St-Jean
Thank you, loading all the modules up-front solved the problem. I'm surprised that the compiler can make false assumptions about types without triggering segfaults left and right. On Sunday, September 18, 2016 at 6:51:22 PM UTC-4, Yichao Yu wrote: > > On Sun, Sep 18, 2016 at 6:29 PM, Ced

[julia-users] 0.5rc4: TypeError: non-boolean (Bool) used in boolean context

2016-09-18 Thread Cedric St-Jean
I just updated my codebase to 0.5, and encountered a strange bug. I have two tests, test 1 and 2, both wrapped in their own modules so as not to interact. Both tests run fine from a fresh Julia session, but running test 1 before test 2 yields "TypeError: non-boolean (Bool) used in boolean

Re: [julia-users] Re: Conda.jl needs a new maintainer

2016-09-06 Thread Cedric St-Jean
Conda.jl is awesome, and important for ScikitLearn.jl, thank you for your work on it. I hope you find someone, but I'll step in if you don't. On Monday, September 5, 2016 at 12:08:31 PM UTC-4, wookyoung noh wrote: > > Hello, Luthaf > > It's sad that you're leaving for a while. > I wish to you

[julia-users] Re: How to publish a package

2016-08-31 Thread Cedric St-Jean
It's in the documentation: http://docs.julialang.org/en/release-0.4/manual/packages/#creating-a-new-package On Wednesday, August 31, 2016 at 1:11:41 AM UTC-4, M Hashmi wrote: > > Hi, > I need to know that how to publish a package for Julia. > Regards, > Mudassar >

[julia-users] Re: Syntax to create nested types in Julia

2016-08-27 Thread Cedric St-Jean
m wrote: >> >> What are the alternatives to using classes in Julia apart from types? Can >> you please explain how I can define the PhysicalNodes class in Julia the >> same way like I did in python? >> >> On Friday, 26 August 2016 23:16:39 UTC+2, Cedric St-Jean wro

[julia-users] Re: Syntax to create nested types in Julia

2016-08-26 Thread Cedric St-Jean
It's not possible in Julia at the moment. There's an issue for it. I think the main options are: - Don't declare the types. This may make it slower, but depending on the use case it might not be a big deal - Use parametric types, i.e. type

[julia-users] Re: Julia Plugin System

2016-08-23 Thread Cedric St-Jean
I think we need a more complete description of your problem, because a plugin can be a lot of things, and I don't know about Salt. In any case, re. plugin(hub, "subsystem.module.function")(args/kwargs) You're right, that doesn't look very Julian. Would something like this work? module

Re: [julia-users] Parent type of a parametric type

2016-08-17 Thread Cedric St-Jean
Thank you, that works. I suppose I will have to use a generated function to make this type-stable. On Wed, Aug 17, 2016 at 1:02 AM, Mauro <mauro...@runbox.com> wrote: > > On Wed, 2016-08-17 at 05:04, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > Hi, I'm writin

Re: [julia-users] Re: Symbols as Dict keys - efficiency / memory allocation?

2016-08-17 Thread Cedric St-Jean
Good points. Given that symbols have a name which is a string, I don't see how they could be a bits-type unless they just became numbers to index into a global array somewhere.. i.e. a pointer. Stack-allocating non-bits-type immutables is on the roadmap to 1.0, so that should solve your

[julia-users] Parent type of a parametric type

2016-08-16 Thread Cedric St-Jean
Hi, I'm writing a function to recursively traverse a heterogeneous tree of immutables and replace certain elements of it. So far I have: subst(x::Number, assoc::Associative) = x subst(x::Variable, assoc::Associative) = get(assoc, x, x) subst{T}(x::T, assoc::Associative) = T([subst(getfield(x,

[julia-users] Re: Symbols as Dict keys - efficiency / memory allocation?

2016-08-16 Thread Cedric St-Jean
Scott is right, storing/comparing/hashing symbols is probably all done on the pointers, so it's as efficient as you can hope for. On Tuesday, August 16, 2016 at 11:44:46 AM UTC-4, Oliver Schulz wrote: > > Hi, > > I was thinking of using Symbols as keys in a Dict{Symbol,Int64}, instead > of

Re: [julia-users] Re: Arrays of user defined types, indexing and copying.

2016-08-14 Thread Cedric St-Jean
ntly) did not read the manual and just overloaded the deepcopy > function. This introduced lots of nasty bugs. > > On Sunday, August 14, 2016 at 9:15:46 PM UTC+2, Cedric St-Jean wrote: >> >> AFAIK deepcopy should never be overloaded. From the docstring: >> >> While

Re: [julia-users] Re: Arrays of user defined types, indexing and copying.

2016-08-14 Thread Cedric St-Jean
x]. At least this > is my experience and how I understand deepcopy.jl. > > > On Sunday, August 14, 2016 at 8:31:20 PM UTC+2, Cedric St-Jean wrote: >> >> instead, it puts the same object (which is a copy) in the first and third >>> positions and you get the same be

[julia-users] Re: Arrays of user defined types, indexing and copying.

2016-08-14 Thread Cedric St-Jean
> > instead, it puts the same object (which is a copy) in the first and third > positions and you get the same behavior. Maybe this is not the intended > behavior of deepcopy? > It's intentional. deepcopy has to keep and update a dictionary as it traverses the datastructure in order to

Re: [julia-users] Re: "eval cannot be used in a generated function"

2016-08-13 Thread Cedric St-Jean
Naive suggestion: since you can eval inside the macro body (à la FastAnonymous), couldn't your generated function expand into a macro call? On Friday, August 12, 2016 at 12:19:49 PM UTC-4, Erik Schnetter wrote: > > On Fri, Aug 12, 2016 at 4:06 AM, Tomas Lycken > wrote: >

[julia-users] Re: ANN: Julia 0.5.0-rc2 now available

2016-08-13 Thread Cedric St-Jean
Langue changes: https://github.com/JuliaLang/julia/blob/master/NEWS.md On Saturday, August 13, 2016 at 7:51:39 AM UTC-4, Evan Fields wrote: > > Thanks Tony. Two questions, one related to Uwe's question: > > 1) I noticed earlier that 0.5.0-rc0 starts up much faster than 0.4.6 but > is a little

[julia-users] Re: Optimizing an if statement which is set once at runtime and then looped over.

2016-08-02 Thread Cedric St-Jean
I can't speak to Julia's branch prediction, but if you rewrite it as function f{x}(::Val{x}) ... ... end f(Val{True}) then the compiler will create two versions of f, one with the if and one without. Then you can @time the results and see if it makes a difference. On Tuesday, August 2, 2016

[julia-users] Re: [ANN] Nemo 0.5 released

2016-07-30 Thread Cedric St-Jean
What kind of reinforcement learning? If you're doing classical Q-learning for instance, a computer-algebra system will be of little help. You might be better off with the autodifferentiation packages. On Saturday, July 30, 2016 at 8:56:36 AM UTC-4, Marcus Appelros wrote: > > Is Nemo suitable

Re: [julia-users] What is a gc frame?

2016-07-24 Thread Cedric St-Jean
Yes, sorry, I'm sure the devil is in the details, otherwise it would have been done a long time ago... On Sunday, July 24, 2016 at 11:08:07 AM UTC-4, Yichao Yu wrote: > > On Sun, Jul 24, 2016 at 9:44 AM, Cedric St-Jean <cedric...@gmail.com > > wrote: > > Thank you

Re: [julia-users] What is a gc frame?

2016-07-24 Thread Cedric St-Jean
Thank you for the explanations. With that in mind, why is stack-allocating heap-object-containing immutables hard? Doesn't it boil down to inspecting the immutable type at compile-time to find the offset of the heap-allocated objects' pointers, and pushing those onto the GC frame? On Sunday,

[julia-users] Re: accessing an expression's global scope from macro

2016-07-21 Thread Cedric St-Jean
Neat macro. > For this though, my macro needs to somehow figure out that "inc" was also > defined with @self (since it shouldn't blindly add self as a first arg so > other non-@self'ed function calls). Is this possible in Julia? > You could have a global Set that would contain the names of

Re: [julia-users] Re: Possible bug: very slow module load after addprocs()

2016-07-20 Thread Cedric St-Jean
Empty; tic(); using PyPlot; toc() > elapsed time: 7.357315778 seconds > > > In any case, it can get pretty painful loading a few modules at the > beginning of my parallelized scripts... > > > > > On Tuesday, July 19, 2016 at 4:55:40 PM UTC+2, Cedric St-Jean wrote: >> &g

Re: [julia-users] Re: How can I find the common elements of two matrix(or arrays)?

2016-07-05 Thread Cedric St-Jean
In Julia, if speed isn't too important, this gives the same results: a, b = [-1,-2,-3], [-3,-4,-5,-2] inter = intersect(a, b) (Int[findfirst(a, x) for x in inter], Int[findfirst(b, x) for x in inter]) And it should be a good deal faster than the MATLABism. Other functions you might find useful:

[julia-users] Re: How can I find the common elements of two matrix(or arrays)?

2016-07-03 Thread Cedric St-Jean
Maybe I'm missing something, but doesn't find(Mat_a .== Mat_b) work as in Matlab? (Julia needs the dot before the ==) On Sunday, July 3, 2016 at 10:18:10 PM UTC-4, siyu song wrote: > > But intersect doesn't tell us the index of the elements in the > matrix(array), I think. > 在 2016年7月4日星期一

Re: [julia-users] Re: a compilation question

2016-07-03 Thread Cedric St-Jean
too. So B starts as > using A > > Can this kind of multiple `using` cause any issues? Does it, at least, add > more work to the compilation stage? > > > > > > On Saturday, July 2, 2016 at 3:18:04 AM UTC+1, Cedric St-Jean wrote: > >> I don't have a great solution to t

Re: [julia-users] Re: a compilation question

2016-07-02 Thread Cedric St-Jean
> > > On Saturday, July 2, 2016 at 3:18:04 AM UTC+1, Cedric St-Jean wrote: >> >> I don't have a great solution to this, but this is what I do... >> >> 1. I think that `reload("PackageName")` should work without workspace(). >> See http://docs.juli

[julia-users] Re: New Variational Bayes Topic Modeling Pkg

2016-07-02 Thread Cedric St-Jean
Impressive work, especially with the documentation! Have you benchmarked it against other implementations? On Saturday, July 2, 2016 at 12:32:13 AM UTC-4, esproff wrote: > > Hi all! > > So I have just released a new variational Bayes topic modeling package for > Julia, which can be found here:

[julia-users] Re: Pkg.test("ParallelAccelerator") failed

2016-07-01 Thread Cedric St-Jean
Iman, you should see if the issue is on their issues page https://github.com/IntelLabs/ParallelAccelerator.jl/issues and create a new issue if it isn't. On Friday, July 1, 2016 at 1:14:07 AM UTC-4, Tony Kelman wrote: > > Looks like they're missing a "using Compat" somewhere.

[julia-users] Re: a compilation question

2016-07-01 Thread Cedric St-Jean
I don't have a great solution to this, but this is what I do... 1. I think that `reload("PackageName")` should work without workspace(). See http://docs.julialang.org/en/release-0.4/manual/workflow-tips/ 2. I use `Autoreload.jl`. It's unfortunately not actively maintained, but it works well

Re: [julia-users] Re: JuliaCon birds of a feather

2016-06-20 Thread Cedric St-Jean
+1, definitely interested in some of those subjects On Sunday, June 19, 2016 at 11:29:06 PM UTC-4, Tom Breloff wrote: > > Time to dredge this topic up again! With JuliaCon only a couple days > away, I want to make sure we take advantage of getting people in the same > room to collaborate. I'm

[julia-users] Re: scope of do block, generalization to for block

2016-06-20 Thread Cedric St-Jean
I'm not sure why assignments are local, but I'd guess that it's for consistency. function foo(x, y) ... end is syntactic sugar for foo = (x,y)->..., and likewise do syntax is also sugar for creating a function and passing it as the first argument. Since function foo(x) a = x end does not

[julia-users] Re: "None" in Python and "nothing" in Julia for feature matching function

2016-06-18 Thread Cedric St-Jean
I don't have a solution to offer, unfortunately, but I will confirm that `nothing` gets auto-converted to `None`. I'd guess that the issue is elsewhere. You might be able to debug it further / code around the problem by writing a Python function that accepts the Julia arguments and passes them

Re: [julia-users] Re: Is passing a function as an argument discouraged?

2016-06-17 Thread Cedric St-Jean
> As in there should be no performance penalty at all in the vast majority of cases :) Any notable exception? On Friday, June 17, 2016 at 4:24:43 PM UTC-4, Stefan Karpinski wrote: > > As in there should be no performance penalty at all in the vast majority > of cases :) > > On Fri, Jun 17,

[julia-users] [ANN]: ScikitLearn.jl 0.1.0 released, now with Julia ecosystem support

2016-06-10 Thread Cedric St-Jean
I'm pleased to announce the first major relase of ScikitLearn.jl ! It now works with the following Julia models: *DecisionTree.jl * - DecisionTreeClassifier - DecisionTreeRegressor -

[julia-users] Re: Bimodal function evaluation time

2016-06-08 Thread Cedric St-Jean
On Wednesday, June 8, 2016 at 8:37:06 PM UTC-4, ABB wrote: > > These are very helpful comments - thank you very much. > > - I wasn't aware of that indexing scheme, but it does allocate much less > memory. Thanks a lot for the suggestion! > > - I'm not sure about exactly how to use rand! after

[julia-users] Re: Compose.jl animation

2016-06-08 Thread Cedric St-Jean
This may not satisfy your needs, but I do Compose.jl animations in IJulia with IJulia.clear_output. for i in 1:10 IJulia.clear_output(true) draw(SVGJS(100mm, 100mm), compose(context(0.001,0.001,1,1),circle(1,1, i/10))) sleep(1) end I believe that you could also do it at the REPL

[julia-users] Re: Bimodal function evaluation time

2016-06-08 Thread Cedric St-Jean
It seems that each time the GC is triggered (which is a function of how full each generation is - not something you normally control), it takes about 1.3 seconds to do a garbage collection cycle. With your problem set, it seems that the GC is triggered on every odd call to DM3, hence the

[julia-users] Re: A question about expressions

2016-06-05 Thread Cedric St-Jean
Technically, it's because k is not assigned to anything. Your for loop is quoted, which means that it's just an expression, not an actual for loop. The dollar-sign tells Julia to stop quoting and insert the result of the expression `vars[k]`, but k isn't defined, so you get an error. Compare:

Re: [julia-users] Function argument inlining

2016-06-02 Thread Cedric St-Jean
Thanks. Maybe it's time to upgrade... On Thursday, June 2, 2016 at 8:53:12 AM UTC-4, Yichao Yu wrote: > > On Thu, Jun 2, 2016 at 8:37 AM, Cedric St-Jean <cedric...@gmail.com > > wrote: > > I have two very similar functions that differ in only which function > they >

[julia-users] Function argument inlining

2016-06-02 Thread Cedric St-Jean
I have two very similar functions that differ in only which function they call function search_suspects_forward(...) ... searchsortedfirst(...) end function search_suspects_backward(...) ... searchsortedlast(...) end function foo() search_suspects_forward(...) end

[julia-users] Re: ANN: DC.jl - automagical linked plots in your IJulia Notebook

2016-06-02 Thread Cedric St-Jean
Looks great, thank you for this! On Thursday, June 2, 2016 at 12:28:07 AM UTC-4, Tim Wheeler wrote: > > Hello Julia Users, > > We are happy to announce DC.jl - a > package which gives you the power of DC.js > in your IJulia

Re: [julia-users] Re: Using Julia for real time astronomy

2016-06-02 Thread Cedric St-Jean
John: Common Lisp and Julia have a lot in common. I didn't mean to suggest writing your software in Lisp, I meant that if ITA was able to run a hugely popular website involving a complicated optimization problem without triggering the GC, then you can do the same in Julia. Like others have

[julia-users] Re: Using Julia for real time astronomy

2016-06-01 Thread Cedric St-Jean
Apparently, ITA Software (Orbitz) was written nearly entirely in Lisp, with 0 heap-allocation during runtime to have performance guarantees. It's pretty inspiring , in a I-crossed-the-Himalayas-barefoot kind of way. On Wednesday, June 1, 2016 at 5:59:15 PM

[julia-users] Re: Arithmetic with TypePar

2016-06-01 Thread Cedric St-Jean
I really doubt that it can be expressed this way, because Julia will do pattern matching/unification on the type of `bar`, and it would have to know that -1 is the inverse of +1 to unify D+1 with the type of the input array. Can you give more context about what you're trying to do? Why can't

Re: [julia-users] Imported modules are brought into Main

2016-05-29 Thread Cedric St-Jean
Thank you. On Sun, May 29, 2016 at 9:21 PM, Yichao Yu <yyc1...@gmail.com> wrote: > On Sun, May 29, 2016 at 8:44 PM, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > This is probably a conscious decision, but I was surprised that, for any > > modul

[julia-users] Imported modules are brought into Main

2016-05-29 Thread Cedric St-Jean
This is probably a conscious decision, but I was surprised that, for any module (eg. PyCall): module A import PyCall end PyCall # no error - PyCall was brought into Main whereas module A import PyCall end module B PyCall # error - PyCall not defined end Furthermore PyCall = 0 module

[julia-users] Re: DataFrame : aggregate with only on column possible ?

2016-05-28 Thread Cedric St-Jean
Does by(df, :a) do subdf subdf[indmax(subdf[:sum_max]), :] end work? I would suggest reading about the "Split-apply-combine" strategy, it's useful vocabulary for talking about these things, although some of it was quite confusing to me at first... On Saturday, May 28, 2016 at 3:25:31 AM

[julia-users] Re: DataFrame : aggregate with only on column possible ?

2016-05-27 Thread Cedric St-Jean
There are much more fearsome Dataframe wizards than I am on this forum, but I would use something like this: using RDatasets df = dataset("datasets", "iris") by(df, :PetalWidth) do subdf subdf[indmin(subdf[:SepalLength]), :] end although that's keeping the entries with the lowest sum, and

[julia-users] Re: how to use drawnow in Julia

2016-05-27 Thread Cedric St-Jean
I haven't heard of `drawnow`, but AFAIK the best solution for plotting animations is Plots.jl On Friday, May 27, 2016 at 4:20:17 PM UTC-4, new to Julia wrote: > > Hi all: > > In matlab, I can make a movie by simply using drawnow for all time k. I > want

[julia-users] Re: field name aliases

2016-05-27 Thread Cedric St-Jean
You would need dot overloading for that, which is scheduled for 0.6 , aka: planned, but don't hold your breath. I believe the general recommendation is to have accessor functions `get_x(f::Foo)` , `get_y(f::Foo)`, ideally with better names.

[julia-users] Re: Trouble with PyPlot

2016-05-25 Thread Cedric St-Jean
PyCall has had a few hiccups since last release, most of them have been fixed, but not tagged yet. You can try Pkg.checkout("PyCall") If the problem persists, please file an issue on PyCall.jl On Wednesday, May 25, 2016 at 8:36:04 AM UTC-4, Ed Scheinerman wrote: > > It seems, perhaps, that

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
need the `Foo.@mac` henceforth; you want to >> refer >> to Foo's (new) definition of `@mac`, not Main's stale definition of >> `@mac`. >> >> Because Foo might export types and you might have some object of the >> (old) >> types in your workspace, julia a

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
the >>> file with the macro definition and reload the module via include. However, >>> the next invocation of macroexpand from the REPL still uses the old >>> definition. >>> >>> The suggestion from Kaj Wiik to use the workspace() command seems to &

Re: [julia-users] Re: how to reload macro def

2016-05-24 Thread Cedric St-Jean
to the Julia manual > with a couple of sentences to explain this. > > -- Steve > > > On Tuesday, May 24, 2016 at 12:03:24 AM UTC-4, Cedric St-Jean wrote: >> >> Maybe you already know this, but macros are applied at parsing time (or >> right after parsing - not su

[julia-users] Re: how to reload macro def

2016-05-23 Thread Cedric St-Jean
Maybe you already know this, but macros are applied at parsing time (or right after parsing - not sure). This means that if you have # In Macro.jl macro macmac(x) ... end # In Fun.jl function foo(x) macmac(something) end Then whenever you've changed Macro.jl, you need to reload both

Re: [julia-users] Re: github missing Create Pull Request button

2016-05-23 Thread Cedric St-Jean
<lobing...@gmail.com> wrote: > Example? (i had today some intermediate github problems with connectivity > and functions) > > On Monday, May 23, 2016 at 7:06:44 PM UTC+2, Cedric St-Jean wrote: >> >> I'm up to my 15th pull request or so, and almost every time I

[julia-users] github missing Create Pull Request button

2016-05-23 Thread Cedric St-Jean
I'm up to my 15th pull request or so, and almost every time I do Pkg.submit("PackageName"), the opened webpage is missing the green "Create Pull Request" button. I have to refresh to make it appear, then I can go through, but today it just refuses to cooperate. I have googled the land far and

Re: [julia-users] Parametric constructor help

2016-05-18 Thread Cedric St-Jean
..@gmail.com> wrote: > On Wed, May 18, 2016 at 5:50 PM, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > Thank you for the answer, that clears up Base.call syntax. But let me > > reformulate my question. Given a parametric type > > > > type

Re: [julia-users] Parametric constructor help

2016-05-18 Thread Cedric St-Jean
since 1,2,... are not types. On Wednesday, May 18, 2016 at 4:22:48 PM UTC-4, Yichao Yu wrote: > > On Wed, May 18, 2016 at 4:03 PM, Cedric St-Jean <cedric...@gmail.com > > wrote: > > I'd like to define a LinearRegression type, where the coefficients can > be > > eit

[julia-users] Parametric constructor help

2016-05-18 Thread Cedric St-Jean
I'd like to define a LinearRegression type, where the coefficients can be either a vector, a matrix (for multi-output regression), or an array (if the user doesn't specify anything). How can I achieve that? I've tried these, on Julia 0.4.5 type LinearRegression{T, N} coefs::Array{T, N}

Re: [julia-users] Re: error in ijulia

2016-05-18 Thread Cedric St-Jean
Does it kill it at the REPL (not Jupyter) too? Normally I get more informative error messages over there. You can post an issue on Plots.jl On Wed, May 18, 2016 at 5:42 AM, Henri Girard wrote: > I have another problem : using Plots kills the kernel ? > So I can't verify

[julia-users] Re: error in ijulia

2016-05-17 Thread Cedric St-Jean
https://github.com/tbreloff/Plots.jl/issues/258 On Monday, May 16, 2016 at 5:27:48 AM UTC-4, Henri Girard wrote: > > Hi, > If I use this plot in terminal julia it works fine, but in IJulia it does > an error. > Any help > Thanks > HG > > using Plots > pyplot(reuse=true) > x=y=linspace(-5,5,30)

[julia-users] Re: Julia Utopia: Share your tips and tricks to efficient coding in Julia

2016-05-14 Thread Cedric St-Jean
Jupyter has completely changed my workflow in Python and Julia. I've got my notebooks numbered 01_Planning_Invasion, 02_Moving_the_Troops, etc. I write most of my code inside the notebook interactively, then if it's good enough, it gets promoted to a .jl file. It takes about a week to complete

Re: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-11 Thread Cedric St-Jean
On Wednesday, May 11, 2016 at 8:09:50 AM UTC-4, Yichao Yu wrote: > > On Wed, May 11, 2016 at 8:01 AM, Cedric St-Jean <cedric...@gmail.com > > wrote: > > Tim, > > > > Isn't there an inefficiency here though? If my immutable had thirty > fields > > and I

Re: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-11 Thread Cedric St-Jean
id out contiguous in memory? > > It seems sort of odd that the type is immutable yet I can overwrite data > of > > that type. I suppose that would only be prohibited if the array were > > immutable. > > > > Thanks for the tip about using Type to get the zero to work

Re: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Cedric St-Jean
> It seems sort of odd that the type is immutable yet I can overwrite data of that type. I suppose that would only be prohibited if the array were immutable. It's not the array that's immutable, it's the values contained therein. I agree that it's a bit weird to have to replace the whole

[julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Cedric St-Jean
"normal" types are by definition heap-allocated, and are always manipulated them through pointers. What you want is immutables immutable Stuff a::Int b::Int end # Also, for zeros to work, function

[julia-users] Re: Newbie Question: Command Line Woes

2016-05-09 Thread Cedric St-Jean
hello.jl defines the hello() function, but you need to call it to get some output. For instance, function hello() println("Hello World") return end hello() hello() will print "Hello World" twice. On Monday, May 9, 2016 at 10:59:05 PM UTC-4, rich2...@gmail.com wrote: > > Newbie

[julia-users] Re: How should I store map with objects.

2016-05-08 Thread Cedric St-Jean
On Saturday, May 7, 2016 at 2:59:08 AM UTC-4, Ford Ox wrote: > > I want to do small simulation (similiar to games) where I have multiple > objects that can move and spawn at map. What is the most efficient way to > do that? > It depends on how many objects you have and the size of your grid.

Re: [julia-users] Perhaps stupid question: Method type stability and throws

2016-05-07 Thread Cedric St-Jean
On Sat, May 7, 2016 at 2:19 PM, Yichao Yu <yyc1...@gmail.com> wrote: > On Sat, May 7, 2016 at 1:21 PM, Cedric St-Jean <cedric.stj...@gmail.com> > wrote: > > Thank you for the detailed explanation! > > > > Would it make sense to run the catch blocks/finalizers b

Re: [julia-users] Perhaps stupid question: Method type stability and throws

2016-05-07 Thread Cedric St-Jean
ce regular control flow is resumed, or collected if no handler was found. I was wondering how Common Lisp was able to provide restarts, this seems like a reasonable implementation strategy. On Saturday, May 7, 2016 at 10:28:18 AM UTC-4, Yichao Yu wrote: > > On Sat, May 7, 2016 at 8:46 AM, Cedric

Re: [julia-users] Perhaps stupid question: Method type stability and throws

2016-05-07 Thread Cedric St-Jean
> mostly due to various technical reason Could you please go into those? I'd like to understand why unwinding the stack is costlier than returning from a function. On Saturday, May 7, 2016 at 8:38:03 AM UTC-4, Yichao Yu wrote: > > On Sat, May 7, 2016 at 6:58 AM, Ben Ward

  1   2   3   >