Re: [julia-users] "pass" a function to a module

2014-03-28 Thread andreas
Thanks again for the inputs! It let me to the following solution: ## --- module mymodule function make_foo(f::Function) !method_exists(f, (Real,)) ? error("provide function with 'Real' argument.") : nothing ## create new methods foo(x::Real) = f(x::Real) function foo(x

[julia-users] Process called via 'run' does not always terminate

2014-03-28 Thread Joosep Pata
Hi, I’m running various external processes via ‘run(cmd)’, but strangely, occasionally ‘run’ seems to hang despite the external program finishing. It does not seem to be entirely predictable, but it’s quite persistent, and I don’t have a good test case yet. I was wondering if someone had an ide

[julia-users] Re: Managing objects and state

2014-03-28 Thread James Fairbanks
If you want to use julia functions like OOP methods just make the first argument the object instance so function setx!(s::State, i::int) #modifies s, so we use "!" in function name s.x = i end function squarex(s::State) return s.x^2 end #main code s = State() setx!(s,2) #s.x == 2 y

[julia-users] "using " scope within a module

2014-03-28 Thread RecentConvert
What is the scope of a module loaded within another module? I ask because while I was examining the workings of the DataFrames module I noticed it had duplicate calls of the Stats module. DataFrames.jl # Note that the two calls to using Stats in this file are # strictly required: one pulls th

Re: [julia-users] "using " scope within a module

2014-03-28 Thread John Myles White
The first call is executed in Main since the DataFrames module hasn't started yet. The second loads names so that DataFrames can use those functions internally. This is not a pattern I'd encourage since it doesn't load names into the caller's namespace: it always loads them into Main. -- John

Re: [julia-users] Re: slow while loop

2014-03-28 Thread Stefan Karpinski
Both way of writing a while loop should be the same. If you're seeing a difference, something else is going on. I'm not able to reproduce this: function f1() j = k = 1 while k <= 10^8 j += k & 1 k += 1 end return j end function f2() j = k = 1 while true k <= 10^8 || break

Re: [julia-users] Referencing function scope variables from @async blocks

2014-03-28 Thread Collin Glass
Interesting thread. What should one use to have a chunk of asynchronous code that does not localize variables? On Saturday, July 20, 2013 4:23:21 AM UTC-4, Amit Murthy wrote: > > My understanding is that "let" blocks only localize variables explicitly > specified on the first line, while @async

Re: [julia-users] Re: slow while loop

