Re: [julia-users] Cookbook for Julia

2016-09-23 Thread Tamas Papp
I wonder if you are aware of https://github.com/svaksha/Julia.jl/blob/master/Resources.md#cookbooks and in particular https://en.wikibooks.org/wiki/Introducing_Julia (Also, Packt is coming out with a Julia Cookbook: https://www.packtpub.com/application-development/julia-cookbook ) It seems tha

Re: [julia-users] Cookbook for Julia

2016-09-24 Thread Tamas Papp
In this specific instance, it is worse: searching for "julia cookbook" or "julia recipes" leads you to the work of Juila Child. "julia -child" etc is only marginally better, there are apperently many cookbook authors with the first name Julia. Searching within Wikibooks and similar (Github) works

Re: [julia-users] Julia vs Seed7, why languages succeed or fail

2016-10-05 Thread Tamas Papp
A necessary ingredient for success is that a language is created by people who have specific and clear ideas about what they want from a new language [1], _and_ have the expertise to implement them. Everyone wants a fast, extensible, conscise, safe etc language [insert favorite features here], but

[julia-users] binary dump of ragged data

2016-10-11 Thread Tamas Papp
Hi, I have a dataset of many (about 30 million) observations of the type Tuple{Person, Array{DataA,1}, Array{DataB,1}} where immutable Person # simplified id::Int32 female::Bool age::Int8 end immutable DataA startdate::Int32 enddate::Int32 type::Int8 extra:UInt8 end and DataB is

[julia-users] collecting multiple vectors from infinite iterator

2016-10-12 Thread Tamas Papp
For example, I want collect_ragged(countfrom(1), [2,3,4]) to return 3-element Array{Any,1}: [1,2] [3,4,5] [6,7,8,9] I implemented it as function collect_ragged(iterator, lengths) result = Vector(length(lengths)) s = start(iterator) for (i,l) in enumerate(lengths) v

Re: [julia-users] Julia programming for engineers!

2016-10-19 Thread Tamas Papp
I suppose you are aware of http://docs.julialang.org/en/release-0.5/manual/noteworthy-differences/#noteworthy-differences-from-matlab On Wed, Oct 19 2016, zamani wrote: > Hi guys .. using Julia is fun .. > I'm going to write a guide for matlab users specially students but i need > some help wit

Re: [julia-users] Re: product of Int64 and Float64 is Int64

2016-10-19 Thread Tamas Papp
And the same goes for the closely related .1 syntax. Perhaps you could create an issue, if there isn't one already? On Wed, Oct 19 2016, Krisztián Pintér wrote: > i know i shouldn't, but i'm kinda angry at this "1." notation. saving one > character really worth losing readability? also leading t

[julia-users] stricter parsing of integers

2016-10-24 Thread Tamas Papp
Is there a way to make parse(Int, " - 42 ") throw an error, or substitute with a different function that does this? Note that I am not advocating that this should be invalid syntax, just want to have a "strict" version for reading a dataset that throws an error unless the integer is not of the "

Re: [julia-users] using a module but with other name, similar to "import numpy as np" in python

2016-10-24 Thread Tamas Papp
import DataFrames const DF = DataFrames DF.@data ... etc On Mon, Oct 24 2016, novatena2...@gmail.com wrote: > Hello, > > is there an official way to using a module but with different name (not the > name of the module), like "import numpy as np". > > Currently, I can do that with a hack, like th

[julia-users] computation on types in type definition

2016-10-26 Thread Tamas Papp
I have a type which contains two slots, and it is important that the types of them satisfy certain constraints. I can enforce that in the constructor: see first and second implementations below. However, if I want to compute types directly in the definition (see third implementation), I end up with

Re: [julia-users] Parsing complex numbers

2016-10-30 Thread Tamas Papp
Not too complicated: you can either extract from the Expr, or parse the tokens iterating over (token, position) = parse(string, position, greedy = false) and validate. The only tricky part is the signs. On Sat, Oct 29 2016, Jérémy Béjanin wrote: > How easy would it be to make one assuming the s

Re: [julia-users] Reducing complexity of OffsetArrays

2016-11-02 Thread Tamas Papp
Is there a general recommendation for dealing with the case when a function encounters two arrays with different index sets? Eg OffsetArray(1:5,1:5) + OffsetArray(1:5, -2:2) currently gives a DimensionMismatch exception via promote_shape, so perhaps one should simply rely on what the latter does.

