Re: [julia-users] A "two-languages" problem when embedding Julia

2016-10-22 Thread Cristóvão Duarte Sousa
Thanks Yichao, and thank you very much for the links. On Saturday, October 22, 2016 at 5:38:58 PM UTC+1, Yichao Yu wrote: > > On Sat, Oct 22, 2016 at 12:26 PM, Cristóvão Duarte Sousa > <cri...@gmail.com > wrote: > > Thanks, Yichao. > > > > Rereading my first

Re: [julia-users] A "two-languages" problem when embedding Julia

2016-10-22 Thread Cristóvão Duarte Sousa
Thanks, Yichao. Rereading my first question and reading your second answer I think may have been not clear in the first one. In the first question, I wanted to ask not about the current state but rather about the future goal of the development. Is your "no" about the current state or are you

[julia-users] A "two-languages" problem when embedding Julia

2016-10-22 Thread Cristóvão Duarte Sousa
I would like to get some advice on how to integrate Julia into an existing application written in C++. I mainly work in image processing and computer vision applications. May traditional way of working is to do the exploratory prototyping in a high-level language, and then, when algorithms

[julia-users] Re: cfunction result garbage collected

2016-09-28 Thread Cristóvão Duarte Sousa
I can't help you at all, but I would like to ask if you pass the cfunction() result to the C side. I've been playing with embedding Julia and discovered I could call a cfunction() directly from C, although I'm not sure that's a good practice.

[julia-users] Re: Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Cristóvão Duarte Sousa
On the other hand, it works ok for the mean function: r = rand(10) test(r) = mean( t^2 for t in r ) @code_warntype test(r) # return type Float64 is inferred On Thursday, September 22, 2016 at 7:21:36 PM UTC+1, Christoph Ortner wrote: > > I hope that there is something I am missing, or making a

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 Cristóvão Duarte Sousa
It may have been already proposed sometimes, for some other things (and possibly by myself), but, what about a module that simple defines *macro ~(x,y); div(x,y); end* ? Enabling code like *4~3*. Would it be considered idiomatic enough to use such available option? On Tue, Apr 5, 2016 at 9:19

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 Cristóvão Duarte Sousa
> For the julia example isn't matlab like concatenation using ';' being > removed from julia? > No. Just the concatenation using ',' (AFAIK)

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

2016-04-03 Thread Cristóvão Duarte Sousa
> Decisions that in my opinion were made by people who do not write research-code: > 1. Indexing in Julia. being 1 based and inclusive, instead of 0 based and not including the end (like in c/python/lots of other stuff) > 2. No simple integer-division operator. I do not understand why this is

Re: [julia-users] Autoformatting for Julia?

2016-02-12 Thread Cristóvão Duarte Sousa
I don't know if it has been said here before, sorry if I'm repeating, but: a way to represent the "concrete" syntax tree, convert it to AST and then back would be of great use here, see https://github.com/JuliaLang/JuliaParser.jl/issues/22 . I actually thought a lot about that, and imagine that

Re: [julia-users] Autoformatting for Julia?

2016-02-12 Thread Cristóvão Duarte Sousa
t; On Fri, Feb 12, 2016 at 5:17 AM, Cristóvão Duarte Sousa > <cris...@gmail.com> wrote: > > I don't know if it has been said here before, sorry if I'm repeating, > but: > > a way to represent the "concrete" syntax tree, convert it to AST and then > > back would

Re: [julia-users] Autoformatting for Julia?

2016-02-12 Thread Cristóvão Duarte Sousa
de > file: Symbol none > line: Int64 1 > 2: Symbol x > typ: Any > typ: Any > > -erik > > On Fri, Feb 12, 2016 at 10:25 AM, Cristóvão Duarte Sousa > <cris...@gmail.com> wrote: > > Yes, but then where such Exprs will plac

Re: [julia-users] Re: Meaty example of using singleton types

