Re: [julia-users] sub-ranges within CartesianRange

2016-02-14 Thread Greg Plowman
On Saturday, February 13, 2016 at 1:57:11 AM UTC+11, Stefan Karpinski wrote: > > I'm kind of curious what the use case is. How are you using > CartesianRanges? > > I want parallelise a simulation iterating over a CartesianRange. This entails partitioning the CartesianRange into sub-ranges and cal

Re: [julia-users] sub-ranges within CartesianRange

2016-02-14 Thread Greg Plowman
Thanks for your reply Tim. Are x and y offsets with respect to the "parent" range cr? > > If so, you can achieve this with a 1-liner, > > CartesianRange(cr.start+x-1, cr.start+y-1) > No, not "Cartesian" offsets, but "linear" offsets transformed to Cartesian equivalent. That's why I think

[julia-users] Re: sub-ranges within CartesianRange

2016-02-14 Thread Greg Plowman
I created a type that I think more or less works: immutable CartesianSubRange{I<:CartesianIndex} range::CartesianRange{I} start::I stop::I done::I # one past stop function CartesianSubRange(range::CartesianRange{I}, start::I, stop::I) item, done = next(range, stop)

Re: [julia-users] Adding a mtrix to the third dimension of a multi-dimensional array

2016-02-14 Thread Dan
>From the help for `cat`: cat(dims, A...) Concatenate the input arrays along the specified dimensions in the iterable dims And indeed, if size(M1)=(3,3,3) and size(M2)=(3,3) Then, size(cat(3,M1,M2)) = (3,3,4) This method may not be efficient (though in terms of memory layou

Re: [julia-users] Strange failure running test/unicode/utf8code.jl

2016-02-14 Thread Mauro
Reported here https://github.com/JuliaLang/julia/issues/15072 On Sat, 2016-02-13 at 22:33, Scott Jones wrote: > I'm seeing a very strange failure recently (within the last week), where > running "test/runtests.jl" seems to pass, but running the individual test > shows > a very different result.

[julia-users] Re: convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread David van Leeuwen
Hello, You can use any convention you'd like. A more type-stable solution is to use, e.g., the value `-1` for `something`, but you don't think that is elegant. There is `nothing` (of type Void) but I am not sure that the intended use of that is to use as a default in function prototypes. -

Re: [julia-users] sub-ranges within CartesianRange

2016-02-14 Thread Tim Holy
On Sunday, February 14, 2016 12:55:42 AM Greg Plowman wrote: > No, not "Cartesian" offsets, but "linear" offsets transformed to Cartesian > equivalent. > That's why I think I need the dimensions of the parent range. You can't do that in general with a cartesian iterator using Julia's for-loop syn

Re: [julia-users] sub-ranges within CartesianRange

2016-02-14 Thread Tim Holy
The docs on SharedArrays give an example where you partition just over one axis (e.g., the 3rd axis). That's easy and tends to work well in many applications. Best, --Tim On Sunday, February 14, 2016 12:38:55 AM Greg Plowman wrote: > On Saturday, February 13, 2016 at 1:57:11 AM UTC+11, Stefan K

Re: [julia-users] Re: sub-ranges within CartesianRange

2016-02-14 Thread Tim Holy
Ah, now I get what you're trying to do. Glad you figured it out! Best, --Tim On Sunday, February 14, 2016 01:01:07 AM Greg Plowman wrote: > I created a type that I think more or less works: > > immutable CartesianSubRange{I<:CartesianIndex} > range::CartesianRange{I} > start::I > sto

[julia-users] convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread Simon Danisch
Why not typemax(Int)? That's also equivalent to all rows, has the same type and you don't need to treat it in a special way...

Re: [julia-users] convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread Tamas Papp
Thas could work. But consider the signature function parse_file(io; max_rows=something, sizehint=something) # ... end where the intention is that if sizehint is given, then use it, otherwise not. For this typemax(Int) would not be a good choice. Common Lisp allows a variable for checking if ke

Re: [julia-users] Re: convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread Tamas Papp
Thanks, I will experiment with nothing and false and see what I like best. In many languages false is a good choice, for forms like max && (count < max) but in Julia this doesn't work, as Ints cannot be used in place of booleans (which is fine and a sane design choice). Maybe I misunderstand typ

Re: [julia-users] convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread Milan Bouchet-Valat
Le dimanche 14 février 2016 à 07:31 +0100, Tamas Papp a écrit : > Hi, > > Suppose I have a function which reads rows from a file, with an > argument > max_rows, which would limit the number of rows read, eg > > function parse_file(io; max_rows=something) >   row_count = 0 >   while !eof(io) (max_

Re: [julia-users] Googling the functions I need in Julia is hard

2016-02-14 Thread cormullion
On Saturday, February 13, 2016 at 1:02:50 PM UTC, Stefan Karpinski wrote: > > Improvements are welcomed. Hey Stefan. Here's my suggestion: Until the Grand Overarching Documentation system is available, you could do worse than a custom Google search engine. This lets you add a few selected site

Re: [julia-users] convention for unspecified argument (R's NULL and FALSE, Common Lisp nil)

2016-02-14 Thread Cedric St-Jean
To guarantee type stability, I sometimes use dynamic dispatch function parse_file(io; max_rows=nothing) row_count = 0 should_stop(rc, mr::Void) = false should_stop(rc, mr::Int) = row_count >= max_rows while !eof(io) && !should_stop(row_count, max_rows) row_count += 1 row = readline

Re: [julia-users] Googling the functions I need in Julia is hard

2016-02-14 Thread Stefan Karpinski
Seems like a good idea. Thanks for looking into that. On Sun, Feb 14, 2016 at 12:44 PM, wrote: > On Saturday, February 13, 2016 at 1:02:50 PM UTC, Stefan Karpinski wrote: >> >> Improvements are welcomed. > > > Hey Stefan. Here's my suggestion: > > Until the Grand Overarching Documentation system

[julia-users] Weird Hygiene Issue

2016-02-14 Thread Julia Tylors
Hi fellows, I was coding a macro, and I am having a prefix issue with functions. basically the problem is: Every single one of available functions (_ex_func) which i want to be globally accessible are prefixed with the name of the module(X) in which the macro f is defined Here is the code

[julia-users] Re: Error with Julia + Juno IDE bundle installation on Windows 10

2016-02-14 Thread Mike Kipling
Lutfullah, The DOS command window created from the command `Julia: open a new terminal repl` shows that the Julia version is 0.3.10, not the latest version 0.4.3 After issuing the Pkg.update() command I get the following error: julia> Pkg.update() INFO: Updating METADATA... ERROR: chdir METAD

[julia-users] Re: Error with Julia + Juno IDE bundle installation on Windows 10

2016-02-14 Thread Lutfullah Tomak
Did you download from junolab.org? The latest verison(1.1.0) is at https://junolab.s3.amazonaws.com/release/1.1.0/juno-windows-x64.zip from julialang.org/downloads . It is bundled with all the required packages and julia 0.4.3 . Your downloaded Juno version seems old and it was not bundled wi

[julia-users] Weird Hygiene Issue

2016-02-14 Thread Lutfullah Tomak
Instead of @eval @f ex_func this eval(Main, @f ex_func) might do that. I cannot test what you do with julia 0.5 because functions are now very diferent internally. @eval @f ex_func will be X.eval(@f ex_func) thus there will be X namespace but not outside of the module as shown

[julia-users] Re: Weird Hygiene Issue

2016-02-14 Thread Julia Tylors
That is no solution to my problem, what if I want to do this module Y using X function _ex_func() println("Y module st") end _1ex_func()# this won't call Y._ex_func() end and i can't keep generating the functions for every module. It would be tedious. may be an AST node for m

[julia-users] Re: Weird Hygiene Issue

2016-02-14 Thread Lutfullah Tomak
It seems impossible then. What if _1ex_func has a fuction argument then you can pass _ex_func to _1ex_func or module as an argument and you call _ex_func from provided module?

[julia-users] Re: Weird Hygiene Issue

2016-02-14 Thread Julia Tylors
It should be possible, because i am doing it non-generated functions. this problem only occurs when i try to generate the function via a macro. On Sunday, February 14, 2016 at 2:39:35 PM UTC-8, Lutfullah Tomak wrote: > > It seems impossible then. What if _1ex_func has a fuction argument then > y

[julia-users] Re: Weird Hygiene Issue

2016-02-14 Thread Lutfullah Tomak
Ok. If it helps there is current_module() that may help get arbitrary module you are calling _1ex_func from. if ex_func is in that module you can know which module ex_func is defined.

[julia-users] ANN: CppWrapper C++ wrapping package

2016-02-14 Thread Bart Janssens
Hi all, The CppWrapper package is meant to facilitate exposing C++ libraries to Julia, allowing library authors to write the wrapping code in C++ and import to Julia using a one-liner. I think I have now added most of the basic features needed to produce simple type wrappings. The detailed des