[julia-users] [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

2016-11-02 Thread Tamas Papp
eter, require a more capable terminal. You get completion and other extras of the Julia REPL for free. You can find it at https://github.com/tpapp/julia-repl If there is interest, I would be happy to submit it to MELPA, just file an issue. Best, Tamas Papp

[julia-users] how to report errors with context

2016-11-02 Thread Tamas Papp
This is a conceptual question. Consider the following (extremely stylized, but self-contained) code parsefield{T <: Real}(::Type{T}, string) = parse(T, string) function parserow(schema, strings) # keep i for reporting column, currently not used [parsefield(T, string) for (i, (T, string))

Re: [julia-users] Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

2016-11-02 Thread Tamas Papp
On Wed, Nov 02 2016, David van Leeuwen wrote: > I'd be interested to know what the supposed workflow for > $interpretor-in-$editor is. (This may be more general than emacs > julia-repl) > > I've tried Julia, R in Atom, Emacs, and I don't seem to be able to work > with it. In the Julia / R / bash

Re: [julia-users] [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

2016-11-02 Thread Tamas Papp
On Wed, Nov 02 2016, Angel de Vicente wrote: > Hi, > > Tamas Papp writes: >> Hi Julia & Emacs users, > > I'm one of those :-) > >> I wrote a minor mode for starting and interacting with a Julia REPL from >> Emacs. It basically uses term, and defers to

Re: [julia-users] Re: how to report errors with context

2016-11-03 Thread Tamas Papp
{String}}}) at > ./:0 > in collect_to!(::Array{Int64,1}, > ::Base.Generator{Enumerate{Base.Zip2{Array{DataType,1},Array{SubString{String},1}}},##1#2}, > ::Int64, ::Tuple{Int64,Tuple{Int64,Int64}}) at ./array.jl:340 > in > collect(::Base.Generator{Enumerate{Base.Zip2{Array{DataT

Re: [julia-users] Re: how to report errors with context

2016-11-03 Thread Tamas Papp
oid SubString results, if it matters >># then split the rows on ';' and convert to ?Float64 with NaN for error >> or ?Nullable Ints >># and put the values in a matrix, processing the matrix you have the >> rows and cols >> ``` >> >> >> O

[julia-users] what is "type piracy"?

2016-11-03 Thread Tamas Papp
What does the term "type piracy" mean? The term shows up in julia-related discussions, mostly on Github. Googling for it leads back these discussions, and a lot of unrelated stuff about copyright and/or typefaces. (Apologies if the term is well-known, I am an economist, not a computer scientist).

Re: [julia-users] Re: how to report errors with context

2016-11-04 Thread Tamas Papp
end test_file = """ 1;2;3 4;5;6 7;error;9 """ parsefile(IOBuffer(test_file), fill(Int, 3)) I still need to figure out type stability etc, but I think I am on the right track. [1] http://joeduffyblog.com/2016/02/07/the-error-model/ On Thu, Nov 03 2016, Tamas Papp wrote: >

[julia-users] advice on optional type -- Union or two fields?

2016-11-04 Thread Tamas Papp
Hi, I am working on a parsing framework where the parsing functions either return a parsed value, or in case they could not parse, return a value that signals this -- similar to Base.tryparse. Originally I was using a Nullable{T}, but realize that in case I could not parse then having the raw str

Re: [julia-users] BigInt And Expression

2016-11-05 Thread Tamas Papp
myexpression{T <: Integer}(a::T) = myexpression(convert(Int128, a)) # You can also define for BigInt, depending on the range you will need # for `a`. Order is important. myexpression(a::Int128) = a*((a+12)*(a+24)*(a+36)*(a+48)) julia> myexpression(16140) 1103425489430061096960 On Sat, Nov 05 201

Re: [julia-users] How can I run this "raijin", fx auto trading program?

2016-11-06 Thread Tamas Papp
You need to open a terminal. However, given that the repo is 5 months old, and there has been a new Julia release, and Mamba.jl was also updated in the meantime, the code may need some work (impossible to say without running it), which would require learning a bit about programming. On Sun, Nov 0

[julia-users] Re: How to stop program execution at some point

2016-11-07 Thread Tamas Papp
See quit(), and in general exit(code). On Monday, November 7, 2016 at 11:21:14 AM UTC+1, Fred wrote: > > Hi, > > I search in Julia the equivalent of Perl > die; > to stop the execution of a program. > > I tried "break" but it produces an error : > ERROR: LoadError: syntax: break or continue outsi

Re: [julia-users] Re: How to stop program execution at some point

2016-11-11 Thread Tamas Papp
return On Fri, Nov 11 2016, Davide wrote: > Actually, when executing a function in Julia REPL, quit() and exit() also > exit from julia. Is there a way to stop the function but not Julia? > >Thanks > > On Monday, November 7, 2016 at 11:40:32 AM UTC+1, Tamas Papp wrote: >

Re: [julia-users] Re: How to stop program execution at some point

2016-11-11 Thread Tamas Papp
On Fri, Nov 11 2016, Angel de Vicente wrote: > Tamas Papp writes: > >> return > > But return will only quit the current function and return execution to > the caller. Coming from Fortran, I also miss something like STOP, which > will stop all execution and return me

Re: [julia-users] Re: How to stop program execution at some point

2016-11-11 Thread Tamas Papp
On Fri, Nov 11 2016, Angel de Vicente wrote: > Tamas Papp writes: >>> But return will only quit the current function and return execution to >>> the caller. Coming from Fortran, I also miss something like STOP, which >>> will stop all execution and return me to th

Re: [julia-users] Re: [Announcement] Moving to Discourse

2016-11-21 Thread Tamas Papp
I am using a laptop with a HiDPI display, and the forum works fine -- in fact, I love the clean design. In firefox, Ctrl+ magnifies correctly, same in Chromium. Are you using Safari? Perhaps try a different browser. On Mon, Nov 21 2016, Ferran Mazzanti wrote: > One thing that is not particular fr

Re: [julia-users] exemplar package for 0.4-style documentation

2015-01-14 Thread Tamas Papp
On Tue, Jan 13 2015, Tom Short wrote: > If you want to try the Sims docs at the REPL, you'll need to checkout that > package and enter "using Sims, Sims.Lib, Lexicon". Then you can do > ?Resistor or ?"Capacitor. > > Note that the question mark doesn't work in ESS. Is that an intrinsic limitation

[julia-users] components of an LU are not triangular

2015-01-15 Thread Tamas Papp
I am still learning about matrices in Julia so I didn't file an issue becuase I am not sure this is a bug, but in julia> VERSION v"0.3.5" julia> lu = lufact([1 2; 3 4]) LU{Float64,Array{Float64,2}}(2x2 Array{Float64,2}: 3.0 4.0 0.33 0.67,Int32[2,2],0) julia> typeof(lu[:U]) Array

[julia-users] idiom for seamlessly ignoring possible additional return values

2015-01-15 Thread Tamas Papp
Hi, Is there an idiom for ignoring possible multiple values? For example, if I have a function foo() that may or may not return multiple values where values after the first one provide some extra information (eg a condition number on an operation, etc), but I am not necessarily interested in it --

Re: [julia-users] components of an LU are not triangular

2015-01-15 Thread Tamas Papp
tempted to allow Triangular to be rectangular > so actually the triangular matrix would be more a trapezoid. I think it > could work but would require some efforts. It would also make it it > possible to use the structures for blocked/paneled factorization algorithm. > > 2015-01-15

[julia-users] broadcast setting block of array w/o loop

2015-01-17 Thread Tamas Papp
Hi, Suppose I have an array with dimensions (m*n, m*n), and I would like to set certain size (n,n) blocks of this array to contain the same rows (motivation: the matrix is a continuous-time Markov transition matrix). What is the idiomatic loopless solution? I came up with (toy example) a = zero

Re: [julia-users] What's your favourite editor?

2015-01-17 Thread Tamas Papp
Emacs. ESS for Julia is very nice, the only thing I miss is the help integration, which I guess will be done once 0.4 is released. Best, Tamas On Sat, Jan 17 2015, Terry Seaward wrote: > Hi, > > Just curious to know what people use to write/edit their Julia code > (os/app)?

Re: [julia-users] Re: What's your favourite editor?

2015-01-19 Thread Tamas Papp
C-c C-c works, unless the block has empty lines. ESS is still a bit quirky, but has improved a lot lately. Use the latest from melpa. Best, Tamas On Tue, Jan 20 2015, Todd Leo wrote: > To Emacs users: > > Is ESS smart enough, that one can send the whole code block to REPL where > the cursor

[julia-users] workflow recommendation/tutorial

2015-01-20 Thread Tamas Papp
Hi, I am wondering what the best workflow is for iterative/exploratory programming (as opposed to, say, library development). I feel that my questions below all have solutions, it's just that I am not experienced enough in Julia to figure them out. The way I have been doing it so far: 1. open a

[julia-users] module reflection & introspection

2015-01-26 Thread Tamas Papp
Suppose I have a trivial module module Foo x = 1 end so names(Foo) now includes a Symbol that is === to symbol("x"). I have two questions: 1. How can I intern symbols into a module programatically, possibly from outside the module? symbol("Foo.y") does not work (using 3.5). 2. Similarly, how ca

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
e issues a) and b). I often maintain a script as >> part of my iterative/exploratory work, so that I can easily get to the >> desired state when I have to restart. >> >> -viral >> >> On Tuesday, January 20, 2015 at 4:15:13 PM UTC+5:30, Tamas Papp wrote: >>

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
> new names to an already-closed module. > - Anything that has already been compiled and uses myfunction won't "hear" > about the new definition unless you reload the whole module (see issue #265). > > --Tim > > > On Monday, January 26, 2015 02:54:03 PM Tamas Papp wrote:

