[julia-users] Re: What is a Number?

2014-02-25 Thread Fabian Gans
Just a note, there is also the TypeCheck.jl package which has the function check_method_calls that tests your code for possible no method errors. I think this would be a good starting point towards an automatic analysation tool, that checks which methods should be defined for a new type which

[julia-users] Re: What is a Number?

2014-02-25 Thread andrew cooke
additional thanks :o) On Tuesday, 25 February 2014 05:43:14 UTC-3, Fabian Gans wrote: Just a note, there is also the TypeCheck.jl package which has the function check_method_calls that tests your code for possible no method errors. I think this would be a good starting point towards an

[julia-users] Immutable types and caching

2014-02-25 Thread andrew cooke
To what extent does the system cache / reuse immutable instances? For example, I have a zero(...) function that returns zero for a particular (immutable) numeric type. Do I need to cache that myself, or will the system somehow intern values and re-use the same instance? Bonus question - is

Re: [julia-users] Hygienic macros could be both better and simpler

2014-02-25 Thread David Moon
I should have said *quote* special form implicitly accessed a symbol context created each time a *named* function is entered or a top-level form is evaluated. Can't have anonymous functions implicitly create a symbol context or you can't use functionak programming inside of macros and you

[julia-users] Re: What is a Number?

2014-02-25 Thread David Moon
On Monday, February 24, 2014 6:54:59 AM UTC-5, andrew cooke wrote: Maybe (I don't think so) Julia needs some kind of concept like abstract methods, where you can name methods for Number that any subtype must implement? Long ago in Flavors this was called required methods. With multiple

[julia-users] Re: What is a Number?

2014-02-25 Thread andrew cooke
but julia isn't that kind of language, is it? it's a language that has eval and macros; a language where compile time is a blurry concept (although not so blurry as other dynamic languages). i agree that this kind of idea - interfaces in java or ADTs in general - is useful for certain kinds

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

2014-02-25 Thread ben
Hi, Is it possible for two different packages to contain identically named modules? For instance, if I fork a package Galaxy.jl, and then Pkg.clone(github/fork/url/Galaxy.jl.git, GalaxyBlue) (So that both the original package and my forked version live side-by-side in my .julia

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Tim Holy
First, are you looking for anonymous functions? http://docs.julialang.org/en/latest/manual/functions/#anonymous-functions Second, I suspect Grid.jl already does exactly what you're asking re interpolation. https://github.com/timholy/Grid.jl --Tim On Tuesday, February 25, 2014 02:34:11 AM

Re: [julia-users] Tracking potential breaking changes with unit tests

2014-02-25 Thread Stefan Karpinski
Really breaking changes are rare and broadly announced, so I'm not really sure this is necessary. Packages are much more wild about making changes that will break your code than the core language is – which is as it should be. On Tue, Feb 25, 2014 at 11:21 AM, a...@10xtechnologies.com wrote:

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

2014-02-25 Thread John Myles White
I think the core insight is that a package has two components: (1) A module called GalaxyBlue (2) A file, in a searchable package directory like Pkg.dir(), that’s called something like GalaxyBlue/src/GalaxyBlue.jl. For 2, that means you have a directory (usually a repo) containing the package

Re: [julia-users] Tracking potential breaking changes with unit tests

2014-02-25 Thread Tim Holy
If you visit the issues page and click on breaking in the labels on the left, you'll get the whole list. If there is a breaking change that hasn't had that label applied, please file an issue. But I don't think a separate web page would be any easier to keep in sync (to the contrary).

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Marek Gagolewski
On Tuesday, February 25, 2014 4:24:48 PM UTC+1, Stefan Karpinski wrote: We've discussed it, but at this point function call syntax is not overloadable. Grid.jl https://github.com/timholy/Grid.jl overloads the indexing operator for this purpose instead. Many thanks thanks for your answer.

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Jeff Bezanson
No, you don't need to cache it yourself. The compiler will freely copy immutable values, and there isn't anything you can do to stop it. Most of these copies will not be heap-allocated, but those that are cannot be intercepted. Memoize.jl turns up a google result, but we don't have a standard

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Stefan Karpinski
The best way to see what's going on is with the code_llvm and code_native functions. For example, here's a case of a function defined to use zero(ModInt{11}): julia include(examples/modint.jl) showcompact (generic function with 9 methods) julia f() = zero(ModInt{11}) f (generic function with 1

Re: [julia-users] Tracking potential breaking changes with unit tests

2014-02-25 Thread Ivar Nesje
We also have NEWS.mdhttps://github.com/JuliaLang/julia/blob/master/NEWS.md where we (try to) keep a up to date list of everything we change that (we think) might cause trouble or joy for users. kl. 17:30:21 UTC+1 tirsdag 25. februar 2014 skrev Tim Holy følgende: If you visit the issues page

Re: [julia-users] Blog post on floating point basics with Julia examples

2014-02-25 Thread Hans W Borchers
Thanks for your offer. The function above was only a test case, but I had requests where it was necessary to return zeros exactly in double precision. I solved this -- for the test and other functions -- utilizing the 'mpfr' software for arbitrary precision. Actually, Ridders' method can be

Re: [julia-users] Tracking potential breaking changes with unit tests

2014-02-25 Thread Tim Holy
#5556 --Tim On Tuesday, February 25, 2014 08:49:26 AM a...@10xtechnologies.com wrote: The [breaking] tag in GitHub is just what I was looking for, thanks for pointing it out. Which is the issue for the array slicing going from copy to reference? I think that's the change JWM mentioned.

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Kevin Squire
What you're suggesting is memoization, which has come up a number of times. The short version is that it is an easy way to speed up a slow language but is worse than useless in fast languages. You don't see people doing memoization in C or Fortran, do you? That's a little, um, strong, don't

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Stefan Karpinski
I was talking about fully automatic memoization, which does not play nicely with the type system. Thus, it's a speedup in a language where every function is loosely typed anyway, but a distinct slow down in a language with nice type behavior (and an implementation smart enough to leverage it).

[julia-users] Re: UDP Support

2014-02-25 Thread Bob Cowdery
I now have communication with my hardware but there are 2 further things I need for this to be viable to even get me off the ground. I've asked the questions before so I'd appreciate a reply from the implementers even if its a can't do. How do I set a timeout on a recv(). How do I set the

[julia-users] operations on distributions

2014-02-25 Thread harven
Given two independent random variables X and Y following two distributions, is there a way to compute the distribution of X+Y, X*Y, F(X) where F is some real function, or the distribution of the pair (X,Y)? The Distributions package is nice but I didn't find a way to build distributions

Re: [julia-users] operations on distributions

2014-02-25 Thread John Myles White
There's an issue open for doing this, but we haven't done much work on it. It's a little tricky to get right. -- John On Feb 25, 2014, at 11:25 AM, harven har...@free.fr wrote: Given two independent random variables X and Y following two distributions, is there a way to compute the

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Kevin Squire
Given Andrew's original post, that makes sense, although it wasn't clear to me from just reading your response. Cheers! On Tue, Feb 25, 2014 at 11:17 AM, Stefan Karpinski ste...@karpinski.orgwrote: I was talking about fully automatic memoization, which does not play nicely with the type

[julia-users] Re: operations on distributions

2014-02-25 Thread Jason Merrill
You might also take a look at ApproxFun.jl https://github.com/dlfivefifty/ApproxFun It includes some state of the art code for sampling from approximately represented distributions, and a way to do arithmetic on the distributions to make new ones. On Tuesday, February 25, 2014 11:25:24 AM

Re: [julia-users] Immutable types and caching

2014-02-25 Thread andrew cooke
hmmm. ok, thanks. i'll see what is generated for my code. i think i still need memoization, though, as i have a dynamic programming issue (a recursive function that will change from exponential to polynomial time, i guess, if I cache intermediate results). or is there a reason why it's

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Marek Gagolewski
On Tuesday, February 25, 2014 5:16:13 PM UTC+1, Tim Holy wrote: First, are you looking for anonymous functions? http://docs.julialang.org/en/latest/manual/functions/#anonymous-functions Second, I suspect Grid.jl already does exactly what you're asking re interpolation.

Re: [julia-users] Immutable types and caching

2014-02-25 Thread andrew cooke
thanks; that looks like it will at least get me started. andrew https://github.com/simonster/Memoize.jl/blob/master/src/Memoize.jl On Tuesday, 25 February 2014 13:56:39 UTC-3, Jeff Bezanson wrote: No, you don't need to cache it yourself. The compiler will freely copy immutable values, and

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread andrew cooke
this is kinda obvious, so i suspect it's not what you want, but just in case... function make_interp(x, y) function interp(x2) @assert x2 x[1] x2 x[end] i = 1 while x[i] x2; i += 1; end (x[i] - x2) * y[i-1] + (x2 - x[i-1]) * y[i] end end x =

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread andrew cooke
oh, and i forgot to normalize by the x delta. On Tuesday, 25 February 2014 17:47:16 UTC-3, andrew cooke wrote: this is kinda obvious, so i suspect it's not what you want, but just in case... function make_interp(x, y) function interp(x2) @assert x2 x[1] x2 x[end] i

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Marek Gagolewski
Dear Andrew, Nope, unfortunately it's not what I am trying to achieve. The code you've kindly (let's forget the interpolation task, what I really meant is some programming construct, so it's OK with no delta_x) submitted gives: my_interp = make_interp(x, y) println(my_interp(2.1)) # prints

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Tom Short
Does this give you what you want: function make_interp(x, y) y = copy(y) function interp(x2) @assert x2 x[1] x2 x[end] i = 1 while x[i] x2; i += 1; end (x[i] - x2) * y[i-1] + (x2 - x[i-1]) * y[i] end end x = [1,2,3,4,5] y = [x2^2 for x2 in x]

Re: [julia-users] Immutable types and caching

2014-02-25 Thread Simon Kornblith
To make type inference for memoized functions suck less, all we'd need is a way to get a function's inferred return type for a given set of inputs in a way that can be used by type inference, and then we could use that to put a typeassert on the result. This doesn't actually seem that hard

[julia-users] obtaining what used to be returned by showcompact(fp::Float64)

2014-02-25 Thread Douglas Bates
With the addition of _output_limit in base/show.jl ,showcompact(float(pi)) in the REPL has reverted to showing 3.141592653589793. Until recently it would display 3.14159 I have been using `showcompact` when printing out verbose information on the iteration progress in optimization algorithms.

Re: [julia-users] C++-like operator() for Julia's composite types

2014-02-25 Thread Marek Gagolewski
On Tuesday, February 25, 2014 10:27:47 PM UTC+1, tshort wrote: Does this give you what you want: [...] Thanks very much, this is exactly the solution I needed. :) All the best Marek

[julia-users] Re: operations on distributions

2014-02-25 Thread harven
Thanks a lot for the answers. At the moment, I am trying some hack with the conv function when the distributions are discrete. The continuous case is definitely more difficult.

[julia-users] Re: List of testing packages to date

2014-02-25 Thread andrew cooke
On Tuesday, 25 February 2014 00:53:57 UTC-3, Iain Dunning wrote: UnitTest.jl - Unlisted - https://github.com/analyzere/UnitTest.jl - Writes output to XML for Jenkins(?) junit style output (and xunit in general) can certainly be read by jenkins. but also by pretty

Re: [julia-users] Re: Best data structure to remove elements one by one

2014-02-25 Thread David P. Sanders
El domingo, 23 de febrero de 2014 18:09:36 UTC-6, Jeff Bezanson escribió: This was just changed on master so that you'd do Set([i*2 for i in 1:5]). OK, that seems reasonable, thanks. On Sun, Feb 23, 2014 at 12:45 AM, David P. Sanders dpsa...@gmail.comjavascript: wrote: El

[julia-users] trouble running julia

2014-02-25 Thread Jon Norberg
I have been running julia for a while lately with ijulia and everything worked nicely. then I started building julia with brew --HEAD to keep up to date with the latest changes, worked well enough. But now something happened and nothing works, test run won't work even though julia installs

Re: [julia-users] List of indices of matrix satisfying certain criterion

2014-02-25 Thread David P. Sanders
El domingo, 23 de febrero de 2014 02:36:57 UTC-6, Mauro escribió: On Sun, 2014-02-23 at 05:51, dpsa...@gmail.com javascript: wrote: El viernes, 21 de febrero de 2014 08:25:00 UTC-6, Mauro escribió: Given a matrix, which will be large (say 10^5 x 10^5), I need to extract the

[julia-users] Re: What is a Number?

2014-02-25 Thread David Moon
On Tuesday, February 25, 2014 7:14:37 AM UTC-5, David Moon wrote: The advantage of making it an explicit concept in the language, rather than just defining a method that signals an error, is that it can be checked at compile time. In Julia, compile time is load time. Specifically, after

[julia-users] Re: Seeing Segmentation Fault

2014-02-25 Thread Patrick O'Leary
What is the small script? On Tuesday, February 25, 2014 5:02:55 PM UTC-6, Michael Schnall-Levin wrote: Hello, I'm seeing a segmentation fault while running julia code. I got it to reproduce multiple times on a small script that I'm running. The only error message I got was below. I'm

[julia-users] Re: Seeing Segmentation Fault

2014-02-25 Thread Joey Huchette
Looks superficially similar to https://github.com/JuliaLang/julia/issues/5106 On Tuesday, February 25, 2014 6:02:55 PM UTC-5, Michael Schnall-Levin wrote: Hello, I'm seeing a segmentation fault while running julia code. I got it to reproduce multiple times on a small script that I'm

[julia-users] Re: trouble running julia

2014-02-25 Thread Simon Kornblith
Looks like https://github.com/JuliaLang/julia/issues/5750. Deleting sys.dylib as described there should fix this, but it will make Julia startup slower. If you compile yourself, it should fix this and startup should be fast. I don't think there's a major reason to run the prerelease binaries

[julia-users] Julia Design Patterns?

2014-02-25 Thread Robert Feldt
I really like Julia's dispatch mechanisms, type system and so on. I have found a number of different ways I use it to design libraries and programs. But it would be great with some patterns/ideas/feedback from more seasoned Julia programmers. What are your Julia Design Patterns? A concrete

[julia-users] Declarative return types

2014-02-25 Thread Ivar Nesje
https://github.com/JuliaLang/julia/issues/1090 It is a nice feature for documentation and to ensure correctness.