2015-12-09 Thread Cristóvão Duarte Sousa
Maybe this: type BadInt end const badint = BadInt() const _badint_val = 6 Base.(:+)(::BadInt, x) = _badint_val - x badint + 5 # -5 On Wednesday, December 9, 2015 at 8:51:47 PM UTC, milktrader wrote: > > Ok, thanks. Can you do the following then? > > 1. restrict the value of Foo to an Int64?

[julia-users] Re: Julia career advice question (x-post r/julia)

2015-12-02 Thread Cristóvão Duarte Sousa
Cedric St-Jean, thank you for the "Python Paradox" link. It was a very good read, and linked to another article "Revenge of the Nerds" http://www.paulgraham.com/icad.html which makes me think that Julia is a kind of "Lisp meets Fortran". On Tuesday, December 1, 2015 at 9:43:51 PM UTC, Cedric

Re: [julia-users] Julia vs C++ single dispatch performance comparison

2015-11-08 Thread Cristóvão Duarte Sousa
f correct branch hits. If you mean to totally >> defeat the branch prediction, I think you should use something >> pseudorandom. >> On Nov 6, 2015 12:27 PM, "Cristóvão Duarte Sousa" <cris...@gmail.com> >> wrote: >> >>> Hi, >>> >>> I've

Re: [julia-users] Julia vs C++ single dispatch performance comparison

2015-11-08 Thread Cristóvão Duarte Sousa
The times for Julia code in my previous email are wrong, I wanted to write: 0.000126 seconds 0.004695 seconds (99.49 k allocations: 1.518 MB) 0.000871 seconds On Sun, Nov 8, 2015 at 10:19 PM Cristóvão Duarte Sousa <cris...@gmail.com> wrote: > I agree, in fact my knowledge about branch p

[julia-users] Julia vs C++ single dispatch performance comparison

2015-11-06 Thread Cristóvão Duarte Sousa
Hi, I've been wondering how Julia dispatching system would compare to the C++ virtual functions dispatch one. Hence, I write a simple test in both Julia and C++ that measures the calling of a function over the elements of both an array of concrete objects and another of abstract pointers to

Re: [julia-users] Julia vs C++ single dispatch performance comparison

2015-11-06 Thread Cristóvão Duarte Sousa
of Julia's dispatch – where do you >> stick the vtable? Most of the time we get performance by avoiding dispatch >> entirely, by pushing the dispatch up as far as possible, but there are >> cases like what you've create here, where that doesn't work. >> >> >>

Re: [julia-users] Julia vs C++ single dispatch performance comparison

2015-11-06 Thread Cristóvão Duarte Sousa
which can be so-much-more-elegantly solved by multiple dispatch in Julia. On Fri, Nov 6, 2015 at 5:43 PM Cristóvão Duarte Sousa <cris...@gmail.com> wrote: > > Around 0.000400 seconds (but sometimes 0.001000). > > > > On Fri, Nov 6, 2015 at 5:39 PM Stefan Karpinski <

[julia-users] Re: Updating a single output line in IJulia

2015-09-14 Thread Cristóvão Duarte Sousa
Not a direct solution to your issue, but what can be done is, using Reactive.jl and Interact.jl, display a string signal in one cell (e.g, label = Input("qwerty")) and then in another cell push to that signal (e.g., push!(label, "new text")) which will readily update the text being displayed

[julia-users] Re: [ANN] FixedSizeArrays

2015-09-05 Thread Cristóvão Duarte Sousa
Thanks Simon! I would like to highlight one reason for the importance of speedy small (and fixed) arrays. Having done some work in MATLAB and knowing that vectorization is almost always the way to go in it, I got very happy when using Julia I could start programming in the same way I think.

Re: [julia-users] Is it possible to constraint the type of a bits type parameter?