Re: [julia-users] Re: workflow recommendation/tutorial

2015-01-26 Thread Tamas Papp
n modify things without recompiling everything. It would be a > great feature if the REPL was able to "step into" modules other than Main > so that everyone can use this) > > On 26 January 2015 at 14:54, Tamas Papp wrote: > >> So the only the global name space is for

Re: [julia-users] module reflection & introspection

2015-01-26 Thread Tamas Papp
expression directly. from there, you can explore the resulting Expr tree > with dump() and Meta.show_sexpr() to observe the correct expression tree. > > you can convert symbols to values with eval() or getfield() > > > On Mon Jan 26 2015 at 8:16:20 AM Tamas Papp wrote: > >> Su

Re: [julia-users] Re: Almost at 500 packages!

2015-01-28 Thread Tamas Papp
I don't think Steven's view is unfriendly per se. Documentation/organization is hard, and saying that some other projects did not do it perfectly either is not a slur on anyone's work. I tend to agree with Steven's opinion: very few R packages have vignettes (although the good quality ones do), an

Re: [julia-users] LAPACKException(1) during SVD

2015-01-30 Thread Tamas Papp
I think that LAPACK error codes above 0 are about ill-conditioning and/or non-convergence. Perhaps you could share the matrix (in a binary format, since copy-pasting decimal floats can change the values and thus the conditioning). Best, Tamas On Fri, Jan 30 2015, Steven Sagaert wrote: > when d

