Re: [julia-users] different package name but same module name (example: forking a package)

2014-03-09 Thread Mauro
Thanks, Ben for asking, thanks, Kevin for clarifying. One related thing which I'm a bit unclear on is the difference between `require` and `include`. include pastes the code of the file into that place whereas require loads it. this seems similar, probably equivalent sometimes but not quite the

Re: [julia-users] different package name but same module name (example: forking a package)

2014-03-09 Thread Jameson Nash
The primary difference is the search path: `include` searches relative to the current file, whereas `require` searches relative to the user installation (also `require` is implemented with `include`) On Sun, Mar 9, 2014 at 8:24 AM, Mauro mauro...@runbox.com wrote: Thanks, Ben for asking,

[julia-users] clesing a file descriptor

2014-03-09 Thread harven
Hi, I saw the following code in a blog recently. const mydata = /home/something.csv | open | readall | s - split(s, \n) | a - map(l - split(l, ,), a) It seems that there is a file descriptor left open here, Am I right? Is there some way to close it

Re: [julia-users] Re: [ANN] Two packages: Lazy.jl Mathematica.jl

2014-03-09 Thread Mike Innes
I haven't done any real benchmarks but I imagine custom iterator types are still much faster than generators, given that they're essentially zero overhead. Lazy sequences aren't exactly speed demons either - they're basically just closures, which are a known sore spot for performance in Julia.

[julia-users] Learning git(hub)?

2014-03-09 Thread Andreas Lobinger

Re: [julia-users] Re: [ANN] Two packages: Lazy.jl Mathematica.jl

2014-03-09 Thread Mike Innes
I'm sorry if that came off as though it was targeted at you - I meant to a general statement about the philosophy of having zero duplication. Of course, you're right, duplication has a cost too, and it doesn't work to just throw everything together either, so like everything else in life it's

Re: [julia-users] how to undefine variable in composite types

2014-03-09 Thread andrew cooke
there's also nothing (type Nothing) which seems to be used something like void for return types and to indicate that optional parameters are not set. https://github.com/JuliaLang/julia/issues/1134 discusses Maybe and why it's not implemented as Union(X, Nothing) and there's also the type

[julia-users] clesing a file descriptor

2014-03-09 Thread Kevin Squire
Right before garbage collection, a finalizer function is called, which will properly close the file. It will remain open until then. See also https://groups.google.com/forum/m/#!topic/julia-dev/B3g6lLViOjo, and the documentation of finalizer here:

Re: [julia-users] catch syntax errors in eval(Expr)

2014-03-09 Thread Laszlo Hars
I'm not sure why you need eval to catch syntax errors Explained in the first post. (A clipboard link between MS Word and the Julia console.) global variables are almost always a terrible idea I wrote these look terrible. I am glad, you agree. all exceptions can be caught (and examined) in a

Re: [julia-users] how to undefine variable in composite types

2014-03-09 Thread Stefan Karpinski
Philosophically, undefined is not a first-class value in Julia like null is in Java. You cannot assign it to things or pass it around. If you try to access something that's undefined, it's an immediate error. This means that when you access a location of type Foo in an array or a field you will

Re: [julia-users] how to undefine variable in composite types

2014-03-09 Thread Isaiah Norton
See also this previous discussion for an example of using self-reference instead of null: https://groups.google.com/d/msg/julia-users/sv5UpxA79zQ/ot-9goKR554J (I think the full code mentioned there is now in: https://github.com/JuliaLang/DataStructures.jl/blob/master/src/deque.jl) On Sun, Mar

[julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Hi, I'm new to the Julia language, and I'm now trying the Julia C API in order to call Julia functions from Python. I've become successful with calling some basic Julia functions such as (*) and sqrt() and converting the returned values to corresponding ones in Python. But I've got into a

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Stefan Karpinski
There is a unique instance of the Nothing type called `nothing`. In C, `jl_nothing` is a pointer to that value. Since the instance is unique, you can just check pointer equality: `v == jl_nothing`. The reason you get a linking error for jl_is_null is that it is a macro: src/julia.h 490:#define

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Stefan Karpinski
+1e99 to using starting with Jake's pyjulia instead of duplicating this effort. It's much better for there to be one really great way to call Julia from Python than many less good ways. That said, I've felt for some time that this functionality really needs an owner – someone to turn it into a

[julia-users] Cairo build error

2014-03-09 Thread Laszlo Hars
When installing Cairo I got this error: ~~~ ERROR: i not defined in next at env.jl:127 in merge! at dict.jl:77 while loading ...\.julia\Cairo\deps\build.jl, in expression starting on line 225 ~~~ build.jl is only 130 lines long, so something does not add up. Does anyone know a simple fix?

Re: [julia-users] Can't figure out why Julia code takes 2x time of identical Python

2014-03-09 Thread Jack Poulson
On Tuesday, December 24, 2013 7:55:23 PM UTC-5, Ivar Nesje wrote: There is a SubArray implementation, sub(), but it has some performance issues related to indexing that should be fixed before it becomes default for slicing. For small arrays I would guess that hardcoded multiplication is

Re: [julia-users] Can't figure out why Julia code takes 2x time of identical Python

2014-03-09 Thread Milan Bouchet-Valat
Le dimanche 09 mars 2014 à 11:39 -0700, Jack Poulson a écrit : On Tuesday, December 24, 2013 7:55:23 PM UTC-5, Ivar Nesje wrote: There is a SubArray implementation, sub(), but it has some performance issues related to indexing that should be fixed before it becomes

Re: [julia-users] Can't figure out why Julia code takes 2x time of identical Python

2014-03-09 Thread Jack Poulson
On Sunday, March 9, 2014 3:08:53 PM UTC-4, Milan Bouchet-Valat wrote: Le dimanche 09 mars 2014 à 11:39 -0700, Jack Poulson a écrit : On Tuesday, December 24, 2013 7:55:23 PM UTC-5, Ivar Nesje wrote: There is a SubArray implementation, sub(), but it has some performance

Re: [julia-users] Can't figure out why Julia code takes 2x time of identical Python

2014-03-09 Thread Stefan Karpinski
That pull request is unfortunately not quite ready to go into the 0.3 release candidate. It will definitely go into 0.4, however. On Sun, Mar 9, 2014 at 3:25 PM, Ivar Nesje iva...@gmail.com wrote: I think you can just do `Pkg.add(ArrayViews)` to get the new functionality. The change in Base

Re: [julia-users] catch syntax errors in eval(Expr)

2014-03-09 Thread Laszlo Hars
...a couple of examples, why eval(quote...end) is better than eval(parse(...)): ~~~ julia eval(parse(x=1 x+1)) # - ERROR: extra token after end of expression # in parse at string.jl:1219 julia eval(quote x=1 x+1 end) # - 2 ~~~ julia eval(parse(a = \ab \cd\ \)) # need to escape inside quote

Re: [julia-users] catch syntax errors in eval(Expr)

2014-03-09 Thread Stefan Karpinski
The former seems to be a bug in parse causing it to raise an error even when the raise option is false. I've opened an issue: https://github.com/JuliaLang/julia/issues/6089. On Sun, Mar 9, 2014 at 3:55 PM, Laszlo Hars laszloh...@gmail.com wrote: ...a couple of examples, why eval(quote...end)

[julia-users] Re: inserting javascript driven graphs in ijulia

2014-03-09 Thread Keith Campbell
@jverzani's GoogleCharts.jl at https://github.com/jverzani/GoogleCharts.jl might have some ideas for you. On Sunday, March 9, 2014 7:42:24 AM UTC-4, Jon Norberg wrote: What is the best way to display graphics driven by javascript in IJulia? For example these two:

[julia-users] intersecting sets is slow

2014-03-09 Thread harven
Intersecting two sets seems to be very slow. As a test case, I take a wordlist and find the words whose reversals are again in the list (e.g. desserts and stressed). julia dict = Set{UTF8String}(map!(chomp, open(readlines, wordlist))) ; length(dict) 651357 julia @time result = intersect(dict,

[julia-users] Re: intersecting sets is slow

2014-03-09 Thread andrew cooke
just looking at the code: the set intersection creates a copy of the first set and then deletes entries not in subsequent sets. in your case, it is presumably deleting almost everything. the set is implemented using a dictionary. the dictionary rehashes whenever it's less than 1/4 full.

[julia-users] Re: intersecting sets is slow

2014-03-09 Thread andrew cooke
sorry, i think i must be missing something, because when i try the opposite algorithm (build up instead of tear down) it also appears to be slow. certainly not 7 seconds. andrew On Sunday, 9 March 2014 21:48:48 UTC-3, andrew cooke wrote: just looking at the code: the set intersection

[julia-users] Julia does not show the exact line of the error

2014-03-09 Thread Freddy Chua
I noticed that when I have a while loop and the bug occurs somewhere within the while look, the Julia interpreter does not show the exact location of where the error occurred. I do think that this is definitely a missing feature, and hope the developers of Julia implement this feature soon.

[julia-users] Re: Julia does not show the exact line of the error

2014-03-09 Thread andrew cooke
this is a known and very frustrating issue. i can't find the git issue now, but it was something to do with some dependency (like llvm or similar) that will be fixed at some point. andrew On Sunday, 9 March 2014 22:05:00 UTC-3, Freddy Chua wrote: I noticed that when I have a while loop and

Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Thank you for your reply. I know that pyjulia exists, but I didn't try it. The core idea of pyjulia seems to be incorporated into IJulia, but they does not share the source code. I'm going to investigate the functionality of PyCall.jl. Thanks again! On Monday, March 10, 2014 2:05:42 AM UTC+9,

[julia-users] Trouble getting Sundials.jl to work

2014-03-09 Thread Thomas Moore
I'm trying to get Sundials.jl to work on Ubuntu 12.04. But I'm having some trouble. To be as clear as possible, I'll describe what I've done so far: I downloaded sundials-2.5.0.tar.gz from the Sundials websitehttp://computation.llnl.gov/casc/sundials/download/download.html, and ran the

[julia-users] [ANN] Docopt.jl - a new port of docopt in Julia

2014-03-09 Thread Kenta Sato
Hi, A few days ago, I released a new port of docopt written in Julia. This is my first package written in Julia, so the code can contain some bad practice. The package is currently not registered as an official package, but available from my repository

Re: [julia-users] Problem with Distributions - sampling a multinomial distribution

2014-03-09 Thread Gustavo Lacerda
I'm getting the same error, when calling 'rand' on a Binomial: d = Binomial(1,tr.pi[k]) tr.z[k,:] = rand(d, N) ERROR: error compiling rand: could not load module libRmath-julia: dlopen(libRmath-julia.dylib, 1): image not found in rand! at