2015-09-04 Thread Cristóvão Duarte Sousa
th no time plan for an implementation. > > On Thu, 2015-09-03 at 11:38, Cristóvão Duarte Sousa <cris...@gmail.com> > wrote: > > (This was already asked in Julia Gitter, but I'm switching to the mailing > > list as this may better fit here than in a chat.) > > > > "

[julia-users] Is it possible to constraint the type of a bits type parameter?

2015-09-03 Thread Cristóvão Duarte Sousa
(This was already asked in Julia Gitter, but I'm switching to the mailing list as this may better fit here than in a chat.) """ Is it possible to constraint the type of a bits type parameter? Something like f{N::Int}(x::SomeParamType{N}) where for N::Int I want to mean that N is an instance of

[julia-users] Re: Understanding the Cost of Virtualization

2015-03-28 Thread Cristóvão Duarte Sousa
This is the same issue that prevents a fast symbolic system using Julia dynamic dispatch: https://github.com/jcrist/Juniper.jl/issues/1 . And I guess it is probably the reason Julia self AST representation is not using its own dynamic dispatching system... +1 for trying a faster run-time

Re: [julia-users] Re: Performance - what am I doing wrong?

2015-03-17 Thread Cristóvão Duarte Sousa
Indeed, x^2 seems to be an optimization case in NumPy. See, for x^3: Julia: julia @timeit y = x.^3 1000 loops, best of 3: 265.99 µs per loop Python: In [1]: %timeit y = x**3 1000 loops, best of 3: 259 µs per loop On Monday, March 16, 2015 at 4:08:55 PM UTC, Sisyphuss wrote: Here is my

[julia-users] Re: Simple drawing over image?

2015-01-12 Thread Cristóvão Duarte Sousa
I usually draw with Compose.jl and then overlay the draw to an Images.jl image with a function I'd made: using Images, TestImages, Compose, Color import Compose.compose function compose(img::Image, c::Context) width, height = size(img) surface = Cairo.CairoARGBSurface(zeros(Uint32,

[julia-users] Re: Global variables

2014-12-16 Thread Cristóvão Duarte Sousa
I like the static keyword to declare constant type variables. Maybe you can say something at https://github.com/JuliaLang/julia/issues/964 as this seems something planed. On Monday, December 15, 2014 9:40:50 PM UTC, Greg Plowman wrote: Hi, I understand using global variables can lead to

[julia-users] Re: Animation with Gadfly and IJulia?

2014-11-27 Thread Cristóvão Duarte Sousa
That is really nice! But let me alert that, at least in my case (Julia 3.2), I had to add *using Interact* so that the plot is correctly displayed. Cheers, Cristóvão On Thursday, November 27, 2014 4:59:00 AM UTC, Sheehan Olver wrote: I figured out an approach that works for animation, thanks

[julia-users] Re: Interactive Animated PyPlot in IJulia

2014-11-27 Thread Cristóvão Duarte Sousa
Hi, I was able to do it using Interact, Reactive and Winston in IJulia. For example, in one input cell run using Interact, Reactive, Winston p = Input(0.0:0.0) function f(x) plot(sin(5*x), sin(2π*x)) xlim(-1, 1) ylim(-1, 1) end lift(f, p) and then, in another cell, run your

Re: [julia-users] Bilinear interpolation of image

2014-11-18 Thread Cristóvão Duarte Sousa
interpolation algorithm. --Tim On Wednesday, November 12, 2014 03:57:05 AM Cristóvão Duarte Sousa wrote: Hi, I would like to get the interpolated value at a non-integer point of an image. Using Images.jl and Grid.jl I've tried doing using Images, TestImages, Grid img = convert(Image

[julia-users] Bilinear interpolation of image

2014-11-12 Thread Cristóvão Duarte Sousa
Hi, I would like to get the interpolated value at a non-integer point of an image. Using Images.jl and Grid.jl I've tried doing using Images, TestImages, Grid img = convert(Image{Gray},testimage(mandrill)) # for example img_bi = CoordInterpGrid((1:size(img,1), 1:size(img,2)), img.data,

[julia-users] Re: overloading an abstract interface

2014-07-26 Thread Cristóvão Duarte Sousa
Doing import.bar in the user dfined code side seems to solve the problem. I expected that exporting bar out of the module would also solve the problem, however, it doesn't. On Saturday, July 26, 2014 10:01:50 PM UTC+1, Abe Schneider wrote: I have a pattern that has come up multiple times where

[julia-users] Re: overloading an abstract interface

2014-07-26 Thread Cristóvão Duarte Sousa
Sorry, I mean import testmod.bar . On Sunday, July 27, 2014 12:32:52 AM UTC+1, Cristóvão Duarte Sousa wrote: Doing import.bar in the user dfined code side seems to solve the problem. I expected that exporting bar out of the module would also solve the problem, however, it doesn't

[julia-users] Re: Incoming Gadfly changes

2014-06-21 Thread Cristóvão Duarte Sousa
First, thanks for your very nice work. Second, sorry for the little OT but, I notice IJulia output key not found: user_variables in the first cell. I also get that but I thought it was a problem with my system. Is anyone else also getting that? On Friday, June 20, 2014 11:24:14 PM UTC+1,

[julia-users] Re: how to get vec with index (position) of a particular value (eg 1) in vector

2014-06-19 Thread Cristóvão Duarte Sousa
Hi, julia findin([0 0 1 0 1], 1) 2-element Array{Int64,1}: 3 5 On Thursday, June 19, 2014 3:32:22 PM UTC+1, paul analyst wrote: How to Do a vector indicating the position of a particular value (eg 1) in another vector? by this question: (1)? [0 0 1 01] expected vector [3,5] Paul

[julia-users] Re: Type variables acting differently when accessed through an array

2014-06-18 Thread Cristóvão Duarte Sousa
Notice also that convert(t, 4) just returns a SubString{ASCIIString} and not a Uint64. On Tuesday, June 17, 2014 7:37:59 PM UTC+1, Jack Holland wrote: Does anyone have an explanation for why a type variable (e.g. Uint64) acts differently when accessed in an array (e.g. [Uint64]) than by

[julia-users] Re: Benchmarking study: C++ Fortran Numba Julia Java Matlab the rest

2014-06-17 Thread Cristóvão Duarte Sousa
I've just done measurements of algorithm inner loop times in my machine by changing the code has shown in this commit https://github.com/cdsousa/Comparison-Programming-Languages-Economics/commit/4f6198ad24adc146c268a1c2eeac14d5ae0f300c . I've found out something... see for yourself: using

Re: [julia-users] Re: Benchmarking study: C++ Fortran Numba Julia Java Matlab the rest

2014-06-17 Thread Cristóvão Duarte Sousa
problem since it uses reference counting. On Tue, Jun 17, 2014 at 12:21 PM, Cristóvão Duarte Sousa cri...@gmail.com javascript: wrote: I've just done measurements of algorithm inner loop times in my machine by changing the code has shown in this commit https://github.com/cdsousa/Comparison

Re: [julia-users] Re: Using 0-dimensional arrays to store single boxed immutables

2014-06-16 Thread Cristóvão Duarte Sousa
Thanks Ivar. I see the issue is under investigation. On Mon, Jun 16, 2014 at 11:15 AM, Ivar Nesje iva...@gmail.com wrote: See also #964 https://github.com/JuliaLang/julia/issues/964 Ivar kl. 11:48:47 UTC+2 mandag 16. juni 2014 skrev Cristóvão Duarte Sousa følgende: While I've been used

Re: [julia-users] Precompile() doesn't seems to improve functions first call time

2014-06-13 Thread Cristóvão Duarte Sousa
torsdag 12. juni 2014 skrev Cristóvão Duarte Sousa følgende: Thanks for the explanation, Keno. I'm trying to implement a simulation of rigid body dynamics (a robot in this case) in (almost) real time, so I'm planning to put the integration algorithm inside a Timer which would repeat

[julia-users] Re: Do `let` blocks enable compiler optimization of local variables?

2014-06-13 Thread Cristóvão Duarte Sousa
} Array{Any,1} Array{Int64,1} So, it's not the same (unless one takes care of declaring variables as local)... On Friday, June 13, 2014 11:44:30 AM UTC+1, Cristóvão Duarte Sousa wrote: According to the performace tips, code must be inside functions and variable must be local for better

[julia-users] Precompile() doesn't seems to improve functions first call time

2014-06-12 Thread Cristóvão Duarte Sousa
Hi, With Julia 0.3.0-prerelease+3609 (Commit 664cab5 (2014-06-10 05:18 UTC)) in Arch Linux x86_64, precompile() doesn't seems to effectively improve functions first call time. For example, this code: N = 10 A = rand(N,N) B = rand(N,N) function f(a, b) c=a+b c end @time precompile(f,

Re: [julia-users] Precompile() doesn't seems to improve functions first call time

2014-06-12 Thread Cristóvão Duarte Sousa
is relatively simple so type inference and codegen don't have to work very hard as compared to the actual binary generation. Maybe precompile in REPL mode should also do the final compilation, but I hope that explanation is at least useful. On Thu, Jun 12, 2014 at 10:47 AM, Cristóvão Duarte

Re: [julia-users] Re: Generating latex friendly plots

2014-05-13 Thread Cristóvão Duarte Sousa
I can generate the .pgf without having to setup the backend which I think is the expected behavior. According to the docs: Figures can also be directly compiled and saved to PDF with plt.savefig('figure.pdf') by either switching to the backend... So it seems its only needed to save the PDFs... You

[julia-users] Re: Generating latex friendly plots

2014-05-12 Thread Cristóvão Duarte Sousa
Hi, Were you aware that matplotlib itself has a PGF/TikZ backend http://matplotlib.org/users/pgf.html ? With it one does not need to use matplotlib2tikz, and one can save plots either as PFG files, prepared to be included in some LaTeX document, or directly as PDF. It took me long time to

[julia-users] Re: Generating latex friendly plots

2014-05-12 Thread Cristóvão Duarte Sousa
Ah, attention that both plt.rc(.. blocks in my examples are completely optional, I just use them to better match the default LaTeX visuals. On Monday, May 12, 2014 1:38:54 PM UTC+1, Cristóvão Duarte Sousa wrote: Hi, Were you aware that matplotlib itself has a PGF/TikZ backend http

[julia-users] Re: Generating latex friendly plots

2014-05-12 Thread Cristóvão Duarte Sousa
)# but this works println(PyPlot.matplotlib[:rcParams][axes.linewidth]) 1.0 1.0 2.0 Sure, I should had report these issues in the first place but I got a little lazy :p On Monday, May 12, 2014 1:57:01 PM UTC+1, Steven G. Johnson wrote: On Monday, May 12, 2014 8:38:54 AM UTC-4, Cristóvão Duarte Sousa wrote

Re: [julia-users] Re: JuliaCon: Registration is open!

2014-05-07 Thread Cristóvão Duarte Sousa
I've wondered exactly the same. Google knows nothing about that... On Wednesday, May 7, 2014 9:25:24 AM UTC+1, Ivar Nesje wrote: What is [image: Julia Computing]http://juliacon.org/images/sponsors/juliacomputing.png The third sponsor. It does not have a link. Ivar kl. 03:21:47

[julia-users] Re: ANN: Coverage.jl - Code coverage tracking w/ coveralls.io

2014-05-07 Thread Cristóvão Duarte Sousa
Hi, thanks for this package. I've setup two repositories for using Coverage.jl with similar .travis.yml files. One works and do the reports well. The other gives an HTTP Parser Exception (see [1]) when doing the report; which I can reproduce in my system doing export TRAVIS_JOB_ID=30; julia -e

Re: [julia-users] Re: ANN: Coverage.jl - Code coverage tracking w/ coveralls.io

2014-05-07 Thread Cristóvão Duarte Sousa
() - you are right, its a little subtle. I'll reply here if I figure out the issue. Thanks, Iain On Wednesday, May 7, 2014 9:41:34 AM UTC-4, Cristóvão Duarte Sousa wrote: Hi, thanks for this package. I've setup two repositories for using Coverage.jl with similar .travis.yml files. One

Re: [julia-users] Re: Pyston: a(nother) JIT-based Python implementation

2014-04-05 Thread Cristóvão Duarte Sousa
, all things Julia does not do at the moment. -Jake On Friday, April 4, 2014 2:46:08 PM UTC-4, Cristóvão Duarte Sousa wrote: Once again pythonistas feel the need for a single high-level-high-performance language: https://tech.dropbox.com/2014/04/introducing-pyston-an-upcoming-jit-based

Re: [julia-users] suggestions: end statement, indentention, case statement, ...

2014-04-05 Thread Cristóvão Duarte Sousa
Friedrich, Julia does not only use ideas from Python but also from other languages, like Matlab, Lisp, ... (and of course it has it own state of the art, unique and amazing techniques). Since julia aims at technical problems, with lots of linear algebra, it makes some sense to use * for

Re: [julia-users] Re: suggestions: end statement, indentention, case statement, ...

2014-04-05 Thread Cristóvão Duarte Sousa
Indeed, `if x!=0` is so much more self-explanatory than `if bool(x)`. Friedrich, I believe `if 5` has to work in C since C has no native booleans (`a==b` returns an int). On Saturday, April 5, 2014 11:59:14 PM UTC+1, Stefan Karpinski wrote: You have a point – the bool function is meaningless

[julia-users] Pyston: a(nother) JIT-based Python implementation

2014-04-04 Thread Cristóvão Duarte Sousa
Once again pythonistas feel the need for a single high-level-high-performance language: https://tech.dropbox.com/2014/04/introducing-pyston-an-upcoming-jit-based-python-implementation/

[julia-users] Re: Converting to type provided as type parameter

2014-04-03 Thread Cristóvão Duarte Sousa
I think the julian way is y = convert(Tv, x) On Thursday, April 3, 2014 10:11:20 AM UTC+1, Sergey Bartunov wrote: Given the type Tv : FloatingPoint how can I automatically convert variable x::FloatingPoint to Tv? For me the most intuitive way is to write Tv(x), but this doesn't work.

[julia-users] Re: Numeric Type Parameter

2014-04-02 Thread Cristóvão Duarte Sousa
And let me add that, as far as I know, a call as ModInt{i}(...) is always a call to a inner constructor of the type ModInt{i}. We cannot call external constructors like that. Moreover, external constructors seem be be ordinary generic functions and one can even do stuff unrelated to the type

[julia-users] Re: Numeric Type Parameter

2014-04-02 Thread Cristóvão Duarte Sousa
{3}(5.0) n=3 k=5 T=Float64 ModInt{3}(2) In this case, the *3* in the constructor call is referred to *n* (the type) and not to *T*. I had little hard time until I understood all of this :) On Wednesday, April 2, 2014 9:52:25 AM UTC+1, Cristóvão Duarte Sousa wrote: And let me add that, as far