Re: [julia-users] How to make vector 'c' such that they are the values of the vector "a" but not in the vector "b"?

2015-02-02 Thread Tamas Papp
Perhaps setdiff(a, b) or a[indexin(a, b) .== 0] I don't know which is faster, for small arrays it should not matter. Best, Tamas On Mon, Feb 02 2015, paul analyst wrote: > How to make vector 'c' such that they are the values of the vector "a" but not > in the vector "b"? > > (Excluding the

Re: [julia-users] How to build (automaticly) a vector with a range of indivisible ?

2015-02-03 Thread Tamas Papp
Eg function range_end(a,step,b) v = a:step:b if v[end] != b v = [v,b] end v end [1 4 ... ] is not a vector, but a matrix. You will need to transpose the result if you want that. Also, if the range does not need to be extended, it is left as is, should work fine in most applications, b

Re: [julia-users] How to build (automaticly) a vector with a range of indivisible ?

2015-02-03 Thread Tamas Papp
1:3:18060001 > > Paul > > W dniu wtorek, 3 lutego 2015 14:08:57 UTC+1 użytkownik Tamas Papp napisał: >> >> Eg >> >> function range_end(a,step,b) >> v = a:step:b >> if v[end] != b >> v = [v,b] >> end >> v >> en

Re: [julia-users] pair-wise operation on an array?

2015-02-07 Thread Tamas Papp
diff([1, 2, 4, 7, 8]) I don't think it gets more beautiful than this :D Best, Tamas On Sat, Feb 07 2015, Evan Pu wrote: > say I want to compute a pair-wise diff for all the elements in the array. > input:[1, 2, 4, 7, 8] > output:[1, 2, 3, 1] > > is there some kind of "beautifu

Re: [julia-users] Colour blind friendly defaults for plotting?

2015-02-08 Thread Tamas Papp
I think that this is an excellent idea, and I would argue for making this color scheme default for all plotting libraries, for displaying continuous data mapped to colors. I have not been aware of CUBEHELIX, but I have always felt bad about color-blind people in an audience, especially students in

[julia-users] @with_fields macro

2015-02-10 Thread Tamas Papp
Hi, Is there a macro in Julia similar to CL's WITH-SLOTS? Eg type Foo bar baz end function foo(f::Foo) @with_fields f (bar,baz) bar+baz end end would be the same as function foo(f::Foo) f.bar + f.baz end If not, then some hints on how to write this would be welcome. I could not

Re: [julia-users] Re: Quantitative Economics with Julia (great PDF doc)

2015-02-11 Thread Tamas Papp
Hmmm, did you read the whole file? After getting through the preliminaries, it starts with dynamic programming, and discusses economics problems. It looks like it follows the spirit of the Sargent-Ljungqvist book quite closely. On Wed, Feb 11 2015, Andreas Lobinger wrote: > 1) is it julia 0.3 or

[julia-users] modules, using, import, and redefinitions

