[julia-users] Reading from a TCP socket with quasi-continuous data transfer

2016-05-24 Thread Joshua Jones
Hi, First post to the group, but I've been coding in Julia for about a year now. I'm working on a native Julia client for real-time access to geophysical data via. SeedLink. However, it seems like I need a way to interrupt blocking

[julia-users] Re: Fun Fact: Julia is space sensitive (in some sense)

2016-05-24 Thread Chris Rackauckas
Yes, spaces denote a new column in an array definition, so a[2 +1] is size 2 while a[2 + 1] has the parser not care about the spaces because it tries to complete the expression (like it does with newlines). My favorite case is this piece of code I wrote a few months ago: Du(x) =

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Chris Rackauckas
I like Stefan's idea. In fact, this is how I've already been using Julia, precisely for scalability. I think that not having an explicit return value in a long function is just unreadable, so for long-form functions I always add return statements at the bottom. At the same time, there's no

[julia-users] Re: I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Chris Rackauckas
While I don't think it's true that numerical computing is only 5% matrix math, most user facing code isn't matrix math. At its core, just about every numerical algorithm is matrix math. Every nonlinearity or connection between terms becomes a matrix, and so every equation is either solving Ax

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Parks
I like Stefan's long-form / short-form solution myself. The trivial issue at hand was whether adding a simple print statement at the end of a long-form function was going to break one of the dozens of uses of it. That should be trivial, but it wasn't. The bigger the project, the bigger this

[julia-users] Fun Fact: Julia is space sensitive (in some sense)