[julia-users] Re: The then keyword

2014-03-20 Thread Cristóvão Duarte Sousa
. But the question is answered: that's the julian way :) Thanks On Wednesday, March 19, 2014 8:59:10 PM UTC, Steven G. Johnson wrote: On Wednesday, March 19, 2014 11:33:57 AM UTC-4, Cristóvão Duarte Sousa wrote: Sometimes I see myself writing one line if-elses like `if x0 x=-x end`, which I think

Re: [julia-users] Re: The then keyword

2014-03-20 Thread Cristóvão Duarte Sousa
not bad to put a semicolon before the end as well, but I don't know that leaving it out has the same potential to cause trouble. On Thursday, 20 March 2014 10:24:16 UTC+1, Cristóvão Duarte Sousa wrote: Hum, ok. Although the short-circuit is more or less known among several programming languages

[julia-users] The then keyword

2014-03-19 Thread Cristóvão Duarte Sousa
Hi, Sometimes I see myself writing one line if-elses like `if x0 x=-x end`, which I think is not very readable. What is your advice for that? That is ok, always put a semicolon after the condition or totally avoid one liners? BTW, have you Julia devs ever considered introducing a then keyword

Re: [julia-users] Packing and unpacking parameters

2014-03-11 Thread Cristóvão Duarte Sousa
Great approach John! I was not aware of the linear indexing of type fields, that opens a lot of possibilities. Thanks On Tue, Mar 11, 2014 at 3:51 PM, John Myles White johnmyleswh...@gmail.comwrote: For now, I suspect the easiest way to do this is to switch back and forth between immutable

