[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.

[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 situ

[julia-users] Declarative return types

2014-02-25 Thread Fil Mackay
I thought I saw this syntax somewhere in my learnings: function f()*::Int* 0 end Was this part of Julia at some point? I find myself wanting to constrain the return type, if only for readability but sometimes for parametric types to ensure the code is then correct to the defined signature.

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

2014-02-25 Thread Fil Mackay
> > What would :(x+y) produce - invalid or quote x + y end? This "inline > quote" format seems to be used quite a lot and handy. I have wondered about > using a different character for symbols and quotes to avoid this ambiguity. > What about using: Symbols: :name Quotes: `x+y` Therefore :(

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

2014-02-25 Thread Fil Mackay
> > The semantics of :symbol would not change from the *status quo* under my > proposal. > > Perhaps :(x) should be the same as :x rather than the same as quote x end. > Thus if the result of the unary : operator is just a symbol, it is always > an external symbol, but the *quote* special form

Re: [julia-users] Does any one has experience in computer aided translating? ¿( .rst -> .po )?

2014-02-25 Thread Ismael VC
Both translations spanish and chinese seem to be down! Anyway yeah it looks an easy task, sphinx is a nice tool, I'm just wondering under which license should it be released, I'm reading on MIT license, I but haven't really used any license seriously at all. Ismael VC El lunes, 24 de febrero

[julia-users] Re: [ANN] Formatting.jl: a Julia package for python-like formatting

2014-02-25 Thread Dahua Lin
Andrew, Thanks for your interest. Currently, the most efficient way is to first construct an instance of FormatExpr and applies it repeatedly. The original motivation was to provide a run-time counter part of @printf and friends. It doesn't support macros at this point, but may consider adding

Re: [julia-users] Re: Seeing Segmentation Fault

2014-02-25 Thread Tim Holy
Try a "make clean; make" first, and if that doesn't fix it, please submit your test script to #5106; we could really use a reproducible test case for this! --Tim On Tuesday, February 25, 2014 04:24:07 PM Joey Huchette wrote: > Looks superficially similar > to https://github.com/JuliaLang/julia/i

[julia-users] Re: [ANN] Formatting.jl: a Julia package for python-like formatting

2014-02-25 Thread andrew cooke
oh, also, i always assumed that @printf was a macro so that it could do this compilation at compile time. have you considered implementing a macro that is similarly efficient? then someone could write @printfmt("...", ...") and still (i guess) have things precompiled. andrew On Tuesday

[julia-users] Re: [ANN] Formatting.jl: a Julia package for python-like formatting

2014-02-25 Thread andrew cooke
this looks nice, but i have some questions :o) first, if i want efficient printing, is printfmt(FormatExpr(""), ...) sufficient? does the compiler lift the FormatExpr into a constant? or do i need to b more explicit. something like const fmt = FormatExpr("...") # top level

[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 in

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

2014-02-25 Thread andrew cooke
sweet. i'd like to see something like "% coverage". for Number, for example, what % of concrete types have abs() defined? another useful statistic, which might not be possible, is across how many modules is a function used - for example, which operation on Number occurs in most modules? whic

[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 r

[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. >

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

2014-02-25 Thread Leah Hanson
I'm planning to add a "which methods are defined for subtypes of this type" function to TypeCheck.jl this week. If there's any specific behavior you want it to have, let me know. :) -- Leah On Tue, Feb 25, 2014 at 2:52 PM, David Moon wrote: > On Tuesday, February 25, 2014 7:14:37 AM UTC-5, Dav

[julia-users] Seeing Segmentation Fault

2014-02-25 Thread Michael Schnall-Levin
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 running julia 0.3.0-prerelease+1564 on Ubuntu 12.04. Any help is very appreciated. Thanks, Mike -- Err

[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, a

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 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 > >> > t

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

2014-02-25 Thread David P. Sanders
El domingo, 23 de febrero de 2014 15:56:35 UTC-6, Ivar Nesje escribió: > > @time begin >#code > end Should have guessed that, thanks!

[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 with

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 > > > wrote: > > > > > > El viernes, 21 de feb

[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 pre

[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.

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] 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] 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 given

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] 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 4.5

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]

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 = [1,2,

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, a

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. > https://git

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 bette

[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 UTC

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 wrote: > I was talking about fully automatic memoization, which does not play > nicely with the type system. Thus, it's a sp

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 wrote: > Given two independent random variables X and Y following two distributions, > is there a way to compute the distribution of X+Y,

[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 startin

[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 buff

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). That

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,

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] 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 app

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

2014-02-25 Thread Ivar Nesje
We also have 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 p

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

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 memo

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 overloads the > indexing operator for this purpose instead. > Many thanks thanks for your ans

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

2014-02-25 Thread alex
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. On Tuesday, February 25, 2014 8:30:21 AM UTC-8, Tim Holy wrote: > > If you visit the issues pa

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). Specifi

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 c

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, wrote: > Met John Myles White the

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

2014-02-25 Thread Simon Byrne
On Monday, 24 February 2014 11:34:22 UTC, Hans W Borchers wrote: > > This innocent looking test function appears to be so flat that only an > arbitrary precision solver will locate this root more exactly. > I think what is required in this case is a more accurate implementation of the function

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

2014-02-25 Thread alex
Met John Myles White the other day and he mentioned an upcoming breaking change in array view behavior, which I also just saw referenced in #5949. What do you guys think about putting together a page that tracks potential and likely breaking changes? It could really just be a list of GitHub issu

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 Marek

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

2014-02-25 Thread Stefan Karpinski
We've discussed it, but at this point function call syntax is not overloadable. Grid.jl overloads the indexing operator for this purpose instead. On Tue, Feb 25, 2014 at 5:34 AM, Marek Gagolewski wrote: > Dear all, > > Is it possible in Julia to define a C++-

[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 repositor

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

2014-02-25 Thread Marek Gagolewski
Dear all, Is it possible in Julia to define a C++-like operator() for its "struct-like" composite types (defined with typeend)? Thanks to such a method, one may treat an object as a function. Here's a GitHub gist illustrating what I'm trying to achieve: https://gist.github.com/gagolews/920

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

2014-02-25 Thread Hans W Borchers
Well, functions like `x -> exp(-x^3)-1` or `x -> (x^3 + 1) - 1` have obvious roots. The root of the test function above is not that obvious. To tell the rest of the story: I once tried to symbolically solve it with Mathematica Mathematica> Solve[Log[x] + x*x/(2*Exp[1]) - 2*x/Sqrt[Exp[1]] +

[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 kin

[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 multi

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 ca

[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 the

[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] 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