2015-02-12 Thread Tamas Papp
Hi, I am trying to gain a better understanding of modules, and especially `using` and `import`, and module redefinition. Suppose I have --8<---cut here---start->8--- module Foo export bar, baz function bar(x) :something end baz = 42 end --8<-

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Tamas Papp
On Thu, Feb 12 2015, jung.fe...@gmail.com wrote: > Hi, > > I've run into a problem that I hadn't even considered so far. When > computing the analytical solution to a positive integral (its an > integral over a quadratic function) I got extremely negative values > from Julia. Here is some example

[julia-users] conflicts when reloading module

2015-02-18 Thread Tamas Papp
Hi, I thought that using modules would solve my problems with iterative development, but apparently not: when reloading a module that was used in Main, conflicts mask the new definitions. Eg --8<---cut here---start->8--- module Foo export Bar, baz type Bar x

[julia-users] sparse and full matrices give different answer

2015-02-18 Thread Tamas Papp
Is this a bug, or am I missing something obvious? julia> versioninfo() Julia Version 0.3.5 Platform Info: System: Linux (x86_64-linux-gnu) CPU: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz WORD_SIZE: 64 BLAS: libblas LAPACK: liblapack LIBM: libopenlibm LLVM: libLLVM-3.5 julia> A 3x5 s

Re: [julia-users] conflicts when reloading module

2015-02-18 Thread Tamas Papp
by the module name (Foo.baz() rather > than baz()), then you will be fine. Or use the workspace command. > > http://docs.julialang.org/en/latest/manual/workflow-tips/#a-basic-editor-repl-workflow > > --Tim > > On Wednesday, February 18, 2015 09:53:24 AM Tamas Papp wrote: >

Re: [julia-users] sparse and full matrices give different answer

2015-02-18 Thread Tamas Papp
-1820~ubuntu14.10.1. So now I am using the ubuntu version. If this is not known to be fixed, maybe worth adding to the test suite. Best, Tamas On Wed, Feb 18 2015, Andreas Noack wrote: > I'm unable to reproduce this on 0.3.5, 0.3.7pre or master. How did you > construct A? > >

Re: [julia-users] working with immutable arrays

2015-02-18 Thread Tamas Papp
BTW, what is this Val{} construct? I noticed it in the nighly builds (eg for lufact with no pivoting), but could not find it in the docs. Tamas On Wed, Feb 18 2015, Tim Holy wrote: > I'm fairly certain you can solve this with a stagedfunction and > Val{:fieldname}. Left as an exercise for the

Re: [julia-users] working with immutable arrays

2015-02-18 Thread Tamas Papp
Great! This is effectively like an EQL specializer in CLOS, isn't it? (Only a bit neater conceptually.) On Wed, Feb 18 2015, Tim Holy wrote: > On Wednesday, February 18, 2015 04:51:44 PM Tamas Papp wrote: >> BTW, what is this Val{} construct? I noticed it in the nighly builds (eg

Re: [julia-users] Functions