[julia-users] Re: Element-wise operations and allocation

2014-03-10 Thread Cristóvão Duarte Sousa
Please see https://github.com/JuliaLang/julia/issues/249 and https://github.com/JuliaLang/julia/issues/3424. On Monday, March 10, 2014 12:24:20 PM UTC, Carlos Becker wrote: Hello, I recently found out this: julia b = rand((1024,1024)) julia sizeof(b) 8388608 julia @time b += 2;

[julia-users] Re: Packing and unpacking parameters

2014-03-07 Thread Cristóvão Duarte Sousa
How amazing! I have been about to post the very same question to this list! So, I wouldn't say it's a stupid question at all :) I believe this kind of packing/unpacking of several heterogeneous (in structure, not in type) parameters appear a lot in modeling and optimization. This probably is a

[julia-users] Re: Packing and unpacking parameters

2014-03-07 Thread Cristóvão Duarte Sousa
By reading your question once again, I realised that it may be not quite like mine. If you are ok with using p.a, p.b, p.c, ... then the custom composite type is the solution. A more flexible approach (as I do) is the dictionary with symbols as keys which would then be called by p[:a], p[:b],

[julia-users] Re: Function matching

2014-02-27 Thread Cristóvão Duarte Sousa
For now, maybe you can do this function f{S,T}(a::A{S}, v::T) @assert T:S # ... end On Thursday, February 27, 2014 5:39:35 AM UTC, Fil Mackay wrote: type A{T} end function f{T}(a::A{T}, v::T) end a = A{Number}() f(a, 3) #no method f(A{Number}, Int64) #while loading In[4],

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