2016-05-24 Thread Po Choi
julia> a = zeros(3) 3-element Array{Float64,1}: 0.0 0.0 0.0 julia> a[2+1] 0.0 julia> a[2 + 1] 0.0 julia> a[2+ 1] 0.0 julia> a[2 +1] ERROR: MethodError: `typed_hcat` has no method matching typed_hcat(::Array{Float64,1}, ::Int64, ::Int64) Closest candidates are: typed_hcat(::Type{T},

Re: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Eric Forgy
On Wednesday, May 25, 2016 at 6:30:19 AM UTC+8, Stefan Karpinski wrote: > > That way unless you put an explicit return in a long form function, it > automatically returns nothing, avoiding accidentally returning the value of > the last expression. > This makes sense to me. The current behavior

Re: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Tom Breloff
> > if g() returns `nothing` then this code is fine; if g() returns a value, > then we are accidentally returning it. This is the frustrating part for me. I very frequently have methods which "do something and then pass control to another method". So by putting g() at the end of f, I'm

RE: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Anthoff
+1. While I like it, I’m not sure it is worth the cost. If there is a decision to go ahead with it, it would be good to do so rather sooner than later, just to make that breakage a little less worse… From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On Behalf Of

[julia-users] Re: Let's Bridge the IRC and Gitter

2016-05-24 Thread Lyndon White
Transcribing a few comments from IRC: > 11:51 < acetoline> there's a bot that connects IRC to Gitter? > 11:51 < Lyndon> I set one up last night. > 11:51 < acetoline> oh cool > 11:51 < acetoline> how does it work > 11:52 < Lyndon> I didn't make it, but basically it just has a gitter > account >

[julia-users] Array{T,2} of n x 1 dimension vs. Array{T,1} (vector)

2016-05-24 Thread SrAceves
For size(Array{T,2}) = (n,1), what is the consequence of defaulting to an Array{T,1}? I often have to use the vec() function to vectorize nx1 arrays, which is cumbersome.

[julia-users] Re: I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Davide Lasagna
Thanks Steven for the clear explanation!

[julia-users] Re: I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Siyi Deng
I tend to agree that explicit broadcasting is better than numpy's default behavior. However, IMO operations on the n-d arrays is better defaulted to element-wise, and n-d with scalar default to element-wise too. Think about it, a lot of operations are not even commonly defined for 3-d and

Re: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Steven G. Johnson
On Tuesday, May 24, 2016 at 6:30:19 PM UTC-4, Stefan Karpinski wrote: > > With the change I proposed, we can statically tell the difference between > an accidental return and an intentional one. > Nice, now I see. The biggest problem is that it seems like it would be a hugely breaking

[julia-users] Re: I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Steven G. Johnson
(There is also the original benefit discussed in #8450 : when you write a function f(x::Number), you don't have to decide in advance whether you need a separate "vector" version of it too. You can just write f.(x) for any scalar function f.)

Re: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Jeffrey Sarnoff
Just modify Compat.jl so it offers compatibility with future versions of Julia ... using Compat @compat function g()::Int # stuff end function fg(args...) g() end # returns an Int, so it must return something @compat function h()::Void # stuff end function fh(args...) h() end # returns

[julia-users] Re: I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Steven G. Johnson
It's not just a question of syntactic convenience or brevity. There is a huge *semantic* benefit to using dots for broadcasting operations: they explicitly inform the compiler, at the *syntax* level, that a broadcast is intended. We aren't exploiting it yet, but soon I'm hoping to have

Re: [julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Stefan Karpinski
On Tue, May 24, 2016 at 5:08 PM, Steven G. Johnson wrote: > As Jeff says, the current behavior is consistent in that a block like > begin...end has a value equal to its last expression in any other context, > so it would be odd if begin...end in a function body did not

Re: [julia-users] I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Gabriel Gellner
I don't think those discussion points will make Siyi happy ;) We are getting even more required use of dotted "broadcasting" instead of less like he wants. I much much prefer being explicit with the dots, but like all syntax discussion it seems to get heated :) On Tuesday, May 24, 2016 at

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Jeffrey Sarnoff
David, if it reads 'complicated' that is my hiccup. The intent was to uncomplicate by letting current and future functions do what one would expect. The general notion, not entirely captured above, is function fna{T}(x::T)::T result = zero(T) # this and that result

Re: [julia-users] I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Isaiah Norton
This has been a point of (extremely) lengthy discussion. See the following issues for recent improvements and plans, some of which will be in the next release: https://github.com/JuliaLang/julia/pull/15032 https://github.com/JuliaLang/julia/issues/16285 On Tue, May 24, 2016 at 5:23 PM, Siyi Deng

[julia-users] Re: Error installing hydrogen for Atom

2016-05-24 Thread Alex Mellnik
I had this exact same problem. What fixed it for me was using the nuclear option to force everything in the build to use python 2.7: I temporarily removed 3.5 from my path and replaced it with 2.7. I had previously tried setting the PYTHON environment variable to the 2.7 executable and

[julia-users] I feel that on the syntax level, Julia sacrificed too much elegancy trying to be compatible with textbook math notations

2016-05-24 Thread Siyi Deng
numpy arrays operate element-wise by default, and have broadcasting (binary singleton expansion) behaviors by default. in julia you have to do (.> , .<, .==) all the time.

[julia-users] Re: Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Steven G. Johnson
As Jeff says, the current behavior is consistent in that a block like begin...end has a value equal to its last expression in any other context, so it would be odd if begin...end in a function body did not have the same behavior. I mostly like the style of explicit "return" statements in

[julia-users] Re: ccall closures and the wizardry of S. G. Johnson

2016-05-24 Thread Steven G. Johnson
On Tuesday, May 24, 2016 at 3:01:12 PM UTC-4, Gabriel Gellner wrote: > > Working thru the incredible guide: > http://julialang.org/blog/2013/05/callback > > I am stuck on understanding if there are any work arounds for being able > to use julia anonymous functions in `ccall` callback functions.

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

2016-05-24 Thread Cedric St-Jean
FYI, Autoreload.jl has this `@ausing` macro that will autoreload the module on modification AND update the Main symbols, so there's no need to qualify the module name all the time. It's much more convenient than Julia's default behaviour IMO. On Tuesday, May 24, 2016 at 3:29:44 PM UTC-4,

RE: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Anthoff
I think that is a way too complicated rule, no one will know anymore what is happening. From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On Behalf Of Jeffrey Sarnoff Sent: Tuesday, May 24, 2016 12:58 PM To: julia-users Subject: Re:

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Jeffrey Sarnoff
Rather than impose `return nothing` on all unshortly functions that do not provide an explicit return, perhaps limit postpending `return nothing` to functions that neither provide an explicit return anywhere within the function body nor have as the final line of the function (before

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

2016-05-24 Thread Tim Holy
If you reloaded the whole package each time some code said using Compat you'd be very, very unhappy. Once the module is defined in Main, that's where it fetches it from (which is why it's so fast). If you reload the package with `reload("Compat")`, then any future `using` statements refer

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Tamas Papp
I wonder if a mandatory return would play well with macros. The neat thing about the Lisp-style syntax is that it is nestable, an expression does not need to care about where it is and whether a return statement makes sense in that context. On Tue, May 24 2016, David Anthoff wrote: > BUT, if

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Tom Breloff
-1 I would be sad if my code was suddenly peppered with "return" unnecessarily (IMO) all over the place. I'm sure David was looking at my code when he was inspired to post this but I would be: http://giphy.com/gifs/sad-depressed-disappointed-33iqmp5ATXT5m I'm ok with social pressure to change...

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Anthoff
BUT, if this was to adopted, please do it soon :) These are the kind of breaking code changes that should get fewer and fewer as 1.0 moves closer. ​

[julia-users] Re: Suppressing plot windows by default - is this purposeful?

2016-05-24 Thread Penn Taylor
In addition to differing interpretations of the verb "plot", as Tom mentioned, this discussion may also be rooted in a difference between how one would expect this to work in a functional- versus an imperative paradigm. That would help explain why the same behavior appears to be consistent to

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Eric Forgy
On Wednesday, May 25, 2016 at 1:34:56 AM UTC+8, David Anthoff wrote: > > I like that idea. > Me too +1. Not a big deal though,

Re: [julia-users] Handling large xml-files

2016-05-24 Thread Isaiah Norton
One example to start from is the parser in OpenStreetMap.jl, which uses LibExpat's streaming functionality: https://github.com/tedsteiner/OpenStreetMap.jl/blob/master/src/parseMap.jl On Tue, May 24, 2016 at 11:18 AM, Johann Spies wrote: > > > > *In Python I can use

RE: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Anthoff
I like that idea. I think the current behavior is not a huge problem, but I often run into a situation where I code up a method that modifies something and shouldn’t return anything, and then I forget to add a blank return statement at the end (*) and the function returns just something

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Stefan Karpinski
The modification I've occasionally considered would be: - short-form functions implicitly return their expression value; - long-form functions implicitly return `nothing` unless an explicit value is returned. This could be implemented by automatically inserting a `return nothing` at the

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

2016-05-24 Thread Cedric St-Jean
On Tuesday, May 24, 2016 at 11:13:29 AM UTC-4, vav...@uwaterloo.ca wrote: > > Cedric, > > Yes, you have identified the issue: when I say "using file.@mac" followed > by "macroexpand(:(@mac expr))" at the REPL prompt, then future 'include' > statements do not reload the macro definition.

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Andreas Lobinger
I tend to agree with you, however... julia> d = Any[] 0-element Array{Any,1} julia> type d1 name::AbstractString content::Any[] end ERROR: TypeError: d1: in type definition, expected Type{T}, got Array{Any,1} On Tuesday, May 24, 2016 at 7:11:50 PM UTC+2, Stefan

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Tamas Papp
You are mixing up the constructor and the type syntax. Just use Vector{Any} in the type definition. On Tue, May 24 2016, Andreas Lobinger wrote: > I tend to agree with you, however... > > julia> d = Any[] > 0-element Array{Any,1} > > julia> type d1 >name::AbstractString >

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Isaiah Norton
`Any[]` constructs a list instance. The proper type signature is `::Array{Any,1}` (or if you don't absolutely need it, you can leave the member signature out of the type declaration) On Tue, May 24, 2016 at 1:16 PM, Andreas Lobinger wrote: > I tend to agree with you,

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Stefan Karpinski
That is an instance not the type itself. The type is Vector{Any}. On Tue, May 24, 2016 at 1:16 PM, Andreas Lobinger wrote: > I tend to agree with you, however... > > julia> d = Any[] > 0-element Array{Any,1} > > julia> type d1 >name::AbstractString >

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Jeff Bezanson
We did it this way because it's useful in general for the value of a block to be the value of its last expression (as in lisp `progn` and scheme `begin`). For example, a macro might want to return some statements that need to execute before finally computing its value. The "implicit return"

Re: [julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread Isaiah Norton
This is common in more functionally-oriented languages, and facilitates a similar style in Julia. I would probably ban it in an organization-level linting standard, but I do use it myself ;) On Tue, May 24, 2016 at 12:48 PM, David Parks wrote: > The last line of a

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Stefan Karpinski
Since Julia 0.4 [] is what you're looking for. On Tue, May 24, 2016 at 1:06 PM, Andreas Lobinger wrote: > Hello colleagues, > > it really feels strange to ask this, but what is the julia equivalent of > python's list? > > So. > > >1. can by initialised empty >2.

[julia-users] julia equivalent of python [] (aka list)

2016-05-24 Thread Andreas Lobinger
Hello colleagues, it really feels strange to ask this, but what is the julia equivalent of python's list? So. 1. can by initialised empty 2. subject of append and extend 3. accepting Any entry 4. foolproof usage in type definition... (my real problem seems to be here)

Re: [julia-users] Julia implementation

2016-05-24 Thread Stefan Karpinski
Rewriting the parser in C would (probably) make it faster. So would compiling it using e.g. the recently-open-sourced ChezScheme , which is a less drastic measure. On Tue, May 24, 2016 at 12:47 PM, Ford Ox wrote: > Thank you very much. >

[julia-users] Lack of an explicit return in Julia, heartache or happiness?

2016-05-24 Thread David Parks
The last line of a function is its implicit return value in Julia. Can someone tell me why this is a great idea? I'm realizing a serious downside to it in reading someone else's code. It's not immediately clear to me if a use of a particular function is using the last statement as a return

Re: [julia-users] Julia implementation

2016-05-24 Thread Ford Ox
Thank you very much. One more question : Is there any speed to gain, when all that stuff would be rewritten in the lowest possible language? (I guess that is assembler or machine code :D)

Re: [julia-users] Julia implementation

2016-05-24 Thread Didier Verna
Stefan Karpinski wrote: > There's something delightful about the fact that in order to change > the syntax of Julia, you must first prove yourself proficient in a > language that actively rejects the very concept of fancy syntax. :-D :-D :-D -- Resistance is futile. You will be jazzimilated.

[julia-users] Handling large xml-files

2016-05-24 Thread Johann Spies
*In Python I can use etree.iterparse from lxml. Is there something similar available in Julia? I have looked at the LibExpat package, but the reference **Streaming XML parsing does not give me enough information (at least for my level of understanding) on how to use it.* I am working with

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

2016-05-24 Thread vavasis
Cedric, Yes, you have identified the issue: when I say "using file.@mac" followed by "macroexpand(:(@mac expr))" at the REPL prompt, then future 'include' statements do not reload the macro definition. However, if I skip the "using" directive and qualify the name as file.@mac in the

Re: [julia-users] Julia implementation

2016-05-24 Thread Stefan Karpinski
On Tue, May 24, 2016 at 10:56 AM, Isaiah Norton wrote: > - Scheme: because Julia is a Trojan Horse to finally make the world use > Lisp. because it keeps the pesky peasants out. because it's a great > compiler language and allowed fast implementation and iteration.

[julia-users] Julia implementation

2016-05-24 Thread cormullion
Click on the colored bar on the main page: https://github.com/JuliaLang/julia The current percentage is 66.5% Julia. 2//3... There's some plumbing in C, and the parsing's in Scheme.

Re: [julia-users] Julia implementation

2016-05-24 Thread Isaiah Norton
I would suggest to read src/README.md and the Devdocs ( http://docs.julialang.org/en/latest/devdocs/julia/) for an overview of the organization of the codebase. > What is not implemented in julia? > What language is it implemented in? (I think that arrays come from c, > right?) - frontend

Re: [julia-users] Re: static compilation

2016-05-24 Thread Ján Adamčák
Thanks Yichao Yu, Your macro works fine. So in the next step I tried the following flag: "--compile=all" during system image compilation. My userimg.jl: @Base.ccallable Int64 jl_foo(x::Int64) = (x+1) with the following C code: #include #include #include #include int main(int argc, char

[julia-users] Julia implementation

2016-05-24 Thread Ford Ox
Docs state that most of the julia language is implemented in julia itself. What is not implemented in julia? What language is it implemented in? (I think that arrays come from c, right?) Why is it implemented in that particular language?

Re: [julia-users] Re: Julia large project example.

2016-05-24 Thread Scott Jones
What effect does that have on performance? (Of course, I want to have my cake and eat it too!) On Tuesday, May 24, 2016 at 4:03:50 AM UTC-4, Ford Ox wrote: > > A little bit more on the topic of encapsulation, if somebody desperately > wants it. > > module... > export... > type Foo x end >

[julia-users] Re: Let's Bridge the IRC and Gitter

2016-05-24 Thread Scott Jones
Yes, big thanks to Lyndon for setting that test up, it worked very well! I'd seen it used in Gitter chat room https://gitter.im/codeforscience/community, which I strongly recommend to Julians interested in open data science initiatives, there are already a few Julians hanging out there.

Re: [julia-users] Keyword chaining

2016-05-24 Thread Scott Jones
Unless that's something added in later C standards, I'm pretty sure C doesn't have that (as Stefan stated, the case below is simply that an `if` or `else` can have a single statement (`{statements ... }`) being a block statement). Julia does support what you are talking about, but only (AFAIK)

Re: [julia-users] Compute eigenvalues in parallel

2016-05-24 Thread Yao Lu
thanks On Sun, May 22, 2016 at 2:41 PM, Tony Kelman wrote: > Shared memory or distributed? For the latter I would look at Elemental. > For the former, you can use a multithreaded BLAS in the LAPACK eigenvalue > calls, though from reports it appears MKL is often better optimized

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

2016-05-24 Thread Cedric St-Jean
Are you `using` the module? In general, `using` and reloading don't play very nice with each other. I just tried with a module like module foo macro aa() 20 end end and when I use the module name include("foo.jl") foo.@aa it works out. On Tue, May 24, 2016 at 12:21 AM,

[julia-users] ANN / Request for testers: Pardiso.jl

2016-05-24 Thread Kristoffer Carlsson
Hello everyone, I recently took a bit of time to clean up my wrapper to the linear solver library Pardiso that exist in MKL and as a standalone project (http://www.pardiso-project.org/). It should now hopefully work on both UNIX and Windows systems and have a decent interface. The Pardiso

[julia-users] Re: How to make a macro that is a synonym for another macro?

2016-05-24 Thread Jeffrey Sarnoff
unearthed better solution Nesting Macros ``` macro sameAction(a, b) quote

Re: [julia-users] Re: Julia large project example.

2016-05-24 Thread Ford Ox
A little bit more on the topic of encapsulation, if somebody desperately wants it. module... export... type Foo x end type Holder{T} x::T end # don't export this one setfield(f::Foo, key, value::Holder) = f.key = value.x setfield(f::Foo, key, value) = raise error... # Other functions...

Re: [julia-users] Suppressing plot windows by default - is this purposeful?

2016-05-24 Thread CrocoDuck O'Ducks
Just a couple of cents from a newbie. I come from Matlab as well and I really love the way Julia works actually. There are many cases in Matlab where I get plots when I don't really ask for them and I end up with slow code and the need to close programmatically windows on the screen to avoid

Re: [julia-users] Suppressing plot windows by default - is this purposeful?

2016-05-24 Thread NotSoRecentConvert
plt[:show](), display(), or whatever is a minor nuisance so if it's the developers' wishes that it is so then so be it. I would feature it prominently in the documentation of the various plotting packages though. plot() - Create a plot object in the background which can be later displayed

[julia-users] "A Taste of Julia" - Didier Verna - ACCU 2016 - youtube

2016-05-24 Thread cormullion
A presentation introducing Julia from a Lisp perspective: https://youtu.be/8m11sbfegoY

Re: [julia-users] why does Julia have both map and broadcast?

2016-05-24 Thread Gunnar Farnebäck
In case the accidental matrix happens to be huge you can also get into all sorts of memory shortage related inconveniences. Den tisdag 24 maj 2016 kl. 07:27:24 UTC+2 skrev Tony Kelman: > > I can see some situations where getting a matrix instead of a vector > because one of the inputs was

Re: [julia-users] Re: Plots problem ?

2016-05-24 Thread Henri Girard
Thanks, I use IJulia I delete it Le 24/05/2016 00:33, Andre Bieler a écrit : delete the readline if you run this in a notebook or in the julia REPL. leave it if you run it as a script.

[julia-users] Re: How to make a macro that is a synonym for another macro?

2016-05-24 Thread Jeffrey Sarnoff
unearthed the solution Nesting Macros ``` macro sameAction(a, b) quote @macroWithVeryLongName($a, $b) end end ``` (makes sense, pleased to see the obvious done