[julia-users] Re: Using Interpolations.jl How to define the behavior when out of bounds?

2016-09-04 Thread Tomas Lycken
Sorry for not getting back to you sooner on this. Indexing into an extrapolation object like that should work - if you haven't already solved that problem, could you please file an issue with a complete (runnable) code sample? Regarding the comprehension, did you do that in the repl or in a

[julia-users] Re: ANN: Julia 0.5.0-rc2 now available

2016-08-14 Thread Tomas Lycken
I just took the time to read the release notes more carefully, and I just want to congratulate everyone involved on a fantastic list of improvements. I've been away from the community for a little while, and

Re: [julia-users] Re: "eval cannot be used in a generated function"

2016-08-12 Thread Tomas Lycken
Julia’s parametric types are not generic enough to support this. In my experience, any time I’ve been inclined to reason like this about one of my use cases, someone (usually Tim Holy :P) has been able to show me a way that works just fine, without magic, by just using the type system in a

Re: [julia-users] Re: "eval cannot be used in a generated function"

2016-08-11 Thread Tomas Lycken
Late to the party, but what’s wrong with writing FastArray{1,10,1,10} (or even FastArray{10,10} if you’re OK with implicit 1-based indexing)? It seems that those (valid) type arguments could convey just as much information as FastArray(1:10, 1:10), and you could then handle any

Re: [julia-users] Adding tuples

2016-08-11 Thread Tomas Lycken
I guess this also depends on whether the benchmark (and the real scenario) involves doing this many times for the same N, or many times for different N. With the same N, it's probably going to be faster with Val{N}, but with many different N, using Val{N} is just going to make you pay the JIT

[julia-users] Re: Why is Julia 0.5 built from source almost twice as large (on disk) as Julia 0.4?

2016-08-11 Thread Tomas Lycken
lower >> if I already have the code I'm running locally. Once 0.5 is out for real >> I'll probably drop the source tree for 0.4, so "temporarily" freeing up a >> couple of gigs by deleting build intermediates is good enough for now. >> >> // T &g

Re: [julia-users] Re: map(mean, zip(v...)) doesn't scale

2016-08-10 Thread Tomas Lycken
I don't think there are such binaries - you'd have to build from source - but my reproduction was on rc1+1, so that bug is (probably) not relevant to this issue. // T On Wednesday, August 10, 2016 at 1:12:57 PM UTC+2, Tamas Papp wrote: > > Where can I find (64bit, Linux) binaries for rc1+1? >

[julia-users] Re: map(mean, zip(v...)) doesn't scale

2016-08-10 Thread Tomas Lycken
For completeness: I can reproduce this behavior for m1. m2 returns fine after a little over four times the time it took for 100 vectors. // T On Wednesday, August 10, 2016 at 11:34:08 AM UTC+2, Tamas Papp wrote: > > I was benchmarking code for calculating means of vectors, eg > > v =

[julia-users] Re: Why is Julia 0.5 built from source almost twice as large (on disk) as Julia 0.4?

2016-08-10 Thread Tomas Lycken
es is good enough for now. // T On Wednesday, August 10, 2016 at 10:49:38 AM UTC+2, Andreas Lobinger wrote: > > Hello colleague, > > On Wednesday, August 10, 2016 at 10:11:46 AM UTC+2, Tomas Lycken wrote: >> >> Both instances of Julia are runnable, so I don’t think I dele

[julia-users] Why is Julia 0.5 built from source almost twice as large (on disk) as Julia 0.4?

2016-08-10 Thread Tomas Lycken
After being away from Julia and the community for a couple of months, I started updating my Julia installations today in order to test some of my packages and make sure they’re ready for 0.5, and I started getting warnings about disk usage. Since I’m dual-booting Ubuntu and Windows on a

Re: [julia-users] Creating symbols