2015-02-19 Thread Tamas Papp
Hi, Maybe you could use value types ( http://julia.readthedocs.org/en/latest/manual/types/#value-types ), however, you need to use the latest nighly builds for that. Eg func(::Type{Val{1}}, x) = x^2 func(::Type{Val{2}}, x) = sin(x) func(Val{1},1) # => 1 func(Val{2},1)

[julia-users] Re: How to avoid temporary arrays being created in a function.

2015-02-20 Thread Tamas Papp
You could create an array pool: arraypool = Dict() function emptyarray(elttype, dimensions...) get!(() -> Array(elttype, dimensions...), arraypool, (elttype, dimensions)) end When you request the same kind of array, it will recycle a preallocated one: a = emptyarray(Float64, 1, 2, 3) is(a, e

Re: [julia-users] Re: How to avoid temporary arrays being created in a function.

2015-02-20 Thread Tamas Papp
be negligible. YMMV of course, but it would be interesting to see a nontrivial example where allocation is a significant main cost --- allocating un-initialized arrays (with Array) should be fairly cheap. Best, Tamas On Fri, Feb 20 2015, Tamas Papp wrote: > You could create an array p

Re: [julia-users] Optional Arguments

2015-02-21 Thread Tamas Papp
Hi, Can you clarify what you want to achieve with this? I don't understand the problem (what are the doubts?). BTW, arguments after the ; are *keyword* arguments in Julia, *optional* arguments are a different kettle of fish. See http://docs.julialang.org/en/release-0.3/manual/functions/#optional-

Re: [julia-users] Convert a string with commas into a float

2015-02-22 Thread Tamas Papp
For example, parsefloat(filter(c->c!=',', "123,456")) Best, Tamas On Sun, Feb 22 2015, AVF wrote: > What is the best way to convert a string such as "123,456" into a float > 123456.0? I could not find a method that would splice out a character from > the middle of a string to feed the result

Re: [julia-users] Re: workflow for devloping large modules

2015-02-25 Thread Tamas Papp
Hi John, In fact you can eval "into" a module and thus add functions/variables without reloading the whole thing. Juno supports this, I am working on ESS to provide the same functionality. What IDE are you using? Best, Tamas On Wed, Feb 25 2015, lapeyre.math1...@gmail.com wrote: > I found a so

Re: [julia-users] Re: workflow for devloping large modules

2015-02-25 Thread Tamas Papp
, lapeyre.math1...@gmail.com wrote: > I guess you mean using the module's eval to add functions/variables ? This > sounds like an excellent > option. > > I am using emacs/julia mode + konsole. > > On Wednesday, February 25, 2015 at 11:39:31 AM UTC+1, Tamas Papp wrote: >

Re: [julia-users] Re: workflow for devloping large modules

2015-02-25 Thread Tamas Papp
ESS _does_ support Julia at the moment: 1. editing Julia code works fine, even though the aforementioned commit from Wilfred Hughes will improve it and will also make it easier to follow improvements in julia-mode, 2. interacting with the REPL is functional, but does not support all the extras I

[julia-users] exporting tables (ascii or LaTeX)

2015-02-28 Thread Tamas Papp
Hi, I am solving some economic models in Julia. I have vectors that describe various moments, for some data and then for a bunch of models. I would like to export them to LaTeX, and if possible to ASCCI like org-mode. | moment | data | model1 | model2 | ... | |--+--++---

Re: [julia-users] Re: how to remove the quotation marks ?

2015-03-02 Thread Tamas Papp
I am afraid you are missing something fundamental here. Those double quotes are not part of the strings, they are just a printing convention that Julia uses (which coincides with the read syntax). Similarly, julia> print([1,2,3]) [1,2,3] even though the array has no elements [ or ], not even ',

Re: [julia-users] exporting tables (ascii or LaTeX)

2015-03-02 Thread Tamas Papp
did you see > https://github.com/scheinerman/LatexPrint.jl? > > Am 28.02.2015 um 10:52 schrieb Tamas Papp : > >> Hi, >> >> I am solving some economic models in Julia. I have vectors that describe >> various moments, for some data and then for a bunch of models.

[julia-users] Re: Book "Getting started with Julia Programming"

2015-03-03 Thread Tamas Papp
Looks interesting, but is there a way to get a preview of more than a few pages? An example chapter somewhere in the middle would be nice. The preview window on the website throws me out after a few pages, so I could not really look into the book. On Tuesday, March 3, 2015 at 12:14:58 PM UTC+1,

Re: [julia-users] General question about composite types

2015-03-03 Thread Tamas Papp
In some cases a composite type may allow you to organize your code better. For example, I would usually prefer type BodyMetrics weight::Float64 height::Float64 waist::Float64 end to a Vector[3] because I would be concerned that I would mix up the order of fields without explicitly specifyin

Re: [julia-users] vector vs column matrix

2015-03-04 Thread Tamas Papp
Assuming that you want to fill it with a sequence of integers as your examples suggest, something like [i for i=1:3, j=1] or reshape(1:3,3,1) would also work. Best, Tamas On Wed, Mar 04 2015, Deniz Yuret wrote: > Is there a way to initialize a 2D column matrix? > a=[1,2,3] gives me a 1D ve

Re: [julia-users] vector vs column matrix

2015-03-04 Thread Tamas Papp
feel free to discuss the need for a convenient syntax for this > at https://github.com/JuliaLang/julia/issues/10338 > > Op woensdag 4 maart 2015 10:32:12 UTC+1 schreef Tamas Papp: >> >> Assuming that you want to fill it with a sequence of integers as your >> examples sug

Re: [julia-users] Re: Getting people to switch to Julia - tales of no(?) success

2015-03-04 Thread Tamas Papp
Even outside stats, Julia is a moving target, with nontrivial changes in syntax and semantics in the core language, and large changes in library code. While this is natural (and beneficial) in a new language, one has to have a preference for other benefits (eg the clarity and the design of the lan

[julia-users] Re: Complex matches in strings

2015-03-04 Thread Tamas Papp
Maybe something like function mysplit(s) a = split(s, "string1") b = split(a[2], "string2") c = split(b[2], "string3") (b[1],c[1]) end julia> s = "string1[10-15 characters]string2[string I need to extract]string3" julia> mysplit(s) ("[10-15 characters]","[string I need to extract]") HTH

Re: [julia-users] Re: Complex matches in strings

2015-03-04 Thread Tamas Papp
Sorry, then I misunderstood. In that case, regular expressions are probably your best option. HTH, Tamas On Wed, Mar 04 2015, Nils Gudat wrote: > Hi Tamas, > > Not sure I'm correct, but I think what you're suggesting won't work, as I > can't split by string2 separately - I only want to find s

[julia-users] convert composite type to a vector

2015-03-05 Thread Tamas Papp
If I have a composite type type Foo a b c end I can initialize it with a vector like this: x = Foo([1,2,3]...) But how can I get the fields as a vector, eg [x.a,x.b,x.c] without enumerating them? convert(x, Vector) does not work. I need this to go back and forth between the type and the

Re: [julia-users] Re: convert composite type to a vector

2015-03-05 Thread Tamas Papp
:length(names(Foo))] > > > Am Donnerstag, 5. März 2015 10:51:36 UTC+1 schrieb Tamas Papp: >> >> If I have a composite type >> >> type Foo >> a >> b >> c >> end >> >> I can initialize it with a vector like this: >>

Re: [julia-users] Re: Getting people to switch to Julia - tales of no(?) success

2015-03-05 Thread Tamas Papp
On Thu, Mar 05 2015, Christoph Ortner wrote: > I like Juno and I think ESS is ok, but I would call neither "mature", e.g., > missing debugger, profiling is not built-in, auto-complete is far from > perfect and getting help text in the editor does not work consistently > either. And finally breaki

Re: [julia-users] Re: Getting people to switch to Julia - tales of no(?) success

2015-03-05 Thread Tamas Papp
I know some colleagues who are specifically waiting for the debugger to improve before adapting Julia, especially for teaching, so these things can be a deal-breaker for some people, even if the core is stable. I can easily live with the changes in the core language --- where I would like to see s

Re: [julia-users] Re: Why is Forward Reference possible?

2015-03-11 Thread Tamas Papp
I wish Julia issued a warning in this case -- maybe there is an issue about this, but I could not find it. Tamas On Wed, Mar 11 2015, Yuuki Soho wrote: > I think Julia implicitly assume that i is a global variable, i.e. your > function is equivalent to > > f = () -> begin > global i > re

Re: [julia-users] Different ways to create a vector of strings in Julia

2015-03-12 Thread Tamas Papp
Hi Charles, Array{String} is a type, not an array: julia> isa(Array{String}, Type) true julia> typeof(Array{String}) DataType See http://docs.julialang.org/en/release-0.3/manual/types/ . The function Array(eltype, dimensions...) can be used to instantiate an object of this type, which is the c

Re: [julia-users] Different ways to create a vector of strings in Julia

2015-03-12 Thread Tamas Papp
On Thu, Mar 12 2015, Ivar Nesje wrote: >> >> So, what you would want to do is `Array{String,1}()`. >> That ought to construct a array of strings with dimension 1 but doesn't. > > > But in 0.4 you can use Array{String,1}(0) to create a 1d array with 0 > elements. Note that you have to provide the

Re: [julia-users] Re: Getting people to switch to Julia - tales of no(?) success

2015-03-12 Thread Tamas Papp
IMO there is no way to ensure that a new language like Julia will live (= have a viable, active community which keeps improving the language and the libraries) over a 5-year timeframe. I really hope it will, but there is no way to be sure. That said, since it is open source, the client will always

Re: [julia-users] Indenting by 2 spaces in ESS[Julia]

2015-03-12 Thread Tamas Papp
(defun customize-julia () ;; also put other Julia customizations here (interactive) (setq julia-basic-offset 2)) (add-hook 'julia-mode-hook 'customize-julia) BTW, I am working on ESS & Julia repl interaction, you might find this useful (will be merged eventually I hope): https://github.com

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Tamas Papp
My mental model is that x[:] += 1 is turned into x[:] = x[:] + 1 which is equivalent to x[:] = x + 1 which then is turned into a setindex! call. See http://docs.julialang.org/en/release-0.3/manual/arrays/#assignment I don't know if the last step is accessible to the user (for metaprogramming

Re: [julia-users] In-place operations: what happens when I call x[:] += 1?

2015-03-14 Thread Tamas Papp
att Bauman wrote: > On Saturday, March 14, 2015 at 9:15:32 AM UTC-4, Tamas Papp wrote: > > I don't know if the last step is accessible to the user (for > metaprogramming), would be interesting to learn about that. > > > Here you go: > > julia> expand(pa

Re: [julia-users] Re: dict comprehension syntax in 0.4

2015-03-15 Thread Tamas Papp
I think that in 0.4, => is not merely syntax, but a constructor for a Pair. So you can do julia> [Pair(i,2*i) for i = 1:3] 3-element Array{Pair{Int64,Int64},1}: 1=>2 2=>4 3=>6 and using the => is just syntactic sugar. My understanding that [1=>2, 3=>4] is deprecated because it will eventually

[julia-users] derivatives of Chebyshev polynomials

2015-04-02 Thread Tamas Papp
Hi, Can someone point me to some Julia code that calculates a matrix for the derivatives of the Chebyshev polynomials T_j, at given values, ie d^k T_i(x_j) / dx^kfor i=1,..n, j for some and vector x. The Chebyshev polynomials themselves are very easy to calculate using the recurrence relatio

[julia-users] mapping to colums of a matrix

2015-04-04 Thread Tamas Papp
Hi, Suppose I have a function that maps an atom of type T, eg Float64, into Vector{T}, and takes another argument n that determines its length. What is the idiomatic/fast way of collecting the values in the columns of a matrix? Currently I am using this: @doc """Map elements of `x` into columns

[julia-users] R's splineDesign in Julia

2015-04-04 Thread Tamas Papp
Hi, I am looking for a function (library) that allows evaluation of a B-spline basis (specified by the knots and the order), at given points, _and_ also allows the evaluation of derivatives for the same family. R's splineDesign in the splines package has this, but looking at the splines libraries

Re: [julia-users] Re: R's splineDesign in Julia

2015-04-04 Thread Tamas Papp
.jl > > https://docs.scipy.org/doc/scipy-0.15.1/reference/interpolate.html > (use with PyCall) > > https://github.com/lgautier/Rif.jl > (R and Julia Interfacing) > > On Sunday, April 5, 2015 at 12:57:28 AM UTC+5:30, Tamas Papp wrote: >> >> Hi, >> >> I am look

Re: [julia-users] Re: R's splineDesign in Julia

2015-04-05 Thread Tamas Papp
oefficients in Dierckx with `get_coeffs(spl)` > where `spl` is a Spline1D object. Or look into the internals here: > https://github.com/kbarbary/Dierckx.jl/blob/master/src/Dierckx.jl#L83 . > > - Kyle > > On Sat, Apr 4, 2015 at 12:54 PM, Tamas Papp wrote: > >> I have looked a

Re: [julia-users] Re: derivatives of Chebyshev polynomials

2015-04-06 Thread Tamas Papp
continue >>> end >>> D[i, j] = 2*(j-1)/(b-a) >>> else >>> if j < i || iseven(i+j) >>> continue >>> end >>> D[i, j] = 4*(j-1)/(b-a) >>>

[julia-users] interpolation: variable not defined

2015-04-09 Thread Tamas Papp
I am trying to write a simple utility that opens the readme of a package in my browser: @doc "Open readme of package in browser."-> function Pkgreadme(package) file = Pkg.dir(package) * "/" * "README.md" isfile(file) && `x-www-browser $(file)` end but get the error ERROR: UndefVarError: file

Re: [julia-users] A Julia newsletter

2015-04-12 Thread Tamas Papp
I would find a blog with an RSS feed more practical --- I prefer not to receive largish HTML e-mails, but leave stuff unread in my RSS reader until I have the time to work through it. Best, Tamas On Sun, Apr 12 2015, Zahirul ALAM wrote: > I want to start a Julia newsletter. At this moment it w

[julia-users] how to test if object is a Vector{(Symbol,T)} with T <: Real

2015-04-13 Thread Tamas Papp
Hi, I had some code like if isa(spec, Symbol) A[i,spec] = 1 elseif isa(spec, Vector{(Symbol,Float64)}) @assert(isapprox(sum(map(x -> x[2],spec)),1)) for (obs,prob) = spec A[i,obs] = prob end else error("don't know how to parse $spec for aggregatio

[julia-users] non-concatenating vector creation

2015-04-13 Thread Tamas Papp
Hi, I have been following issue 7128 [1] and the related other issues, and noticed that constructs like [1,2,[3,4]] give a warning in the dev version I am using at the moment (v"0.4.0-dev+4219"), but I am wondering if there is a construct that I can use for non-concatenating vector creation _at th

Re: [julia-users] how to test if object is a Vector{(Symbol,T)} with T <: Real

2015-04-13 Thread Tamas Papp
Thanks. Is there a "local" solution that does not interfere with the namespace? Best, Tamas On Mon, Apr 13 2015, Toivo Henningsson wrote: > You could make a typealias with a type parameter T for your type and check > against that with isa.

Re: [julia-users] Re: non-concatenating vector creation

2015-04-13 Thread Tamas Papp
fter the > concatenation change is applied. > > julia> Any[1,2,[3,4]] > 3-element Array{Any,1}: > 1 > 2 > [3,4] > > > On Monday, April 13, 2015 at 8:55:19 AM UTC-4, Tamas Papp wrote: >> >> Hi, >> >> I have been following issue 7128 [1] and th

  1   2   3   4   >