[julia-users] Testing New Functions
Hi all, I'm having trouble testing new functions. Here is the runtests.jl file: using BayesNets using Base.Test b = BayesNet([:A, :B, :C, :D, :E]) addEdge!(b, :A, :B) setCPD!(b, :A, CPDs.Bernoulli(0.5)) setCPD!(b, :B, CPDs.Bernoulli(m-(m[:A] ? 0.5 : 0.45))) setCPD!(b, :C, CPDs.Bernoulli(0.5)) @test length(b.names) == 5 addEdges!(b, [(:A, :C), (:D, :E), (:C, :D)]) d = randTable(b, numSamples = 5) @test size(d, 1) == 5 removeEdge!(b, :A, :C) @test length(b.dag.edges) == 3 *removeEdges!(b, [(:D, :E), (:C, :D)])* @test length(b.dag.edges) == 1 I created and added the function in bold. However, when I execute julia runtests.jl and I get the following: ERROR: removeEdges! not defined. I even exported the function in the file in which it was defined (export removeEdges!). Any suggestions? Thanks.
[julia-users] Dict syntax that works/give no errors on both 0.3 and 0.4?
I change {:foo = foo, :footwo = foo2} to Dict{Any,Any}(:foo = foo, :footwo = foo2) to get rid of v0.4 deprecation warnings, but it doesn't work on v0.3 anymore. Is there a version that works on both?
[julia-users] Re: Dict syntax that works/give no errors on both 0.3 and 0.4?
https://github.com/JuliaLang/Compat.jl On Tuesday, October 28, 2014 11:41:09 PM UTC-7, Sheehan Olver wrote: I change {:foo = foo, :footwo = foo2} to Dict{Any,Any}(:foo = foo, :footwo = foo2) to get rid of v0.4 deprecation warnings, but it doesn't work on v0.3 anymore. Is there a version that works on both?
Re: [julia-users] Re: Dict syntax that works/give no errors on both 0.3 and 0.4?
Thanks for the suggestion! right now ApproxFun has no REQUIREs, which seems like a shame to lose…I guess maybe its worth it though. On 29 Oct 2014, at 5:56 pm, Jason Merrill jwmerr...@gmail.com wrote: https://github.com/JuliaLang/Compat.jl On Tuesday, October 28, 2014 11:41:09 PM UTC-7, Sheehan Olver wrote: I change {:foo = foo, :footwo = foo2} to Dict{Any,Any}(:foo = foo, :footwo = foo2) to get rid of v0.4 deprecation warnings, but it doesn't work on v0.3 anymore. Is there a version that works on both?
[julia-users] Re: Article on `@simd`
Great news! On Tuesday, October 28, 2014 5:06:18 PM UTC+1, Arch Robison wrote: Update: The recent Julia 0.3.2 release supports vectorization of Float64.
Re: [julia-users] Re: Dict syntax that works/give no errors on both 0.3 and 0.4?
At this point pretty much everything REQUIRE Compat.jl, so it is nothing to be ashamed of because most of your users will already have it installed. At least it is a consistent solution that will be known in the community, and it makes it possible to use the new syntax in all 0.3.x versions and possibly 0.2 as well. We plan to reclaim the braces {}, so it's not really an option to not issue warnings for the old syntax on 0.4, because we want everyone to change. We could have had the warning silent until the 0.4-dev to 0.4-pre switch, but I can't remember that even discussed as an option. Ivar kl. 08:13:24 UTC+1 onsdag 29. oktober 2014 skrev Sheehan Olver følgende: Thanks for the suggestion! right now ApproxFun has no REQUIREs, which seems like a shame to lose…I guess maybe its worth it though. On 29 Oct 2014, at 5:56 pm, Jason Merrill jwme...@gmail.com javascript: wrote: https://github.com/JuliaLang/Compat.jl On Tuesday, October 28, 2014 11:41:09 PM UTC-7, Sheehan Olver wrote: I change {:foo = foo, :footwo = foo2} to Dict{Any,Any}(:foo = foo, :footwo = foo2) to get rid of v0.4 deprecation warnings, but it doesn't work on v0.3 anymore. Is there a version that works on both?
Re: [julia-users] Compilation / Executable of Julia for Redhat Enterprise Linux 6.2 ( Santiago)
Dear Elliot What happened, is simply a segmentation fault due to libpthread and thereafter the nodes were not accessible. regards Moritz On Tuesday, 28 October 2014 23:53:03 UTC+2, Elliot Saba wrote: Moritz, I'm interested in what broke on the compute nodes. Do you have any example output from trying to run Julia on the compute nodes? -E On Tue, Oct 28, 2014 at 1:57 PM, Tony Kelman to...@kelman.net javascript: wrote: Elliot and I had some discussions recently where we were thinking it might be a good idea to combine some of these settings under one easy group flag like JULIA_PORTABLE=1 or something, that would then set OPENBLAS_DYNAMIC_ARCH, along with the flags needed for the system image that I can never remember. If we get that working and documented, then we could consider disabling OPENBLAS_DYNAMIC_ARCH by default so we can have faster from-scratch source builds. On Tuesday, October 28, 2014 10:45:16 AM UTC-7, Isaiah wrote: The headnode/childnode issue is usually an architecture mismatch. You can target a more generic architecture to get around this; see the discussion in this thread: https://groups.google.com/d/msg/julia-dev/Eqp0GhZWxME/3mGKX1l_L9gJ ps: this should go in the FAQ... if someone new on here wants to make a first Julia pull request: click the Edit on GitHub button at the top-right while viewing the documentation. Add an entry for this, and click Submit. On Tue, Oct 28, 2014 at 1:12 PM, moritz braun moritz...@gmail.com wrote: Dear All Due to our provided not being able / willing to provide is with updates for the Lustre drivers we are currently stuck with a 2.6.32 Kernel from 2011 on our 128 Nodes cluster. Unfortunately, our current setup will not change for the next 18 months or so until the upgrade has gone on Tender. I tried the following 1. Compilation with the gcc toolchain while disabling AVX with OPENBLAS_NO_AVX = 1 This had worked on a single SMP 32 processor server running REL 6.5. On REL 6.2. it only worked for the headnode. On the other nodes the executable resulted in a binary format error. 2. using one of the generic 64 bit builds. Worked on headnode, but broke compute nodes 3. Compiliation using icc,icpc and ifc as described in http://goparallel.sourceforge.net/wp-content/uploads/2014/03/ TheParallelUniverse_Issue_17.pdf This failed with difficult to understand and hidden errors. ( I will try again soon and post the output of it!) I am a bit a the end of my knowledge! Any hints would be appreciated. regards Moritz Braun
Re: [julia-users] Re: Dict syntax that works/give no errors on both 0.3 and 0.4?
What will the braces {} be reclaimed for? On 29 Oct 2014, at 7:01 pm, Ivar Nesje iva...@gmail.com wrote: At this point pretty much everything REQUIRE Compat.jl, so it is nothing to be ashamed of because most of your users will already have it installed. At least it is a consistent solution that will be known in the community, and it makes it possible to use the new syntax in all 0.3.x versions and possibly 0.2 as well. We plan to reclaim the braces {}, so it's not really an option to not issue warnings for the old syntax on 0.4, because we want everyone to change. We could have had the warning silent until the 0.4-dev to 0.4-pre switch, but I can't remember that even discussed as an option. Ivar kl. 08:13:24 UTC+1 onsdag 29. oktober 2014 skrev Sheehan Olver følgende: Thanks for the suggestion! right now ApproxFun has no REQUIREs, which seems like a shame to lose…I guess maybe its worth it though. On 29 Oct 2014, at 5:56 pm, Jason Merrill jwme...@gmail.com javascript: wrote: https://github.com/JuliaLang/Compat.jl https://github.com/JuliaLang/Compat.jl On Tuesday, October 28, 2014 11:41:09 PM UTC-7, Sheehan Olver wrote: I change {:foo = foo, :footwo = foo2} to Dict{Any,Any}(:foo = foo, :footwo = foo2) to get rid of v0.4 deprecation warnings, but it doesn't work on v0.3 anymore. Is there a version that works on both?
[julia-users] Compiling Julia without openblas
Dear All Further to my last post I wanted to find out, how to disable the openblas in building julia, since the openblas and pthreads do not work properly together on redhat 6.2 cluster regards Moritz
[julia-users] Customize REPL autocomplete
Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
[julia-users] Re: How to assign names of a RArray object in Rif.jl?
I'm afraid the Rif.R(names-) is not working. julia Rif.initr() Using R_HOME=/home/Mine/programs/Rstat/R-3.1.1 0 julia Rif.R(names-) ERROR: R is not initialized in parseR at /home/JXiong/.julia/v0.4/Rif/src/Rif.jl:251 in R at /home/JXiong/.julia/v0.4/Rif/src/Rif.jl:277 On Sunday, October 26, 2014 11:01:51 PM UTC+1, lgautier wrote: Currently the way to do is to explicitly call the R-level setter: x = Rif.R(names-)(x, Rif.cR(A, B, C)) However, as of today commit the C-level is exposed and a way that is looking a little more like native Julia. (I'll do a pull request so this is part of the released package soon). The unit-tests are for vectors, and should be explict: https://github.com/lgautier/Rif.jl/blob/master/test/vectors.jl#L57 ```julia # The C API for R has specialized MACRO for names getrnames/setrnames # exposes it vi2 = Int32[1,2,3] rvi2 = Rif.RArray{Int32,1}(vi2) @test isequal(None, Rif.getrnames(rvi2)) Rif.setrnames!(rvi2, Rif.RArray{ASCIIString,1}(ASCIIString[a, b, c])) @test isequal(a, Rif.getrnames(rvi2)[1]) @test isequal(b, Rif.getrnames(rvi2)[2]) @test isequal(c, Rif.getrnames(rvi2)[3]) # setAttr/getAttr will be equivalent vi2 = Int32[1,2,3] rvi2 = Rif.RArray{Int32,1}(vi2) @test_throws ErrorException Rif.getAttr(rvi2, names) Rif.setAttr!(rvi2, names, Rif.RArray{ASCIIString,1}(ASCIIString[a, b, c])) @test isequal(a, Rif.getAttr(rvi2, names)[1]) @test isequal(a, Rif.getrnames(rvi2)[1]) @test isequal(b, Rif.getAttr(rvi2, names)[2]) @test isequal(b, Rif.getrnames(rvi2)[2]) @test isequal(c, Rif.getAttr(rvi2, names)[3]) @test isequal(c, Rif.getrnames(rvi2)[3]) ``` On Saturday, October 25, 2014 12:38:10 PM UTC-4, xiong...@gmail.com wrote: In R, we can assign names for a variable as: x-c(1,2,3) names(x)=c(A,B,C) x A B C 1 2 3 In Julia, I can create a RArray by x=Rif.cR([1,2,3]) But anyone know how to assign the names to this RArray variable in Julia?
Re: [julia-users] Re: Benchmarks for Julia 0.3x ???
It's one thing to write code in such a way that i cannot be optimized. But i'm wondering, why is julia/LLVM not indentifying the same situation?
Re: [julia-users] Re: Calling Julia from .NET
It's quite interesting that my sample above works perfectly under Win 7 but when I tried to repeat it under Win 8.1 I got following error (running from console): ** Exception: EXCEPTION_ACCESS_VIOLATION at 0x8f6d37d2e4 -- unknown function (ip: 1832375012) unknown function (ip: 1832375012) anonymous at inference.jl:410 unknown function (ip: 1824097072) builtin_tfunction at inference.jl:541 unknown function (ip: 1824073740) abstract_call at inference.jl:860 unknown function (ip: 1824073740) abstract_eval_call at inference.jl:900 abstract_eval at inference.jl:935 unknown function (ip: 1824073740) abstract_eval_arg at inference.jl:866 unknown function (ip: 1824073740) abstract_eval_call at inference.jl:878 abstract_eval at inference.jl:935 unknown function (ip: 1824073740) abstract_interpret at inference.jl:1090 unknown function (ip: 1824073740) typeinf at inference.jl:1409 at (unknown line) unknown function (ip: 1824073740) abstract_call_gf at inference.jl:726 unknown function (ip: 1824073740) abstract_call at inference.jl:819 unknown function (ip: 1824073740) abstract_eval_call at inference.jl:900 abstract_eval at inference.jl:935 unknown function (ip: 1824073740) abstract_interpret at inference.jl:1098 unknown function (ip: 1824073740) typeinf at inference.jl:1409 at (unknown line) unknown function (ip: 1824073740) typeinf_ext at inference.jl:1216 unknown function (ip: 1824073740) unknown function (ip: 1824068669) unknown function (ip: 1824071645) unknown function (ip: 1824073841) unknown function (ip: 1824123220) unknown function (ip: 1824358486) unknown function (ip: 1824333072) unknown function (ip: 1824390705) unknown function (ip: 287507815) unknown function (ip: 1432107587) unknown function (ip: -2) unknown function (ip: -1540888000) unknown function (ip: -1540887784) unknown function (ip: 1432107587) unknown function (ip: 1547850588) unknown function (ip: 1549890657) unknown function (ip: 1967807596) unknown function (ip: 775106096) unknown function (ip: 23662) unknown function (ip: -1540888544) unknown function (ip: 1) unknown function (ip: -1540888560) unknown function (ip: 44) unknown function (ip: -1540888560) unknown function (ip: 286343240) unknown function (ip: 286343240) unknown function (ip: 0) unknown function (ip: -1540888560) unknown function (ip: 1914573205) unknown function (ip: 1894973440) unknown function (ip: -1540887488) unknown function (ip: 286343240) unknown function (ip: 286343240) unknown function (ip: -1540888544) unknown function (ip: 287507815) unknown function (ip: -1540888512) unknown function (ip: -1539105552) unknown function (ip: 1914573205) unknown function (ip: -1540888272) unknown function (ip: -1540887488) unknown function (ip: -1540888000) unknown function (ip: -1540887784) unknown function (ip: -1540887440) unknown function (ip: -1540887624) unknown function (ip: -1540887488) unknown function (ip: -1540887896) unknown function (ip: -1540887784) unknown function (ip: -1540888176) unknown function (ip: 287506648) unknown function (ip: -1504039680) unknown function (ip: -1539105552) Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at ConsoleApplication1.Program.jl_init(String message) at ConsoleApplication1.Program.Main(String[] args) in c:\_Julia Test\Julia_In terop\Program.cs:line 28 ** Same version of VS 2013 for recompiling, same version of .NET, same sample. Any ideas ? Thanks.
[julia-users] Identify bounds error
Is there any way in Julia to get more specific information on a BoundsError()? Specifically, in Matlab these errors give a wonderfully informative error message Attemted to access [matrix]: Index out of bounds as size [matrix] = [size]. In contrast, Julia just references the line in which my for loop starts, so I have to check line for line withing the loop where the error occurs (and then each dimension for the array that's being accessed on that line). Can this process somehow be made less tedious in Julia?
[julia-users] Re: Customize REPL autocomplete
That would be cool! Currently there isn't any hooks you can use for that purpose (I believe), but as most of Julia is written in Julia, it should be a reasonable project to include the required functionality in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 and submit a pull request on Github. This would likely be nice for other associative structures (PyCall anyone?) also. You will have to look for unclosed `[` that is either empty or continue with a `:` indicating a symbol or `` indicating a string index. Ivar kl. 10:06:19 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
[julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Since we seem to have a lot of experts on interpolation in Julia in this thread, can I just ask a general question: I'm trying to interpolate values of a function for which I only know the values at some gridpoints in six dimensions. What would be the best way to do this given that I need the interpolation to be fast, as I have to interpolate millions of times? I realize that this is a fairly general question, but I'd appreciate any pointers as to what the interpolation capabilities of Julia are! Thanks, Nils
Re: [julia-users] Identify bounds error
Have you tried putting it in a function? --Tim On Wednesday, October 29, 2014 03:11:53 AM Nils Gudat wrote: Is there any way in Julia to get more specific information on a BoundsError()? Specifically, in Matlab these errors give a wonderfully informative error message Attemted to access [matrix]: Index out of bounds as size [matrix] = [size]. In contrast, Julia just references the line in which my for loop starts, so I have to check line for line withing the loop where the error occurs (and then each dimension for the array that's being accessed on that line). Can this process somehow be made less tedious in Julia?
Re: [julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Grid should be able to do this. Best is to try it and see how it works out. --Tim On Wednesday, October 29, 2014 04:03:19 AM Nils Gudat wrote: Since we seem to have a lot of experts on interpolation in Julia in this thread, can I just ask a general question: I'm trying to interpolate values of a function for which I only know the values at some gridpoints in six dimensions. What would be the best way to do this given that I need the interpolation to be fast, as I have to interpolate millions of times? I realize that this is a fairly general question, but I'd appreciate any pointers as to what the interpolation capabilities of Julia are! Thanks, Nils
Re: [julia-users] Compiling Julia without openblas
If you create the file Make.user in the julia root directory and set USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 then you should avoid building OpenBLAS. Med venlig hilsen Andreas Noack 2014-10-29 4:11 GMT-04:00 moritz braun moritz.br...@gmail.com: Dear All Further to my last post I wanted to find out, how to disable the openblas in building julia, since the openblas and pthreads do not work properly together on redhat 6.2 cluster regards Moritz
Re: [julia-users] Weird benchmark result
I think you'll have to write something like julia f()=@elapsed @sync @parallel for i=1:1000 b[i]=a[i] end to be sure that the all calculations are done before the clock stops. You should also be aware that the calculation is probably not doing what you expect as explained in http://julia.readthedocs.org/en/latest/manual/parallel-computing/#parallel-map-and-loops Med venlig hilsen Andreas Noack 2014-10-28 22:46 GMT-04:00 Kapil Agarwal kapil6...@gmail.com: Hi I wrote the following benchmark and I got some weird results which I am unsure of their correctness. a=fill(1.0,1000); b=fill(0.0,1000); f()=@elapsed @parallel for i=1:1000 b[i]=a[i] end I get the following results- julia f() 0.001288817 julia f() 4.0828e-5 julia f() 4.3807e-5 julia f() 4.2003e-5 The first result is probably due to function f() being compiled and after that, there is couple of orders of magnitude gain in performance. Is this benchmark correct or there is some problem with the code ? The corresponding C code takes on average 0.029588 seconds. Is Julia that much faster than C ? -- Kapil
Re: [julia-users] Compiling Julia without openblas
Dear Andreas Thanks a lot! I am trying it right now. regards Moritz On Wednesday, 29 October 2014 14:44:21 UTC+2, Andreas Noack wrote: If you create the file Make.user in the julia root directory and set USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 then you should avoid building OpenBLAS. Med venlig hilsen Andreas Noack 2014-10-29 4:11 GMT-04:00 moritz braun moritz...@gmail.com javascript: : Dear All Further to my last post I wanted to find out, how to disable the openblas in building julia, since the openblas and pthreads do not work properly together on redhat 6.2 cluster regards Moritz
[julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Contributions, or advice on the correct pronunciation of Dierckx, gratefully accepted. The original code was written well before my days in Leuven (and the author retired last year), but I can help with the pronunciation :-) The -ckx is just like x, fortunately. The -ie- is like the i in fish, but a little bit longer, and the -r- is close to a french r. Think of the r in Paris, the french way. But it sounds okay in english too. Daan
Re: [julia-users] Compiling Julia without openblas
Dear Andreas Thanks a lot! Now I can use julia on this cluser, albeit with slower lapack and blas. However for my applications that won't matter much. regards Moritz On Wednesday, 29 October 2014 14:44:21 UTC+2, Andreas Noack wrote: If you create the file Make.user in the julia root directory and set USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 then you should avoid building OpenBLAS. Med venlig hilsen Andreas Noack 2014-10-29 4:11 GMT-04:00 moritz braun moritz...@gmail.com javascript: : Dear All Further to my last post I wanted to find out, how to disable the openblas in building julia, since the openblas and pthreads do not work properly together on redhat 6.2 cluster regards Moritz
Re: [julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Thanks Daan! And for the interesting note on the author (the code was finished in 1987 so I was wondering if he was still around). On Wed, Oct 29, 2014 at 1:47 AM, Daan Huybrechs daan.huybre...@gmail.com wrote: Contributions, or advice on the correct pronunciation of Dierckx, gratefully accepted. The original code was written well before my days in Leuven (and the author retired last year), but I can help with the pronunciation :-) The -ckx is just like x, fortunately. The -ie- is like the i in fish, but a little bit longer, and the -r- is close to a french r. Think of the r in Paris, the french way. But it sounds okay in english too. Daan
Re: [julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Also, check out ApproXD.jl https://github.com/floswald/ApproXD.jl which is designed for efficient high dimensional interpolation. --Peter On Wednesday, October 29, 2014 5:32:07 AM UTC-7, Tim Holy wrote: Grid should be able to do this. Best is to try it and see how it works out. --Tim On Wednesday, October 29, 2014 04:03:19 AM Nils Gudat wrote: Since we seem to have a lot of experts on interpolation in Julia in this thread, can I just ask a general question: I'm trying to interpolate values of a function for which I only know the values at some gridpoints in six dimensions. What would be the best way to do this given that I need the interpolation to be fast, as I have to interpolate millions of times? I realize that this is a fairly general question, but I'd appreciate any pointers as to what the interpolation capabilities of Julia are! Thanks, Nils
Re: [julia-users] Re: [ANN] Dierckx.jl: 1-d and 2-d splines as in scipy.interpolate
Thanks Tim, I think I have been able to make the CoordInterpGrid object work in my code for three dimensions, just need to scale it up to the full problem now and see how it fares speedwise. And thanks Peter for suggesting an alternative, I'll definitely check that out as well!
Re: [julia-users] Compiling Julia without openblas
Le mercredi 29 octobre 2014 à 07:45 -0700, moritz braun a écrit : Dear Andreas Thanks a lot! Now I can use julia on this cluser, albeit with slower lapack and blas. However for my applications that won't matter much. Note you can also build an unthreaded version of OpenBLAS by setting USE_THREAD = 0, or use the unthreaded libopenblas.so from the RPM package by passing this when building Julia: USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 LIBBLAS=-lopenblas LIBBLASNAME=libopenblas.so.0 LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas.so.0 Finally, it would be nice to file an issue so that this bug can be fixed in the future. Regards
Re: [julia-users] Questions regarding Julia (pycall and Julia types).
On Tuesday, October 28, 2014 9:00:34 PM UTC-4, rtem...@gmail.com wrote: What I meant to ask is whether Julia code written with a pycall dependency could at some point be compiled and distributed self contained. Yes, I believe so. For example, you could use PyInstaller (http://www.pyinstaller.org/) to create a self-contained directory that has libpython and all dependencies of the Python code you want to use, and ship this along with your Julia executable. However, I haven't actually tried this, and there is probably some exploration required to figure out the right recipe in PyInstaller. In general, easily distributing self-contained Julia-based executables has not been a priority project, although it will almost certainly happen within the next couple of years (the pieces are pretty much all there, but some manual labor is required to put them together at the moment).
[julia-users] Convert DataArray to DataFrame
Hi guys, I see that the command has changed to convert a DataArray into a DataFrame, so that I can then writetable and keep the data from the DataArray. The following used to work, but now flattens the array so that the DataFrame has only one column, regardless of the columns in the DataArray: a=DataArray([1. 2; 3 4]) 2x2 DataArray{Float64,2}: 1.0 2.0 3.0 4.0 b = DataFrame(a) 4x1 DataFrame |---|-| | Row # | x1 | | 1 | 1.0 | | 2 | 3.0 | | 3 | 2.0 | | 4 | 4.0 | In this example, I do not want a 4x1 DataFrame, I want the DataFrame to be the same size as the DataArray. How can I do this in the current version? Thanks, Bradley
Re: [julia-users] Convert DataArray to DataFrame
This is actually broken right now. One way to do this is found in the pull request here: https://github.com/JuliaStats/DataFrames.jl/pull/632/files But we should probably follow Simon's suggestion in that thread and change the definition of convert to apply to AbstractMatrix. -- John On Oct 29, 2014, at 9:11 AM, Bradley Setzler bradley.setz...@gmail.com wrote: Hi guys, I see that the command has changed to convert a DataArray into a DataFrame, so that I can then writetable and keep the data from the DataArray. The following used to work, but now flattens the array so that the DataFrame has only one column, regardless of the columns in the DataArray: a=DataArray([1. 2; 3 4]) 2x2 DataArray{Float64,2}: 1.0 2.0 3.0 4.0 b = DataFrame(a) 4x1 DataFrame |---|-| | Row # | x1 | | 1 | 1.0 | | 2 | 3.0 | | 3 | 2.0 | | 4 | 4.0 | In this example, I do not want a 4x1 DataFrame, I want the DataFrame to be the same size as the DataArray. How can I do this in the current version? Thanks, Bradley
[julia-users] Re: How to assign names of a RArray object in Rif.jl?
Please open an issue on github. I will look at it. Thanks, L.
Re: [julia-users] Compilation / Executable of Julia for Redhat Enterprise Linux 6.2 ( Santiago)
A compatibility/portability flag would be nice. Some cluster architecture have very little local storage and 3rd party executables are often in an NFS mounted shared directory.
[julia-users] List comprehension returning 'Any' type when used inside function
As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] List comprehension returning 'Any' type when used inside function
My personal style rule: never use a list comprehension that's untyped. This will solve your problems: A = ASCIIString[fun(i) for i = 1:3]] -- John On Oct 29, 2014, at 10:45 AM, Zenna Tavares zennatava...@gmail.com wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennatava...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
There's an open issue to fix this, which we should definitely implement. I believe that Jeff had done it and just not merged but maybe I'm not remembering that correctly. On Wed, Oct 29, 2014 at 1:51 PM, John Myles White johnmyleswh...@gmail.com wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennatava...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
[julia-users] Re: List comprehension returning 'Any' type when used inside function
Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
Ok, but then why does it return the Vector{Any}. The following two functions give different results function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] convert(Array{ASCIIString},A) end I thought maybe it was a weird REPL thing, but it's not. On Wednesday, October 29, 2014 1:52:01 PM UTC-4, John Myles White wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennat...@gmail.com javascript: wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
https://github.com/JuliaLang/julia/issues/7258. No implementation in sight, however, so if someone wants to take a crack at it, they're welcome to. On Wed, Oct 29, 2014 at 1:55 PM, Stefan Karpinski ste...@karpinski.org wrote: There's an open issue to fix this, which we should definitely implement. I believe that Jeff had done it and just not merged but maybe I'm not remembering that correctly. On Wed, Oct 29, 2014 at 1:51 PM, John Myles White johnmyleswh...@gmail.com wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennatava...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
You're getting confused by what the value of an assignment expression is. This is what I think you're hoping your code does (but it doesn't do that): function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] return A end -- John On Oct 29, 2014, at 10:57 AM, Zenna Tavares zennatava...@gmail.com wrote: Ok, but then why does it return the Vector{Any}. The following two functions give different results function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] convert(Array{ASCIIString},A) end I thought maybe it was a weird REPL thing, but it's not. On Wednesday, October 29, 2014 1:52:01 PM UTC-4, John Myles White wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennat...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
Assignment expressions always return the right hand side, not the left hand side, so that chaining assignments don't produce weird results doing something like y = v[i] = x With this rule, this is always equivalent to doing y = x; v[i] = x (and the order doesn't matter). If assignment returned the left hand side, then it would be equivalent to v[i] = x; y = v[i]. So in the first version, you're getting the result of [fun(i) for i = 1:3], not the value that gets assigned to A. On Wed, Oct 29, 2014 at 1:57 PM, Zenna Tavares zennatava...@gmail.com wrote: Ok, but then why does it return the Vector{Any}. The following two functions give different results function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] convert(Array{ASCIIString},A) end I thought maybe it was a weird REPL thing, but it's not. On Wednesday, October 29, 2014 1:52:01 PM UTC-4, John Myles White wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennat...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
Ok, thanks. Final quick question, does the syntax John used - A = ASCIIString[fun(i) for i = 1:3] - have the same convert semantics, or is it different? On Wednesday, October 29, 2014 2:02:47 PM UTC-4, Stefan Karpinski wrote: Assignment expressions always return the right hand side, not the left hand side, so that chaining assignments don't produce weird results doing something like y = v[i] = x With this rule, this is always equivalent to doing y = x; v[i] = x (and the order doesn't matter). If assignment returned the left hand side, then it would be equivalent to v[i] = x; y = v[i]. So in the first version, you're getting the result of [fun(i) for i = 1:3], not the value that gets assigned to A. On Wed, Oct 29, 2014 at 1:57 PM, Zenna Tavares zennat...@gmail.com javascript: wrote: Ok, but then why does it return the Vector{Any}. The following two functions give different results function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] convert(Array{ASCIIString},A) end I thought maybe it was a weird REPL thing, but it's not. On Wednesday, October 29, 2014 1:52:01 PM UTC-4, John Myles White wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennat...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
Re: [julia-users] Re: List comprehension returning 'Any' type when used inside function
I believe typed comprehensions may do scalar conversion, but assume right from the start that the output array is of the specified type (so no array conversion). On Oct 29, 2014, at 11:08 AM, Zenna Tavares zennatava...@gmail.com wrote: Ok, thanks. Final quick question, does the syntax John used - A = ASCIIString[fun(i) for i = 1:3] - have the same convert semantics, or is it different? On Wednesday, October 29, 2014 2:02:47 PM UTC-4, Stefan Karpinski wrote: Assignment expressions always return the right hand side, not the left hand side, so that chaining assignments don't produce weird results doing something like y = v[i] = x With this rule, this is always equivalent to doing y = x; v[i] = x (and the order doesn't matter). If assignment returned the left hand side, then it would be equivalent to v[i] = x; y = v[i]. So in the first version, you're getting the result of [fun(i) for i = 1:3], not the value that gets assigned to A. On Wed, Oct 29, 2014 at 1:57 PM, Zenna Tavares zennat...@gmail.com wrote: Ok, but then why does it return the Vector{Any}. The following two functions give different results function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] convert(Array{ASCIIString},A) end I thought maybe it was a weird REPL thing, but it's not. On Wednesday, October 29, 2014 1:52:01 PM UTC-4, John Myles White wrote: I'm pretty sure this sort of thing always works since type declarations on variables behave like convert calls: julia function foo() a::Int64 = 0x01 return a end foo (generic function with 1 method) julia foo() 1 -- John On Oct 29, 2014, at 10:50 AM, Zenna Tavares zennat...@gmail.com wrote: Also, the following runs but still returns a Vector{Any}. How is this possible? function makestring(fun) A::Array{ASCIIString} = [fun(i) for i = 1:3] end On Wednesday, October 29, 2014 1:45:51 PM UTC-4, Zenna Tavares wrote: As shown in the following example, I am getting differently typed arrays depending on where I use the list comprehension. f(i) = $i A = [f(i) for i = 1:3] function makestring(fun) A = [fun(i) for i = 1:3] end B = makestring(f) In this example A has type Vector{ASCIIString} while B has type Vector{Any}. What gives? And is there a workaround such that we get a more specific type? I understand there are some open issues related to this, but I am not sure if this case comes under what's already been discussed.
[julia-users] Error starting Julia
Hi I get the following error when I start Julia OpenBLAS: pthread_creat error in blas_thread_init function. Error code:11 I find a file with the name .nfs0ba780820191 in the directory containing my julia script and this file contains a copy of the file I last ran. I am unable to delete this file as it says rm: cannot remove `.nfs0ba780820191': Device or resource busy What should be done about this ? -- Kapil
Re: [julia-users] Error starting Julia
Don't use NFS ;-) On Wed, Oct 29, 2014 at 2:44 PM, Kapil Agarwal kapil6...@gmail.com wrote: Hi I get the following error when I start Julia OpenBLAS: pthread_creat error in blas_thread_init function. Error code:11 I find a file with the name .nfs0ba780820191 in the directory containing my julia script and this file contains a copy of the file I last ran. I am unable to delete this file as it says rm: cannot remove `.nfs0ba780820191': Device or resource busy What should be done about this ? -- Kapil
Re: [julia-users] Error starting Julia
What do you mean by that ? Actually I am running it on a remote machine in a cluster. ᐧ Regards, Kapil Agarwal On Wed, Oct 29, 2014 at 3:16 PM, Stefan Karpinski ste...@karpinski.org wrote: Don't use NFS ;-) On Wed, Oct 29, 2014 at 2:44 PM, Kapil Agarwal kapil6...@gmail.com wrote: Hi I get the following error when I start Julia OpenBLAS: pthread_creat error in blas_thread_init function. Error code:11 I find a file with the name .nfs0ba780820191 in the directory containing my julia script and this file contains a copy of the file I last ran. I am unable to delete this file as it says rm: cannot remove `.nfs0ba780820191': Device or resource busy What should be done about this ? -- Kapil
Re: [julia-users] Error starting Julia
So, the followup question is why is it that currently, multiple instances of julia cannot be started ? ᐧ Regards, Kapil Agarwal On Wed, Oct 29, 2014 at 3:27 PM, Stefan Karpinski ste...@karpinski.org wrote: NFS is kind of a nightmare for many reasons but it is standard on clusters, so my advice wasn't really serious. But having undeletable temporary .nfs files is one of the common hazards of using NFS. Not sure what it means in this case – possibly that some process somewhere still has that file open. On Wed, Oct 29, 2014 at 3:20 PM, Kapil kapil6...@gmail.com wrote: What do you mean by that ? Actually I am running it on a remote machine in a cluster. ᐧ Regards, Kapil Agarwal On Wed, Oct 29, 2014 at 3:16 PM, Stefan Karpinski ste...@karpinski.org wrote: Don't use NFS ;-) On Wed, Oct 29, 2014 at 2:44 PM, Kapil Agarwal kapil6...@gmail.com wrote: Hi I get the following error when I start Julia OpenBLAS: pthread_creat error in blas_thread_init function. Error code:11 I find a file with the name .nfs0ba780820191 in the directory containing my julia script and this file contains a copy of the file I last ran. I am unable to delete this file as it says rm: cannot remove `.nfs0ba780820191': Device or resource busy What should be done about this ? -- Kapil
[julia-users] Re: Customize REPL autocomplete
I get it work ^ ^ Haha!! Thank you for your information! First, insert below code in the beginning of completions function in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 : try if isdefined(Main, :CUSTOM_AUTOCOMPLETION_HOOK) t=Main.CUSTOM_AUTOCOMPLETION_HOOK(string, pos) if t[3] return t end end catch err println(Error in CUSTOM_AUTOCOMPLETION_HOOK:) println(err) end And recompile Julia. Now I have a hook for the custom-autocompletion. Second, I define such function: function CUSTOM_AUTOCOMPLETION_HOOK(txt,pos) m=match(r(\w+)\[\([^\]*)$,txt[1:pos]) if !isa(m,Nothing) #For String key if !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=[filter(x-isa(x,String),ky)...] lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m.captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]=='\') if length(txt)=pos+1 txt[pos+1]==']' lst=map(x-x*\,lst) else lst=map(x-x*\],lst) end end return lst, (pos-length(m.captures[2])+1):pos, true else #For symbol key m=match(r(\w+)\[\:(\w*)$,txt[1:pos]) if isa(m,Nothing) || !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=map(string,[filter(x-isa(x,Symbol),ky)...]) lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m.captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]==']') lst=map(x-x*],lst) end return lst, (pos-length(m.captures[2])+1):pos, true end end Now it is work on string and symbol key, really cool! It can also auto-complete the method of python object ^ ^v On Wednesday, October 29, 2014 11:47:32 AM UTC+1, Ivar Nesje wrote: That would be cool! Currently there isn't any hooks you can use for that purpose (I believe), but as most of Julia is written in Julia, it should be a reasonable project to include the required functionality in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 and submit a pull request on Github. This would likely be nice for other associative structures (PyCall anyone?) also. You will have to look for unclosed `[` that is either empty or continue with a `:` indicating a symbol or `` indicating a string index. Ivar kl. 10:06:19 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
[julia-users] Re: Customize REPL autocomplete
Nice. What do people think about adding this functionality to Base? If anyone likes to read code in a gist, rather than in an email, I made a link https://gist.github.com/ivarne/d232c1a815222fc5f896 Regards Ivar kl. 21:07:45 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: I get it work ^ ^ Haha!! Thank you for your information! First, insert below code in the beginning of completions function in /base/REPLCompletions.jl https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fjulia%2Fblob%2Fmaster%2Fbase%2FREPLCompletions.jl%23L185sa=Dsntz=1usg=AFQjCNHzQ0VkvZjQihp3roolMlmxAe9LHQ : try if isdefined(Main, :CUSTOM_AUTOCOMPLETION_HOOK) t=Main.CUSTOM_AUTOCOMPLETION_HOOK(string, pos) if t[3] return t end end catch err println(Error in CUSTOM_AUTOCOMPLETION_HOOK:) println(err) end And recompile Julia. Now I have a hook for the custom-autocompletion. Second, I define such function: function CUSTOM_AUTOCOMPLETION_HOOK(txt,pos) m=match(r(\w+)\[\([^\]*)$,txt[1:pos]) if !isa(m,Nothing) #For String key if !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=[filter(x-isa(x,String),ky)...] lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m.captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]=='\') if length(txt)=pos+1 txt[pos+1]==']' lst=map(x-x*\,lst) else lst=map(x-x*\],lst) end end return lst, (pos-length(m.captures[2])+1):pos, true else #For symbol key m=match(r(\w+)\[\:(\w*)$,txt[1:pos]) if isa(m,Nothing) || !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=map(string,[filter(x-isa(x,Symbol),ky)...]) lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m.captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]==']') lst=map(x-x*],lst) end return lst, (pos-length(m.captures[2])+1):pos, true end end Now it is work on string and symbol key, really cool! It can also auto-complete the method of python object ^ ^v On Wednesday, October 29, 2014 11:47:32 AM UTC+1, Ivar Nesje wrote: That would be cool! Currently there isn't any hooks you can use for that purpose (I believe), but as most of Julia is written in Julia, it should be a reasonable project to include the required functionality in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 and submit a pull request on Github. This would likely be nice for other associative structures (PyCall anyone?) also. You will have to look for unclosed `[` that is either empty or continue with a `:` indicating a symbol or `` indicating a string index. Ivar kl. 10:06:19 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
Re: [julia-users] Re: Customize REPL autocomplete
I really like the concept; I can't tell you how many times I've tried to tab-complete dict keys. -E On Wed, Oct 29, 2014 at 1:36 PM, Ivar Nesje iva...@gmail.com wrote: Nice. What do people think about adding this functionality to Base? If anyone likes to read code in a gist, rather than in an email, I made a link https://gist.github.com/ivarne/d232c1a815222fc5f896 Regards Ivar kl. 21:07:45 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: I get it work ^ ^ Haha!! Thank you for your information! First, insert below code in the beginning of completions function in /base/REPLCompletions.jl https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fjulia%2Fblob%2Fmaster%2Fbase%2FREPLCompletions.jl%23L185sa=Dsntz=1usg=AFQjCNHzQ0VkvZjQihp3roolMlmxAe9LHQ : try if isdefined(Main, :CUSTOM_AUTOCOMPLETION_HOOK) t=Main.CUSTOM_AUTOCOMPLETION_HOOK(string, pos) if t[3] return t end end catch err println(Error in CUSTOM_AUTOCOMPLETION_HOOK:) println(err) end And recompile Julia. Now I have a hook for the custom-autocompletion. Second, I define such function: function CUSTOM_AUTOCOMPLETION_HOOK(txt,pos) m=match(r(\w+)\[\([^\]*)$,txt[1:pos]) if !isa(m,Nothing) #For String key if !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=[filter(x-isa(x,String),ky)...] lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m. captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]=='\') if length(txt)=pos+1 txt[pos+1]==']' lst=map(x-x*\,lst) else lst=map(x-x*\],lst) end end return lst, (pos-length(m.captures[2])+1):pos, true else #For symbol key m=match(r(\w+)\[\:(\w*)$,txt[1:pos]) if isa(m,Nothing) || !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=map(string,[filter(x-isa(x,Symbol),ky)...]) lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m. captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]==']') lst=map(x-x*],lst) end return lst, (pos-length(m.captures[2])+1):pos, true end end Now it is work on string and symbol key, really cool! It can also auto-complete the method of python object ^ ^v On Wednesday, October 29, 2014 11:47:32 AM UTC+1, Ivar Nesje wrote: That would be cool! Currently there isn't any hooks you can use for that purpose (I believe), but as most of Julia is written in Julia, it should be a reasonable project to include the required functionality in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 and submit a pull request on Github. This would likely be nice for other associative structures (PyCall anyone?) also. You will have to look for unclosed `[` that is either empty or continue with a `:` indicating a symbol or `` indicating a string index. Ivar kl. 10:06:19 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
Re: [julia-users] Re: Customize REPL autocomplete
+1 On Wednesday, October 29, 2014 9:56:33 PM UTC+1, Elliot Saba wrote: I really like the concept; I can't tell you how many times I've tried to tab-complete dict keys. -E On Wed, Oct 29, 2014 at 1:36 PM, Ivar Nesje iva...@gmail.com javascript: wrote: Nice. What do people think about adding this functionality to Base? If anyone likes to read code in a gist, rather than in an email, I made a link https://gist.github.com/ivarne/d232c1a815222fc5f896 Regards Ivar kl. 21:07:45 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: I get it work ^ ^ Haha!! Thank you for your information! First, insert below code in the beginning of completions function in /base/REPLCompletions.jl https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fjulia%2Fblob%2Fmaster%2Fbase%2FREPLCompletions.jl%23L185sa=Dsntz=1usg=AFQjCNHzQ0VkvZjQihp3roolMlmxAe9LHQ : try if isdefined(Main, :CUSTOM_AUTOCOMPLETION_HOOK) t=Main.CUSTOM_AUTOCOMPLETION_HOOK(string, pos) if t[3] return t end end catch err println(Error in CUSTOM_AUTOCOMPLETION_HOOK:) println(err) end And recompile Julia. Now I have a hook for the custom-autocompletion. Second, I define such function: function CUSTOM_AUTOCOMPLETION_HOOK(txt,pos) m=match(r(\w+)\[\([^\]*)$,txt[1:pos]) if !isa(m,Nothing) #For String key if !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=[filter(x-isa(x,String),ky)...] lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m. captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]=='\') if length(txt)=pos+1 txt[pos+1]==']' lst=map(x-x*\,lst) else lst=map(x-x*\],lst) end end return lst, (pos-length(m.captures[2])+1):pos, true else #For symbol key m=match(r(\w+)\[\:(\w*)$,txt[1:pos]) if isa(m,Nothing) || !isdefined(Main,parse(m.captures[1])) return UTF8String[], 0:-1, false end var=eval(parse(m.captures[1])) if !applicable(keys,var) return UTF8String[], 0:-1, false end ky=keys(var) if length(ky)500 return UTF8String[], 0:-1, false end ky=map(string,[filter(x-isa(x,Symbol),ky)...]) lst=convert(Vector{UTF8String},[filter(x-beginswith(x,m. captures[2]),ky)...]) if !(length(txt)=pos+1 txt[pos+1]==']') lst=map(x-x*],lst) end return lst, (pos-length(m.captures[2])+1):pos, true end end Now it is work on string and symbol key, really cool! It can also auto-complete the method of python object ^ ^v On Wednesday, October 29, 2014 11:47:32 AM UTC+1, Ivar Nesje wrote: That would be cool! Currently there isn't any hooks you can use for that purpose (I believe), but as most of Julia is written in Julia, it should be a reasonable project to include the required functionality in /base/REPLCompletions.jl https://github.com/JuliaLang/julia/blob/master/base/REPLCompletions.jl#L185 and submit a pull request on Github. This would likely be nice for other associative structures (PyCall anyone?) also. You will have to look for unclosed `[` that is either empty or continue with a `:` indicating a symbol or `` indicating a string index. Ivar kl. 10:06:19 UTC+1 onsdag 29. oktober 2014 skrev xiong...@gmail.com følgende: Is there any way to add an customal autocomplete list to Julia REPL? For example, I really hope the Dict can be as convenient as MATLAB structure that the keys can be autpcompleted in command line.
[julia-users] Re: Failure of installing Julia 0.4 (latest master) on Mac OS X 10.10
Also having problems after a fetch... lots of link errors followed by _ztrsen_, referenced from _zneupd_ in zneupd.o _zunm2r_, referenced from: _zneupd_ in zneupd.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make[4]: *** [libarpack.la] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [arpack-ng-3.1.5/.libs/libarpack.dylib] Error 2 make[1]: *** [julia-release] Error 2 make: *** [release] Error 2 was fixed by rm -rf libarpack-ng and SuiteSparce and then make previous to that I had to remove and rebuild llvm I think what happens is that sometimes if you let deps grow too far out of date, they don't work with each other any more (makes sense) and the build process get wedged, it can't even figure out what to do. but who wants to rebuild deps entirely every time? no one. Seems like you need to have a way to indicate inter-dep dependency, so that change to 1 particular dep will cascade rebuild to all the other dependencies necessary but no more. it may be in this case that if any one of arpack-ng SuiteSparce objconv change major or minor numbers, they all have to be rebuilt. Anyone have a dependency graph in mind?