2016-04-20 Thread Tomas Lycken
I am all for changing this, but in the specific case of symbol/Symbol this is going to be massively breaking, and even if the fix is pretty simple (applying s/symbol\(/Symbol\(/ probably fixes 99% of the code) the timing needs to be right. What other cases are there of such functions that

[julia-users] Re: Warning on operations mixing BigFloat and Float64

2016-04-18 Thread Tomas Lycken
Adding a BigFloat and a Float64 should automatically promote both to BigFloats, avoiding precision loss for you. julia> BigFloat(2.9) + 0.3 3.199900079927783735911361873149871826171875 Do you have a case where this doesn’t happen? // T On Monday, April

Re: [julia-users] 'do' notation in documentation?

2016-04-18 Thread Tomas Lycken
If you'd like to share that document, it would be a valuable resource for others as well when trying to help out. It's not unlikely that at least a subset of the things in your list are things that are present (and perhaps even quite extensively so) in the documentation, but explained in a way

[julia-users] How to initialize a Matrix{T}?

2016-04-07 Thread Tomas Lycken
Matrices in Julia, unlike some other languages, aren't vectors of vectors - they are first class citizens of the multidimensional array system in Julia. Thus, A = Array(Float64,1,1) creates a 1x1 matrix that holds Float64s. In most cases, it's even better to use A = zeros(Float64, 1, 1)

[julia-users] strategy design pattern

2016-04-06 Thread Tomas Lycken
Multiple dispatch is actually really well suited for this. The idiomatic approach in Julia is quite similar to your c++ example, at least conceptually: immutable Foo end immutable Bar end alg(::Type{Foo}) = println("I'm using foo") alg(::Type{Bar}) = println("I'm using bar") strategy = Foo #

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-05 Thread Tomas Lycken
There are only 6 uses of // outside of rationals.jl in base (4 of those are in mpfr.jl), compared to 187 uses of div, and 22 uses of ÷. (that’s uses, not definitions, exports, documentation, although the ratios are very similar). Looking at packages, it seems also that div is used frequently,

[julia-users] Re: enforcing homogeneity of vector elements in function signature

2016-04-05 Thread Tomas Lycken
The reason you’re getting that method error is because of type parameter invariance - in short, even though F <: Foo{T}, we *don’t* have Vector{F} <: Vector{Foo{T}}. Until triangular dispatch lands, defining

Re: [julia-users] Re: Julia is a great idea, but it disqualifies itself for a big portion of its potential consumers

2016-04-04 Thread Tomas Lycken
It’s also entirely possible to create a macro that lets / do what you (the OP) want. @integer_division begin # in here, 5 / 2 == 2 end Basically, you’d just traverse the AST recursively and switch all calls to / for calls to div. (I admit, though I wouldn’t want to do it myself, nor

[julia-users] Re: How to specify a template argument as a super type

2016-04-02 Thread Tomas Lycken
If it's abstract, what is the purpose of the type parameter? In other words, what is the ultimate goal you're reaching for? //T On Saturday, April 2, 2016 at 3:17:34 AM UTC+2, Scott Lundberg wrote: > > You can define: > > abstract Name1{S <: Name2} <: Name3{S} > > but I want to define: > >

Re: [julia-users] Announcing JuDE: autocomplete and jump to definition support for Atom

2016-03-29 Thread Tomas Lycken
It would be nice, though, if it were somewhere documented - or even better, a meta-package with dependencies on all the others - to allow turning an already existing Atom installation into a Julia IDE *too*. I'd be much more interested in improving an editor I'm already using for other thing,

[julia-users] Re: Shuffle matrix in julia

2016-03-24 Thread Tomas Lycken
What do you want to achieve - shuffling along a dimension (i.e. shuffling rows or columns), or just shuffling all the numbers? For the latter, it can be achieved pretty easily by reshaping to a vector and back. This has the added benefit that it generalizes well to arbitrary dimensions:

[julia-users] Re: npm, left_pad and julia

2016-03-24 Thread Tomas Lycken
I guess there's an interesting discussion lurking here too, on what license requirements should be applied to all packages that we register in METADATA. One of the reasons that npm could just restore left-pad to the package repositories without consent from the author, is that the code was

[julia-users] Re: How do I, as efficiently as possible, iterate over the first and last elements along a given dimension of an array?

2016-03-23 Thread Tomas Lycken
gt;> julia> mapedges(A3,1) |> length >> 120 >> >> julia> mapedges(A3,2) |> length >> 80 >> >> julia> mapedges(A3,3) |> length >> 150 >> >> >> On Thursday, March 24, 2016 at 2:53:48 AM UTC+2, Tomas Lycken wrote: >

[julia-users] Re: How do I, as efficiently as possible, iterate over the first and last elements along a given dimension of an array?

2016-03-23 Thread Tomas Lycken
by slicing, or by iteration), but I only want to visit the “edges”. I might be missing something, though. // T On Thursday, March 24, 2016 at 1:48:36 AM UTC+1, Tomas Lycken wrote: Yes, probably - thanks for the tip! I'll see if I can cook something up... > > On Thursday, March 24, 2016 at 1

[julia-users] Re: How do I, as efficiently as possible, iterate over the first and last elements along a given dimension of an array?

2016-03-23 Thread Tomas Lycken
Yes, probably - thanks for the tip! I'll see if I can cook something up... On Thursday, March 24, 2016 at 1:45:32 AM UTC+1, Benjamin Deonovic wrote: > > Can mapslices help here? > > > On Wednesday, March 23, 2016 at 6:59:59 PM UTC-5, Tomas Lycken wrote: >> >> Is

[julia-users] How do I, as efficiently as possible, iterate over the first and last elements along a given dimension of an array?

2016-03-23 Thread Tomas Lycken
Is there an effective pattern to iterate over the “endpoints” of an array along a given dimension? What I eventually want to accomplish is to apply a function (in this case an equality test) to the two end points along a particular dimension of an array. I think the pattern is easiest

Re: [julia-users] Help needed regarding INERITANCE

2016-03-23 Thread Tomas Lycken
I've recently experimented with a macro that solves a related problem (although for different reasons). Basically it allows you to solve the same problems you could solve using polymorphism, but by easing the burden of composition. It might be helpful here too.

[julia-users] Declaring a typealias that is also subtype of an abstract type

2016-03-21 Thread Tomas Lycken
Hah - only a couple of hours ago I uploaded this notebook, which outlines one possible way of getting there: http://nbviewer.jupyter.org/github/tlycken/IJulia-Notebooks/blob/master/Using%20macros%20to%20implement%20value-objects%20and%20other%20simple%20wrappers%20in%20Julia.ipynb // T

Re: [julia-users] Re: Parametric splines?

2016-03-20 Thread Tomas Lycken
I tried googling for “parametric splines” but didn’t end up with a concise definition of what they are. If B-splines fit your needs (and it seems from the SciPy documentation that it might do), maybe Interpolations.jl would be useful enough? The

[julia-users] Re: what name would you give to the functional 'complement' of trunc()?

2016-03-12 Thread Tomas Lycken
I think stretch was a pretty good suggestion, actually. trunc as in “truncate” makes sense for taking 3.14 -> 3 and -2.718 -> -2; you quite literally truncate the decimal representation of the number by chopping off the decimals. I could imagine the opposite, 3.14 -> 4 and -2.718 -> -3, as

[julia-users] Re: flatten arrays

2016-03-10 Thread Tomas Lycken
No, vec doesn't help because I have an array of arrays (actually a vector of vectors), not a multidimensional array. (I think vec would actually be a noop...) Flatten.jl might provide some useful idioms, but my application is json deserializing, so I can't restrict myself to fixed-size

[julia-users] Re: good practice question: dispatch on type or on type instance

2016-03-10 Thread Tomas Lycken
I recently decided to switch the arguments in Interpolations.jl from types to instances, although in that case it actually made the interface a little uglier rather than prettier. The main reason was that I suddenly had the need for the flexibility provided by allowing for instance fields on

Re: [julia-users] flatten arrays

2016-03-10 Thread Tomas Lycken
This was the most recent mention of recursive array flattening that I could find - has anything happened since? Is this available somewhere (I couldn't find it in base)? // T

Re: [julia-users] Meshgrid function

2016-03-07 Thread Tomas Lycken
The thing with meshgrid, is that it’s terribly inefficient compared to the equivalent idioms in Julia. Instead of implementing it and keeping with inefficient habits, embrace the fact that there are better ways to do things :) Since this question is recurring, I think the problem might

Re: [julia-users] Re: [ANN] MathGL graphics library wrapper

2016-03-05 Thread Tomas Lycken
Just guessing by the name, but it seems to me that you might be able to leverage Interpolations.jl to get rid of the dependency on Splines.jl. https://github.com/tlycken/Interpolations.jl // T

Re: [julia-users] Re: Non-uniform interpolation in 1D

2016-02-28 Thread Tomas Lycken
Gridded here is the *interpolation scheme*, as opposed to (implicitly uniform) BSpline interpolation; it’s simply the way Interpolations.jl lets you specify which algorithm you want to use. Compare the following incantations: itp = interpolate(A, BSpline(Linear()), OnGrid()) # linear

Re: [julia-users] Re: Non-uniform interpolation in 1D

2016-02-28 Thread Tomas Lycken
Higher than linear order interpolation on irregular grids is not supported in either Grid.jl or Interpolations.jl (and since the latter is a replacement for the former, it probably never will be supported in Grid). If you have a good scheme that you'd like to see implemented, do file an issue

Re: [julia-users] Are dataframes the best way to manipulate data?

2016-02-23 Thread Tomas Lycken
Re. something like C#’s LINQ, I think we will see a massive transformation of how people write Julia code once 0.5 arrives, since then we will have fast anonymous functions. This in turn will make functional-style idioms like collection pipelines

Re: [julia-users] How do I deprecate iteration for a custom iterator?

2016-02-21 Thread Tomas Lycken
element*. How do I give just one warning? // T On Sunday, February 21, 2016 at 4:53:19 PM UTC+1, Milan Bouchet-Valat wrote: Le dimanche 21 février 2016 à 07:30 -0800, Tomas Lycken a écrit : > > In a package, I have a method foos which currently returns a > > collection of Bars. This

[julia-users] How do I deprecate iteration for a custom iterator?

2016-02-21 Thread Tomas Lycken
In a package, I have a method foos which currently returns a collection of Bars. This is a little unfortunate, so I would like to instead return a value of type FooCollection on which I can call the bar function to get the array of Bars. I can get backwards compatibility by making

Re: [julia-users] Options for constructing a 3D surface from a point cloud

2016-02-21 Thread Tomas Lycken
There is a marching squares algorithm implemented in [Contour.jl](https://github.com/tlycken/Contour.jl) too; I have put some thoughts on API design in writing in [this issue](https://github.com/tlycken/Contour.jl/issues/29). Meshing.jl might be a better place for these algorithm anyway (and

Re: [julia-users] Appveyor: Private repos using private repos

2016-02-20 Thread Tomas Lycken
I'm just guessing here, but I think it could work if you specify the url using https rather than the git protocol. That is, https://github.com/EricForgy/Pages.jl.git instead of g...@github.com:EricForgy/Pages.jl.git. That error message could be made a lot better though, by just listing the

[julia-users] Re: Convert a collection to an array

2016-02-18 Thread Tomas Lycken
) 20x2 Array{Float64,2}: 0.7513460.212002 ... 0.52188 0.121669 // T On Thursday, February 18, 2016 at 7:35:15 PM UTC+1, Tomas Lycken wrote: If it’s not longer than that, you can easily do that with hcat: > > julia> ySol = [rand(2) for _ in 1:20] > 20-element Array{

[julia-users] Re: Convert a collection to an array

2016-02-18 Thread Tomas Lycken
If it’s not longer than that, you can easily do that with hcat: julia> ySol = [rand(2) for _ in 1:20] 20-element Array{Array{Float64,1},1}: [0.6383963589240325,0.952443724507759] [0.8543445393734637,0.5497614848396764] [0.7180883594522589,0.2699980988282249]

[julia-users] Re: Coordinates of graph layout algorithms

2016-02-10 Thread Tomas Lycken
Without having looked at the code, I'd say that such a separation effort is definitely the way to go (in fact, I created the Contours.jl package for very similar reasons, based on code originally in Gadfly). I would even think it makes sense to move the Compose-based drawing into Gadfly, to

Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Tomas Lycken
My main concern is predictability. Imagine that I define a type Foo and start playing around with it - define some functions that work on foot, perhaps one or two types that hold foos, and manipulate a bunch of Foo instances. Then, I redefine the Foo type - say, I add a field. Which of the

[julia-users] Re: Julia vs Matlab: interpolation and looping

2016-01-30 Thread Tomas Lycken
I'd love to add non-uniform interpolation schemes of higher degree than linear to Interpolations.jl - the two main reasons for why it hasn't been done already are time (focus has been on reaching feature parity with Grid.jl, for which the package started out as a replacement effort) and

[julia-users] write julia consolle output in a text file

2016-01-29 Thread Tomas Lycken
For example open("log.txt", "w") do f write(f," Hello, text file!") end or julia your-script.jl > log.txt depending on how you invoke your Julia code and what you mean by "console output". // T

[julia-users] Using Interpolations.jl How to define the behavior when out of bounds?

2016-01-26 Thread Tomas Lycken
Yes, that's the correct way to specify the extrapolation behavior, but you don't seem to use it afterwards; your last two lines refer to Uinterp and Vinterp, rather than Uextrap and Vextrap. To get the desired behavior for OOB indices, you must index into the result of extrapolate(...). If

[julia-users] Great read as Julia's package ecosystem grows ("a la npm" nested dependencies)

2016-01-26 Thread Tomas Lycken
Interesting read (or skim, in my case)! I think there are some major problems with npm's nested approach too - for example, file paths tend to become so long that at least Windows has real troubles handling them (it's not fun to try to get out of a situation where you can't delete a folder

Re: [julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Tomas Lycken
Interesting read, thanks! I guess I'll hold off implementing this until 0.5 lands, then. // T On Monday, January 25, 2016 at 7:56:15 PM UTC+1, Yichao Yu wrote: > > On Mon, Jan 25, 2016 at 1:49 PM, Tomas Lycken <tomas@gmail.com > > wrote: > > On e.g. Arrays, I can

[julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Tomas Lycken
On e.g. Arrays, I can index with @inbounds to avoid bounds checking. In my own custom type, which also implements getindex, what is the correct way of leveraging inbounds? For example, I have code now that looks something like this: function getindex(A::MyCustomArray, x) ix =

[julia-users] Re: problems reading a file

2016-01-24 Thread Tomas Lycken
Try converting from binary to text with UTF8String instead of ASCIIString - then all characters should display correctly. //T

Re: [julia-users] Re: Code review request: interacting with another program via stdin, stdout, stderr.

2016-01-11 Thread Tomas Lycken
values read from the different streams. Inspired by the wrapper idea, I > wrapped them in a type so that it becomes clear that they are always > strings; hopefully this will help with performance. > > The latest version of the code is at > https://gist.github.com/mbaz/bb7e2cbaaecc031b1d8

[julia-users] Re: Code review request: interacting with another program via stdin, stdout, stderr.

2016-01-11 Thread Tomas Lycken
Interesting question! If you find a good approach to do this, wrapping it in a package is certainly interesting (have you checked that there aren’t any packages that handle this already?). I can’t help much with the threading stuff, but regarding your global variable it should be possible to

[julia-users] PriorityQueue allowing multiple elements with same priority

2016-01-08 Thread Tomas Lycken
I tried this today: immutable State a::Int b::Int end import Base.Collections: PriorityQueue, enqueue!, dequeue!, peek pq = PriorityQueue(Int,Int) enqueue!(pq, State(5,3), 4) enqueue!(pq, State(5,3), 2) but it fails with the error LoadError: ArgumentError: PriorityQueue keys must

[julia-users] Re: Iterating over leafs of a tree: use Cartesian?

2016-01-07 Thread Tomas Lycken
I don’t think so; your way of determining the loop ranges is a little bit too specific. The only two ways of generating loop bounds is either from a variable referencing an array (or array-like object), in which case the bounds will be determined by the size of the array, or with an

Re: [julia-users] Re: what's the difference btwn multiple dispatch and c++ overloading?

2015-12-23 Thread Tomas Lycken
There's also the complication that "run time" and "compile time" are much easier to define in C++ than in Julia... // T On Wednesday, December 23, 2015 at 2:21:07 PM UTC+1, Stefan Karpinski wrote: > > That's correct. Semantically, multiple dispatch is resolved at run time, > but in practice,

Re: [julia-users] How to change the character at a specific position of a string?

2015-12-23 Thread Tomas Lycken
If/when you need the result, you can use join to get a string. For example: julia> as = collect("") 4-element Array{Char,1}: 'a' 'a' 'a' 'a' julia> as[2] = 'b' 'b' julia> as 4-element Array{Char,1}: 'a' 'b' 'a' 'a' julia> join(as) "abaa" // T On Tuesday, December 22, 2015 at

[julia-users] Re: Array view without a single element

2015-12-22 Thread Tomas Lycken
returning, I push! the item back on the list. // T On Monday, December 21, 2015 at 9:33:17 PM UTC+1, Tomas Lycken wrote: The algorithm I want to implement is fairly simple - it's a basic change > making problem: "given the following coins [20 coins with integer-values > between 1 and 5

[julia-users] Re: Array view without a single element

2015-12-21 Thread Tomas Lycken
The algorithm I want to implement is fairly simple - it's a basic change making problem: "given the following coins [20 coins with integer-values between 1 and 50] how many ways is there to combine them to get a total value of 150? two coins with equal value contribute one time each to a

[julia-users] Array view without a single element

2015-12-21 Thread Tomas Lycken
Is there a way to construct a view into an array that skips a single element? For example, to view v except the element at index p, I can do sub(v, [1:p-1;p+1:length(A)]). However, allocating the array with indices is a bottleneck in my code. Is there a way or trick to get rid of it? I’m

[julia-users] Survey: what documentation platforms do you use? Are you happy?

2015-12-20 Thread Tomas Lycken
Over at Interpolations.jl, we've started thinking about restructuring our documentation a little. We basically have (or will have) three levels of documentation: usage docs, specifying how to use the library; math docs, fleshing out the mathematical background to the algorithms and assumptions

[julia-users] Re: advent of code -- day 3

2015-12-15 Thread Tomas Lycken
Probably because the arrays will not be equal even if their contents are equal (this is true of most mutable types in Julia). If you try representing a position as a tuple `(0,0)` instead of as an array `[0,0]`, you'll find that it works as expected. // T On Tuesday, December 15, 2015 at

[julia-users] Re: @time tic() toc()

2015-12-11 Thread Tomas Lycken
Try @time @sync @parallel for i=1:10 ... end On Thursday, December 10, 2015 at 11:55:58 PM UTC+1, digxx wrote: > > Apparently for a parallel loop the @time macro or tic() toc() do not > measure the time?! > I directly get a result for the time but know that the calculation is > still

[julia-users] Re: Is there a 'smooth.spline' function in Julia as in R? Thank you!

2015-12-10 Thread Tomas Lycken
Check out the Interpolations package: https://github.com/tlycken/Interpolations.jl It supports quadratic splines today, with a PR for cubic splines which has come quite far through the review process. The interface is not quite what you're used to from R, but I think you'll find that it's

[julia-users] Re: JuliaBox not working since upgrade to 0.4.2

2015-12-10 Thread Tomas Lycken
Hm. I still see the problem... // T On Thursday, December 10, 2015 at 9:51:50 PM UTC+1, cdm wrote: > > > appears to be resolved, per a check moments ago (see attached ...). > > the 0.5 dev notebook seems to work fine, as well. > > anyone aware of a means for choosing which version > of Julia to

Re: [julia-users] Re: range bug in 0.4.1?

2015-12-07 Thread Tomas Lycken
I think it makes perfect sense. If you need a range object where you know the start and ending points, you use colon (i.e. `start:step:stop`). If you know how many elements you want and what step, but you don't know (or care so much) about the stopping point, you use `range`. Just because *you*

[julia-users] Re: what's the easiest way to force a recompilation?

2015-12-04 Thread Tomas Lycken
Remove the .ji file in .julia/v0.4/.cache; next time you import the package, it's re-compiled. // T On Friday, December 4, 2015 at 11:50:03 PM UTC+1, Seth wrote: > > I'd rather not alter any of the source files. Is there a Pkg command that > will recompile? (Pkg.build() doesn't seem to do it).

Re: [julia-users] Proposal: NoveltyColors.jl

2015-12-03 Thread Tomas Lycken
randy@fuqua.duke.edu > > wrote: > >> On Wednesday, December 2, 2015 at 3:12:36 AM UTC-5, Tomas Lycken wrote: >>> >>> Also, the naming discussion here is not *only* on naming; it's also on >>> the possibility of including *more things *in the package. I wo

Re: [julia-users] Proposal: NoveltyColors.jl

2015-12-02 Thread Tomas Lycken
Also, the naming discussion here is not *only* on naming; it's also on the possibility of including *more things *in the package. I would be all for having a package like Palettes.jl, which would include both NoveltyColors.jl and other palettes, but that's not in conflict with the current

Re: [julia-users] Best method for inputting logic as a variable in a function

2015-12-02 Thread Tomas Lycken
Martin Fowler published a (rather long) blog post on the topic of refactoring code into data, which I think is a nice addition in this thread even though you already have a working solution: http://martinfowler.com/articles/refactoring-adaptive-model.html His solution to this problem would

[julia-users] Re: Concatenation without splatting

2015-11-30 Thread Tomas Lycken
s is bad. Thank you for the > answers everyone. > > Cédric > > On Monday, November 30, 2015 at 1:32:42 AM UTC-5, Tomas Lycken wrote: >> >> For hcat, what shape would you want the output to have? >> >> With your example input, the result of vcat is

[julia-users] Re: Concatenation without splatting

2015-11-29 Thread Tomas Lycken
For hcat, what shape would you want the output to have? With your example input, the result of vcat is straightforward: v = [[1],[2,3],[4,5]] vcat(v...) # -> [1, 2, 3, 4, 5] But for hcat, what output would you want? hcat(v...) throws a DimensionMismatch error stating that vectors must have

[julia-users] [OT?] Will Bret Victor's answer to "What can a technologist do about climate change?" get you to file your first PR? :)

2015-11-25 Thread Tomas Lycken
A friend just sent me a blog post by Bret Victor, whom I find to be one of the more inspiring individuals in the tech community today. The blog post is titled *What can a technologist do about climate change? (a personal view) * (

Re: [julia-users] Concatenation without splatting

2015-11-23 Thread Tomas Lycken
That doesn’t quite seem to do what you want, Mauro: julia> arr_of_arr = Vector{Int}[[1],[2,3],[4,5]] 3-element Array{Array{Int64,1},1}: [1] [2,3] [4,5] julia> vcat_nosplat(y) = eltype(y[1])[el[1] for el in y] vcat_nosplat (generic function with 1 method) julia> vcat_nosplat(arr_of_arr)

Re: [julia-users] Concatenation without splatting

2015-11-23 Thread Tomas Lycken
nd > > (@benchmark shows way less allocations and 2-3x time) > BTW the splat version is just as quick, but perhaps allocation on stack is > problematic (anybody check the limit?) > > On Monday, November 23, 2015 at 12:07:18 PM UTC+2, Tomas Lycken wrote: >> >> That doesn’t

[julia-users] Re: push! performance

2015-11-16 Thread Tomas Lycken
t; > julia> @time b = zeros(Int,10_000_000); > 0.037202 seconds (35 allocations: 76.295 MB, 64.13% gc time) > > julia> Base.summarysize(b) > 8000 > > > > On Monday, November 16, 2015 at 1:10:36 AM UTC-8, Tomas Lycken wrote: >> >> sizehint! preallocates

[julia-users] Re: Progress meter for parallel workers

2015-11-16 Thread Tomas Lycken
There has been some discussion about this, see https://github.com/timholy/ProgressMeter.jl/issues/9 and https://github.com/timholy/ProgressMeter.jl/issues/32 // T On Monday, November 16, 2015 at 1:53:22 PM UTC+1, bernhard wrote: > > related to this I would welcome if it were possible to show

[julia-users] Re: push! performance

2015-11-16 Thread Tomas Lycken
:20 AM UTC-5, Tomas Lycken wrote: >> >> Making sure that precompilation and gc don’t factor into the result, I >> get quite different timings: >> >> julia> gc(); @time sizehint!(a, 10_000_000); >> 0.001493 seconds (46 allocations: 76.296 MB, 304.61% gc time)

[julia-users] Re: push! performance

2015-11-16 Thread Tomas Lycken
sizehint! preallocates for you, with comparable cost to calling e.g. zeroes, but lets you treat the array semantically the same way as a non-preallocated one (but without the cost for reallocation). Hopefully, these comments highlight the differences between the various appraches: N = 10_000

Re: [julia-users] Re: Large Data Sets in Julia

2015-11-11 Thread Tomas Lycken
Everything after the semicolon is keyword arguments, and will dispatch to the same method as if they are left out. Thus, the documentation for SharedArray(T, dims; init=false, pids=[]) is valid for SharedArray(T, dims) too, and the values of init and pids will be the ones given in the

[julia-users] Re: Type stability with eigs

2015-11-09 Thread Tomas Lycken
This actually seems to be a type instability issue in Base.eigs: julia> @code_warntype eigs(A) Variables: A::SparseMatrixCSC{Float64,Int64} Body: begin $(Expr(:line, 50, symbol("linalg/arnoldi.jl"), symbol(""))) GenSym(8) =

[julia-users] Re: DataFrame to JSON

2015-11-09 Thread Tomas Lycken
I’d try to use the built-in tools for iterating and transforming stuff to make the code a little terser and easier to read: function df2json(df) io = IOBuffer() write(io, "[\n") write(io, join(map(row -> "{\"A\": $(row[:A]), \"B\": \"$(row[:B])\"}", eachrow(d)), ",\n"))

Re: [julia-users] Re: Re: are array slices views in 0.4?

2015-11-03 Thread Tomas Lycken
t stay as it is? > > > On Tuesday, November 3, 2015 at 8:30:04 AM UTC+1, Tomas Lycken wrote: >> >> There’s no way this transition is going to be smooth without work from >> package devs to ensure compatibility anyway, but recent history (e.g. the >> Tuplocalypse

[julia-users] Re: help on a MethodError

2015-11-03 Thread Tomas Lycken
Most likely, you’ve imported or defined different versions of the type, and/or you have an old definition laying around in the REPL session somewhere. convert tries to convert an instance of the old version of the type, and fails, because the convert is defined for a newer version. (You can

Re: [julia-users] Re: Re: are array slices views in 0.4?

2015-11-02 Thread Tomas Lycken
There’s no way this transition is going to be smooth without work from package devs to ensure compatibility anyway, but recent history (e.g. the Tuplocalypse) shows that packages recover quite rapidly due to the automated testing done by PkgEval.jl. Thus, packages with decent test suites

Re: [julia-users] Re: typealias vs. const

2015-11-02 Thread Tomas Lycken
ber 30, 2015 at 7:31:57 PM UTC+1, Yichao Yu wrote: On Fri, Oct 30, 2015 at 1:34 PM, Tomas Lycken <tomas@gmail.com > > wrote: > >> `const A = T` is what `typealias A T` lowered to when it doesn't have > type > >> parameters > > > > I wa

Re: [julia-users] Re: typealias vs. const

2015-10-30 Thread Tomas Lycken
> `const A = T` is what `typealias A T` lowered to when it doesn't have type parameters I wanted to inspect the output of this lowering pass, but `@code_lowered` was apparently not what I was looking for (at least, `@code_lowered :(typealias Foo Int)` didn't work...). However, I understand

Re: [julia-users] Re: Order of multiple for-loops

2015-10-30 Thread Tomas Lycken
in my experience practical applications favor row ordering The keyword there is that it was *your* experience. The thing about something as central to number crunching as organizing memory layouts in row- or column major orderings, is that there are more practical applications than any of us

Re: [julia-users] Re: For loop = or in?

2015-10-29 Thread Tomas Lycken
I read 1:n that way. And even if I didn't, I prefer to think about a looping construct as "do this for each element in that collection" - and regardless of how I pronounce 1:n, I see it as a collection since it inherits AbstractArray. But I can also see how other mental models work for you.

Re: [julia-users] Re: OT: make githup notifications un-read?

2015-10-28 Thread Tomas Lycken
The Gmail app on Android can handle several Google accounts (at least on my phone :P) so the race might not be lost yet :) // T On Wednesday, October 28, 2015 at 11:09:54 AM UTC+1, Andreas Lobinger wrote: > > Hello colleagues, > > thanks for the answers. I thought i'm missing some github

Re: [julia-users] Re: Avoid type Unions in fields?

2015-10-28 Thread Tomas Lycken
pe{Float64}. > > On Wed, Oct 28, 2015 at 3:21 AM, Gnimuc Key <gnim...@gmail.com > > wrote: > >> that makes sense. many thanks! >> >> 在 2015年10月28日星期三 UTC+8下午3:14:26,Tomas Lycken写道: >> >>> With a type declared like that, any access of the field x wil

[julia-users] Re: Avoid type Unions in fields?

2015-10-28 Thread Tomas Lycken
With a type declared like that, any access of the field x will be type unstable, which means that Julia’s JIT compiler will emit much more defensive, and thus slower, code. The solution is to declare a *parametric* type: type MyType{T<:Union{Int64, Float64}} x::T end That way, MyType(3)

[julia-users] Re: alternate LISP integration ...

2015-10-27 Thread Tomas Lycken
Have you tried julia --lisp from the command line? Works on my machine… // T On Monday, October 26, 2015 at 10:36:05 PM UTC+1, cdm wrote: > somewhat related ... > > is it still possible to get > the femtolisp REPL in the > post v0.4.0 world ... ? > > thanks, > > cdm > ​

[julia-users] Re: Pkg.add("DecisionTree") getting error, failed pocess: Process(`git ' --worktree = C:\Users.....

2015-10-27 Thread Tomas Lycken
Is it possible for you to scroll right in the first error message, to show the entire message? Easiest is probably if you could copy the *text* of the message, and paste it here. // T On Monday, October 26, 2015 at 8:26:07 PM UTC+1, aar…@udel.edu wrote: Hi I am running my Julia code in

Re: [julia-users] A question of Style: Iterators into regular Arrays

2015-10-27 Thread Tomas Lycken
Better yet, since we already have both AbstractVector, AbstractMatrix, AbstractArray, AbstractString, AbstractFloat and a couple of others (try typing Abstract in the REPL…) it might be time to rename Integer to AbstractInteger. I have a hard time thinking the confusion between Int and

[julia-users] Re: Julia and Object-Oriented Programming

2015-10-18 Thread Tomas Lycken
I’ve never seen a problem that foo.bar(x,y) can solve, but bar(foo, x, y) can’t. There *are* things, however, that are pretty easy to do in OO languages that can’t be done in Julia; one such thing is adding/changing behavior through inheritance. That’s pretty easy to work around, though -

Re: [julia-users] Re: Everything I wrote in version .3 is now 'depreciated'

2015-10-17 Thread Tomas Lycken
… julia doesn’t like ‘foo ()’ anymore, she now prefers ‘foo()’ … In a recent thread I vowed to start helping with enforcing the Julia Community Standards , so I guess it’s now time to walk the walk. In the Standards, we can read While “Julia” is a

[julia-users] Re: Windows: enforce update of ENV["PATH"] after modifying it.

2015-10-16 Thread Tomas Lycken
Modifying environment variables on Windows usually requires at least a sign out-sign in again. Can you try that? // T On Friday, October 16, 2015 at 2:06:26 PM UTC+2, bernhard wrote: > > Hi > can anyone help me with this? When PATH is modified this is not > immediately reflected in Julia

  1   2   3   4   >