2014-02-26 Thread Cristóvão Duarte Sousa
Stefan, I've wondered if command literals couldn't be created with just a new non-standard string literal, something like ccommand arg1 arg2. The only problem I see is that then every double quote mark in the command has to escaped (which will confuse the code though). Even if I use the command

[julia-users] Segfault in Pkg.update() in a fresh Julia installation

2014-02-05 Thread Cristóvão Duarte Sousa
Hi, I'm using Julia compiled from git in Arch linux, and in the last weeks I've been getting almost random segmentation faults, mainly, but not only, when running Pkg.update(). I've followed the procedures from https://gist.github.com/staticfloat/6188418 (except for the Github issue opening)

Re: [julia-users] Matlab versus Julia for loop timing

2014-01-29 Thread Cristóvão Duarte Sousa
About block comment, you can define a macro like macro comment(x) end and use it to comment blocks: @comment begin some code some code end @comment for i=1:10 some code end @comment function f() some code end On Thursday, January 30, 2014 2:12:16 AM UTC, Rajn wrote: Ok issue

Re: [julia-users] Re: How to define a single column matrix literal?

2014-01-27 Thread Cristóvão Duarte Sousa
triggering any memory allocation. --Tim On Sunday, January 26, 2014 10:47:43 PM Cristóvão Duarte Sousa wrote: BTW, I need that to compare against a column vector with 2 dimensions received from Python through SymPy.jl. It is not a big issue, I can perfectly use [1 2 3]'. I'm just

[julia-users] Serialize and deserialize generic functions

2014-01-27 Thread Cristóvão Duarte Sousa
Hi, I would like to do something like f(x) = x+1 open(f.jld, w) do file serialize(file, f) end then, close julia, open it again and do open(f.jld, r) do file f = deserialize(file) end f(1) but that gives ERROR: f not defined Is serialization supposed to be able to do this? If yes,