2014-03-28 Thread John Myles White
On my system, the two functions produce different LLVM IR: julia> code_llvm(f1, ()) define i64 @julia_f115727() { top: %0 = call i64 @julia_power_by_squaring1373(i64 10, i64 8), !dbg !726 %1 = icmp slt i64 %0, 1, !dbg !726 br i1 %1, label %L2, label %if, !dbg !726 if:

[julia-users] Re: help compiling julia on new MacBookPro

2014-03-28 Thread Ivar Nesje
You got the same error as in https://github.com/JuliaLang/julia/issues/6272. Presumably the error is fixed in the release candidate for OpenBlas. Ivar kl. 17:55:11 UTC+1 fredag 28. mars 2014 skrev Ethan Anderes følgende: > > Anyone have problems compiling julia from source on new MacBookPros? I

Re: [julia-users] Process called via 'run' does not always terminate

2014-03-28 Thread Stefan Karpinski
What system are you on? On Fri, Mar 28, 2014 at 8:11 AM, Joosep Pata wrote: > Hi, > > I’m running various external processes via ‘run(cmd)’, but strangely, > occasionally ‘run’ seems to hang despite the external program finishing. It > does not seem to be entirely predictable, but it’s quite pe

[julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Ethan Anderes
Anyone have problems compiling julia from source on new MacBookPros? I did everything the same as on my previous computers and I can't get it to compile. Unfortunately, I don't know how to interpret the errors I'm getting. Here is some of it: Makefile:129: *** OpenBLAS: Detecting CPU failed. P

[julia-users] How to share state between functions

2014-03-28 Thread David P. Sanders
Hi, I often need to share state (a collection of modificable variables) between functions. In Python and C++, I would do this by putting everything inside a class, and the class variables (attributes) would act as "pseudo-global" variables (an excellent description that a student in one of my

[julia-users] Re: help compiling julia on new MacBookPro

2014-03-28 Thread Ethan Anderes
Thanks a ton. That did the trick. To summaryize for those who have similar problems: I created a file Make.user in the directory julia/ then added the line OPENBLAS_VER = v0.2.9.rc2

[julia-users] PySide questions

2014-03-28 Thread Samuele Carcagno
A few more PySide.jl questions. I haven't been able to figure out the following conversions from Python: self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint) below is my failed attempt: rbw[:setWindow

Re: [julia-users] Re: slow while loop

2014-03-28 Thread John Myles White
Yeah, that's true. I didn't read the IR carefully enough. Laszlo, are you on the latest Julia? I worry that it's hard to make comparisons if you're running an older version of Julia. -- John On Mar 28, 2014, at 8:18 AM, Stefan Karpinski wrote: > Perhaps I should have said "isomorphic" – the

[julia-users] Re: help compiling julia on new MacBookPro

2014-03-28 Thread Ivar Nesje
Just remember to change it back when Julia updates its OPENBLAS version, so that you don't stay with a rc2 build forever. Ivar kl. 18:51:33 UTC+1 fredag 28. mars 2014 skrev Ethan Anderes følgende: > > Thanks a ton. That did the trick. > > To summaryize for those who have similar problems: I cre

Re: [julia-users] Re: slow while loop

2014-03-28 Thread Stefan Karpinski
Perhaps I should have said "isomorphic" – the only differences there are names. It's more obvious that the native code is the same – only the source line annotations are different at all. On Fri, Mar 28, 2014 at 11:16 AM, John Myles White wrote: > On my system, the two functions produce differe

Re: [julia-users] How to share state between functions

2014-03-28 Thread Stefan Karpinski
That seems like a reasonable way to do it. On Fri, Mar 28, 2014 at 1:36 PM, David P. Sanders wrote: > Hi, > > I often need to share state (a collection of modificable variables) > between functions. > In Python and C++, I would do this by putting everything inside a class, > and the class variab

Re: [julia-users] Re: slow while loop

2014-03-28 Thread Stefan Karpinski
Either way, one thing is quite unfortunate about this code. The compilation process isn't able to figure out that 10^8 is a constant so it recomputes it on every loop iteration. We really need a way to annotate functions as being pure in the very specific sense that the compiler is free to evaluate

Re: [julia-users] slow while loop

2014-03-28 Thread Laszlo Hars
On Friday, March 28, 2014 1:14:29 AM UTC-4, John Myles White wrote: > > Try this: > > function main() > j = k = 1 > t1 = @elapsed while k <= 10^8 >j += k & 1 >k += 1 > end > > j = k = 1 > t2 = @elapsed while true >

[julia-users] Re: slow while loop

2014-03-28 Thread Laszlo Hars
Thanks, John, for your replies. In my system your code gives reliable results, too, if we increase the loop limits to 10^9: julia> mean(t1s ./ t2s) 11.924373323658703 This 12% makes a significant difference in my function of nested loops (could add up to a factor of 2 slow down). So, the questi

[julia-users] Re: PySide questions

2014-03-28 Thread j verzani
Hi, here is one way to address the setting of flags (though misnamed): qt_enum(attr::Vector{ASCIIString}; how="|") = PyCall.pyeval(join(map(u -> "QtCore.Qt.$u", attr), " $how ")) Basically, it calls "|" at the python level. Maybe there is a better alternative. As for NonModal, look at the une

[julia-users] Re: help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Hi everyone, I get a different error on a 2012 Macbook Air with OS X 10.9.2 (I didn't want to start a new thread.) The error message I get after a git clone is: Submodule 'deps/Rmath' (git://github.com/JuliaLang/Rmath.git) registered for path 'deps/Rmath' Submodule 'deps/libuv' (git://github.co

Re: [julia-users] Re: slow while loop

2014-03-28 Thread Laszlo Hars
Thank you guys. I couldn't imagine how many things could go wrong in a computation session, under Windows. I rebooted my PC, and now the benchmarks run 3 times faster (!), and I see no real differences in the cases, except in the global context. I agree that annotating "pure" functions could be ve

Re: [julia-users] Process called via 'run' does not always terminate

2014-03-28 Thread Joosep Pata
Thanks for the reply. >> What system are you on? > julia> versioninfo() > Julia Version 0.3.0-prerelease+2177 > Commit 7d475bf* (2014-03-27 01:39 UTC) > Platform Info: > System: Darwin (x86_64-apple-darwin13.1.0) > CPU: Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz > WORD_SIZE: 64 > BLAS: libop

[julia-users] Simplest web client on Windows 7

2014-03-28 Thread Jacques Rioux
I have tried a number of packages (on a couple of machines) to build a simple Web client in Julia on Windows 7. Every single package I tried to install or used had a problem installing some supporting library or failed otherwise. So rather than ask for help in debugging my issues on a package that

[julia-users] Re: help compiling julia on new MacBookPro

2014-03-28 Thread Ivar Nesje
That is really strange, `deps/random` is a directory that is checked into the git repository and should be there. Do you have a directory named `deps/random` in your repository? Also, you do not include your `make` command, and possible customizations. If you use the -j 4 option, the output mig

Re: [julia-users] Re: slow while loop

2014-03-28 Thread Ivar Nesje
You can use let scopes, but I'm not completely sure I understand how they work, but someone will correct me if this is wrong. let stat_var = [1:10] global f function f(a) return a*stat_var end end Ivar kl. 20:27:08 UTC+1 fredag 28. mars 2014 skrev Laszlo Hars følgende: > > T

Re: [julia-users] current status of specialisation on function valued args

2014-03-28 Thread andrew cooke
thanks! (for the clarification, and in advance for the work ;o) On Thursday, 27 March 2014 10:32:03 UTC-3, Stefan Karpinski wrote: > > It has not, I'm afraid. We do need to do something about it though. > > On Wed, Mar 26, 2014 at 9:53 PM, andrew cooke > > wrote: > >> >> hi, >> >> did this - >

[julia-users] Re: Simplest web client on Windows 7

2014-03-28 Thread Iain Dunning
Can you please open issues for the errors? We spent considerable effort ~2 months ago getting everything work on Windows so its a shame to hear they no longer work... On Friday, March 28, 2014 4:38:28 PM UTC-4, Jacques Rioux wrote: > > I have tried a number of packages (on a couple of machines)

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
The directory is there and `ls deps/random` has the following output dSFMT.c.patch dsfmt-2.2.tar.gz randmtzig.c dSFMT.h.patch jl_random.c I didn’t have any customizations. I just issued a standard `make` command. On Mar 28, 2014, at 4:43 PM, Ivar Nesje wrote: > That is really strang

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Ivar Nesje
Strange. Just for clarity, can you post the full output of the following commands in a gist (or somewhere similar so that we don't clutter the thread with several hundred lines of mostly irrelevant text)? cd ~ git clone https://github.com/JuliaLang/julia.git julia-test

Re: [julia-users] Re: PySide questions

2014-03-28 Thread Samuele Carcagno
many thanks for the help! qt_enum(attr::Vector{ASCIIString}; how="|") = PyCall.pyeval(join(map(u -> "QtCore.Qt.$u", attr), " $how ")) Basically, it calls "|" at the python level. Maybe there is a better alternative. I struggled to understand it at first, but then found an example on the PySi

Re: [julia-users] Re: PySide questions

2014-03-28 Thread Samuele Carcagno
I would think you can put the GUI in a while(true) type loop so that it doesn't close immediately. There should be nicer way though. found a workaround using `wait()` qnew_class("mwin", "QtGui.QMainWindow") ## QtGui -- not just Qt. w = qnew_class_instance("mwin") qset_method(w, :closeEvent)

[julia-users] Re: Simplest web client on Windows 7

2014-03-28 Thread Jacques Rioux
On Friday, March 28, 2014 4:38:28 PM UTC-4, Jacques Rioux wrote: > > I have tried a number of packages (on a couple of machines) to build a > simple Web client in Julia on Windows 7. Every single package I tried to > install or used had a problem installing some supporting library or failed >

[julia-users] Re: Simplest web client on Windows 7

2014-03-28 Thread Jacques Rioux
Ok, thanks for your reply. I refreshed everything at home and now I don't seem to have install errors. That's a start. I am initially trying to use the Request object like: julia> rq = Request("GET", "http://julialang.org/";, (String=>String)[], "") But now, what do I do with it? I look in th

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Ivar, I get the same output as before (with updated hashes for doc/juliadoc.) On Mar 28, 2014, at 6:11 PM, Ivar Nesje wrote: > Strange. Just for clarity, can you post the full output of the following > commands in a gist (or somewhere similar so that we don't clutter the thread > with severa

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Ivar Nesje
Can you try make -d and post the output? PS. I'm out of my knowledge area, but try to see if I can get a hint on the problem. kl. 01:16:02 UTC+1 lørdag 29. mars 2014 skrev Guillermo Garza følgende: > > Ivar, I get the same output as before (with updated hashes for > doc/juliadoc.) > > > > O

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
The output from make -d is here https://gist.github.com/ggarza/9846012 Thanks for the effort. I appreciate it. On Mar 28, 2014, at 7:35 PM, Ivar Nesje wrote: > Can you try > > make -d > > and post the output? > > PS. I'm out of my knowledge area, but try to see if I can get a hint on the >

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Isaiah Norton
The specific problem is that dsfmt-2.2.tar.gz needs to be decompressed - from your file listing above, it has not been. I don't use OS X and don't see any hint in the outputs you sent. Surely tar and gz are available? You should also make sure to follow the instructions in the README about upgradin

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Isaiah, that doesn’t fix the problem. The output is still the same. I’ve have the latest Xcode and command-line tools. It must be a makefile error. But I don’t know why the error occurs, so it’s hard to find. On Mar 28, 2014, at 7:52 PM, Isaiah Norton wrote: > The specific problem is that

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Isaiah Norton
The Makefile error occurs because that file has not been decompressed. The question is why. What happens if you run `tar xzf deps/random/dsfmt-2.2.tar.gz -C deps/random` to decompress it? On Fri, Mar 28, 2014 at 9:02 PM, Guillermo Garza wrote: > Isaiah, that doesn't fix the problem. The output

[julia-users] ok to iterate over an integer?

2014-03-28 Thread andrew cooke
maybe there's a good reason for this (i suspect there is, but i'm not seeing it right now). but if there isn't, removing it might save some poor typist or confused newbie from a frustrated debugging session. the problem is that for i in 8 ... end isn't a syntax error (when what was meant

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Isaiah, the file is decompressed, but nothing changes. I get the same error. /bin/sh: line 0: cd: random: No such file or directory make[2]: *** [random/dsfmt-2.2/config.status] Error 1 make[1]: *** [julia-release] Error 2 make: *** [release] Error 2 On Mar 28, 2014, at 8:16 PM, Isaiah Norton wr

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Isaiah Norton
Please send the output of `ls deps/random/dsfmt-2.2/`. (I'm on IRC if you want to discuss w/ higher bandwidth). On Fri, Mar 28, 2014 at 9:21 PM, Guillermo Garza wrote: > Isaiah, the file is decompressed, but nothing changes. I get the same > error. > > /bin/sh: line 0: cd: random: No such file

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Elliot Saba
Is there a "random" directory inside of "deps" in the root julia folder? -E On Fri, Mar 28, 2014 at 6:21 PM, Guillermo Garza wrote: > Isaiah, the file is decompressed, but nothing changes. I get the same > error. > > /bin/sh: line 0: cd: random: No such file or directory > make[2]: *** [random/

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Tony Kelman
The error message could maybe be misleading, since it's running a multi-line rule? Do you have `install_name_tool` on your path? On Friday, March 28, 2014 6:21:56 PM UTC-7, Guillermo Garza wrote: > > Isaiah, the file is decompressed, but nothing changes. I get the same > error. > > /bin/sh: li

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
The directory created by ‘tar`is not named 'deps/random/dsfmt-2.2/‘ but rather `deps/random/dSFMT-src-2.2` The output of `tar`, `ls deps/random` and `ls deps/random/dSFMT-src-2.2` is below % tar xzf deps/random/dsfmt-2.2.tar.gz -C deps/random % ls deps/random dSFMT-src-2.2/dSFMT.c.patch

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Tony, I do have `install_name_toll` in my path. On Mar 28, 2014, at 8:32 PM, Tony Kelman wrote: > Do you have `install_name_tool` on your path?

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Elliot Saba
Can you post the output of `make VERBOSE=1`? That might give us a slightly better look at what's going on. On Fri, Mar 28, 2014 at 6:35 PM, Guillermo Garza wrote: > Tony, I do have `install_name_toll` in my path. > > On Mar 28, 2014, at 8:32 PM, Tony Kelman wrote: > > > Do you have `install_

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Elliot, this is the output I get from `make VERBOSE=1` % make VERBOSE=1 cd random && \ mkdir -p dsfmt-2.2 && \ `which gtar 2>/dev/null || which tar 2>/dev/null` -C dsfmt-2.2 --strip-components 1 -xf dsfmt-2.2.tar.gz && \ cd dsfmt-2.2 && patch < ../dSFMT.h.patch && patch <

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Isaiah Norton
Try removing both random/dsFMT-* and run again, maybe you will get a more isolated error. What shell are you using? On Fri, Mar 28, 2014 at 9:35 PM, Guillermo Garza wrote: > Tony, I do have `install_name_toll` in my path. > > On Mar 28, 2014, at 8:32 PM, Tony Kelman wrote: > > > Do you have `

Re: [julia-users] help compiling julia on new MacBookPro

2014-03-28 Thread Guillermo Garza
Isaiah, I’m using zsh. Actually, switching to bash causes compilation to go further. It still hasn’t finished yet. I think we’ve narrowed the problem down. On Mar 28, 2014, at 8:47 PM, Isaiah Norton wrote: > What shell are you using?

Re: [julia-users] ok to iterate over an integer?

2014-03-28 Thread Leah Hanson
You can make any type iterable (by defining start, next, and done); you could, if you wanted, make Int/Integer/whatever iterable. Making an Int literal a syntax error here would create inconsistent behavior when someone (inevitably) decides to iterate over Ints for some reason. I assume you got a

[julia-users] Build errors for ICU, Nettle and GnuTLS on Windows 7

2014-03-28 Thread Jacques Rioux
This is my second thread on trying to build a simple web client on Windows 7. As I said in my first, I have tried various packages with no success at all. I was able to seemingly get HttpCommon to install correctly but I can't see what to do with HttpCommon.Request. If I ask for methodswith on