[julia-users] Re: Tracking down type instability

2016-09-16 Thread Ben Ward
e @simd macro :/ On Friday, September 16, 2016 at 10:00:49 PM UTC+1, Kristoffer Carlsson wrote: > > What if you add @simd after @inbounds? > > On Friday, September 16, 2016 at 5:48:00 PM UTC+2, Ben Ward wrote: >> >> The code for that function not shown is rather si

[julia-users] Re: Tracking down type instability

2016-09-16 Thread Ben Ward
hat this means p from > > p, l = distance(Proportion{AnyMutation}, seqs) > > which we can't analyze from what you show here. > > On Thursday, September 15, 2016 at 10:08:16 AM UTC-4, Ben Ward wrote: >> >> Hi I have two functions and a function which calls them: >> >&

Re: [julia-users] Tracking down type instability

2016-09-16 Thread Ben Ward
ely ok. > > On Friday, September 16, 2016 at 4:37:09 AM UTC+2, Yichao Yu wrote: >> >> On Thu, Sep 15, 2016 at 10:08 AM, Ben Ward <axolotl...@gmail.com> wrote: >> > Hi I have two functions and a function which calls them: >> > >> > @inline functio

[julia-users] Tracking down type instability

2016-09-15 Thread Ben Ward
Hi I have two functions and a function which calls them: @inline function expected_distance(::Type{JukesCantor69}, p::Float64) return -0.75 * log(1 - 4 * p / 3) end @inline function variance(::Type{JukesCantor69}, p::Float64, l::Int64) return p * (1 - p) / (((1 - 4 * p / 3) ^ 2) * l) end

[julia-users] Re: Telling if code is vectorised.

2016-09-14 Thread Ben Ward
2016 at 4:33:39 PM UTC+2, Ben Ward wrote: >> >> Hi, >> >> I've written a simple function: >> >> function testfun2() >> a = 0 >> @inbounds @simd for i in UInt64(1):UInt64(1000) >> i = i - ((i >> 1) & 0x) &

[julia-users] Telling if code is vectorised.

2016-09-14 Thread Ben Ward
Hi, I've written a simple function: function testfun2() a = 0 @inbounds @simd for i in UInt64(1):UInt64(1000) i = i - ((i >> 1) & 0x) a += ((i & 0x) + ((i >> 2) & 0x)) end return a end I applies the same set of bit

[julia-users] @inbounds macro scope, and @simd

2016-08-26 Thread Ben Ward
Hi, Just wondering, I have the following doube loop: for site in 1:nsites votes[1] = votes[2] = votes[3] = votes[4] = votes[5] = 0 for seq in 1:neqs nuc = mat[seq, site] votes[1] += iscompatible(nuc, DNA_A) votes[2] += iscompatible(nuc, DNA_C)

Re: [julia-users] Recursive/Circular parametric types

2016-08-25 Thread Ben Ward
-more-on-types-with-values-as-parameters> > > > Best, > --Tim > > On Tuesday, August 23, 2016 3:28:17 PM CDT Ben Ward wrote: > > I'm doing some development and wondered if this kind of pattern is > > problematic: > > > > abstract AbstractNode

[julia-users] Recursive/Circular parametric types

2016-08-23 Thread Ben Ward
I'm doing some development and wondered if this kind of pattern is problematic: abstract AbstractNode abstract PhylogenyNode <: AbstractNode abstract NetworkNode <: AbstractNode abstract AbstractEdge abstract PhylogenyEdge <: AbstractEdge abstract NetworkEdge <: AbstractEdge type Branch{N <:

[julia-users] Perhaps stupid question: Method type stability and throws

2016-05-07 Thread Ben Ward
Hi, I have a question which may be laughable to CS people (be gentle, I'm a Biologist), but we know from guidelines that Julia performs best, when a method always returns the same type of value. So the Julia type inference knows - ok, use this method with an Int, it will always return a bool

[julia-users] Re: Trouble with parametric parts of a type def

2016-04-28 Thread Ben Ward
}, AbstractVector{UInt128}} On Thursday, April 28, 2016 at 11:44:14 PM UTC+1, Ben Ward wrote: > > Hi, I'm tying to create a parametric type which can hold a variable which > could be any kind of vector, and whatever the vector is, it can store one > of the UInts. So it could hav

[julia-users] Trouble with parametric parts of a type def

2016-04-28 Thread Ben Ward
Hi, I'm tying to create a parametric type which can hold a variable which could be any kind of vector, and whatever the vector is, it can store one of the UInts. So it could have: UInt8[1,2,3] UInt64[1,2,3] UnitRange(1, 3) UnitRange(UInt16(1), UInt16(3)) ... and so on. But I'm having trouble

[julia-users] Julia programs in pipes

2016-03-04 Thread Ben Ward
Hi, I'm wondering how easy it is to make a Julia script that can be part of a shell pipeline `cat file > julia myscript.jl > output.txt`? When reading the documentation, I get the impression most io is designed to be done all at once. I know how to loop over a file handle or stream, and I

[julia-users] Re: Issue with macros for creating types

2016-02-26 Thread Ben Ward
Ohhh I see it, yep. Can't give a number in a parametric type definition - ugh, well that's tiredness! On Saturday, February 27, 2016 at 2:12:43 AM UTC, Ben Ward wrote: > > Hi, > > I'm trying to create a macro for the BioJulia project which will allow > easy creation of biolo

[julia-users] Issue with macros for creating types

2016-02-26 Thread Ben Ward
Hi, I'm trying to create a macro for the BioJulia project which will allow easy creation of biological alphabets, which will work with the new BioSequence type we are designing as a major improvement to the Seq module. As it will be creating types and functions, I expect hygiene will be an

[julia-users] Julia compilation - forcing architecture

2016-02-16 Thread Ben Ward
Hi, I'm compiling Julia on a multi node cluster system and whilst I can get to to compile and install successfully, it compiles for the incorrect cpu architecture perhaps because I'm building it from a specific software install node. Which Makefiles, and their variables, must I edit in order to

[julia-users] Compilation of Julia on cluster - getting some error

2016-02-12 Thread Ben Ward
Hi Julia community! I've got Julia compiled successfully on my workstation without issue, but I'm trying to do it now in my cluster environment at work, which I believe is RedHat or some similar linux. I have permissions to install and compile software in a given directory. However during

Re: [julia-users] AVL Trees - SortedSet?

2016-02-04 Thread Ben Ward
AVL trees. > > Cheers, >Kevin > > On Wednesday, February 3, 2016, Ben Ward <axolotl...@gmail.com > > wrote: > >> Hi, >> >> I'm looking to implement a C library in Julia which makes use of another >> library which contains a sorted dictionary c

[julia-users] AVL Trees - SortedSet?

2016-02-03 Thread Ben Ward
Hi, I'm looking to implement a C library in Julia which makes use of another library which contains a sorted dictionary called a AVL table. I don't know much about the technical internals of ALV table, and the C looks complicated to get into, if Julia already has something that does the job.

[julia-users] Anonymous functions now faster? Need for functors?

2016-01-31 Thread Ben Ward
Hi, I just saw this merged PR . In the past I used the functor trick of defining a type, and then a call method for the type, and passing this to a function, to get past the anonymous function inefficiency. Does this PR mean (to a mortal like me)

[julia-users] A Julia equivalent of destructors - is that a thing?

2015-12-09 Thread Ben Ward
Hi, I'm not sure of the answer, but is there an equivalent of the concept of a class destructor in Julia? I can imagine a situation where there is some type where a field is something like - for example - a file stream, and you want to make sure if that variable gets deleted by the gc, then

Re: [julia-users] A Julia equivalent of destructors - is that a thing?

2015-12-09 Thread Ben Ward
work, or types associated with a stream field are a possibility. On Wednesday, December 9, 2015 at 7:16:25 PM UTC, Stefan Karpinski wrote: > > http://docs.julialang.org/en/release-0.4/stdlib/base/#Base.finalizer > > On Wed, Dec 9, 2015 at 2:12 PM, Ben Ward <axolotl...@gmail.com >

Re: [julia-users] Get the OS

2015-12-08 Thread Ben Ward
@unix_only ...code > > @osx_only ...code > > @linux_only code... > > > > Or the variable name `OS_NAME` that will return the OS name as a symbol. > > > > Plenty of options :) > > > > On Tue, Dec 8, 2015 at 1:46 PM, Ben Ward <ax

Re: [julia-users] Re: The growth of Julia userbase

2015-11-15 Thread Ben Ward
48 PM, Tony Kelman <to...@kelman.net >>> > wrote: >>> >>>> There are some interesting numbers at >>>> https://github.com/JuliaLang/julia/graphs/traffic >>>> >>>> Elliot Saba also did some scraping of the AWS download logs for

[julia-users] Getting length of step range in function.

2015-11-10 Thread Ben Ward
Hi, You can get the length of a StepRange: *julia> **length(2:1:9)* *8* But if I try to do so inside a function I get an error about not finding a call method: *julia> **function myfun(width::Int, step::Int, length::Int)* *clip = Int(floor(width / 2))* *start = 1 +

Re: [julia-users] Re: The growth of Julia userbase

2015-11-04 Thread Ben Ward
gt; and shared the aggregate numbers (broken down by platform) privately with a > few people, it may be worth sharing those publicly. > > > On Wednesday, November 4, 2015 at 8:26:19 AM UTC-8, Ben Ward wrote: > > Hi all, > > I was wondering are there any metrics or stats ava

[julia-users] The growth of Julia userbase

2015-11-04 Thread Ben Ward
Hi all, I was wondering are there any metrics or stats available that show how the user-base of Julia has grown over the last few years, and what it's size is now? Many Thanks, Ben W.

Re: [julia-users] Re: The growth of Julia userbase

2015-11-04 Thread Ben Ward
AWS download logs for binaries > and shared the aggregate numbers (broken down by platform) privately with a > few people, it may be worth sharing those publicly. > > > On Wednesday, November 4, 2015 at 8:26:19 AM UTC-8, Ben Ward wrote: >> >> Hi all, >> >>

[julia-users] Combining arrays in an R enlist like manner

2015-10-12 Thread Ben Ward
Hi, In R, if you have a list, containing two vectors that are - say - numeric, you can unlist them into one vector: > a <- list(c(1,2,3,4,5), c(7,8,9,10,11)) > a [[1]] [1] 1 2 3 4 5 [[2]] [1] 7 8 9 10 11 > unlist(a) [1] 1 2 3 4 5 7 8 9 10 11 > Is there a convenient

[julia-users] Request for comments: best way to deal with type uncertainty.

2015-09-24 Thread Ben Ward
Hi Julia Users, I'm one of the Core-Devs in the BioJulia organisation, with a background in evolutionary biology/genetics, and, with a few other contributors I'm writing Bio.jl's Phylo submodule. The primary type of this submodule is the Phylogeny. Which is a composite type, used to describe

[julia-users] Re: Request for comments: best way to deal with type uncertainty.

2015-09-24 Thread Ben Ward
B) On Thursday, September 24, 2015 at 8:17:52 PM UTC+1, Ben Ward wrote: > > Hi Julia Users, > > I'm one of the Core-Devs in the BioJulia organisation, with a background > in evolutionary biology/genetics, and, with a few other contributors I'm > writing Bio.jl's P

Re: [julia-users] Re: Creating a show method for type alias

2015-08-16 Thread Ben Ward
versatile than using a type alias... If you want to treat an instance of CIGARString like you would any old vector, then just overload the standard methods, e.g. getindex, setindex!, e.t.c. On 15 August 2015 at 09:26, Ben Ward axolotl...@gmail.com javascript: wrote: Would that work

[julia-users] Re: Creating a show method for type alias

2015-08-14 Thread Ben Ward
:07:15 UTC+10, Ben Ward wrote: Hi, I have implemented a basic immutable type with a type alias for a vector of said type: immutable CIGAR OP::Operation Size::Int end function CIGAR(op::Char, size::Int) return CIGAR(Operation(op), size) end function convert(::Type{String

Re: [julia-users] Creating a show method for type alias

2015-08-14 Thread Ben Ward
for a typealias as it is indistinguishable from the type it aliases. On Mon, 2015-08-10 at 19:07, Ben Ward axolotl...@gmail.com javascript: wrote: Hi, I have implemented a basic immutable type with a type alias for a vector of said type: immutable CIGAR OP::Operation

[julia-users] Creating a show method for type alias

2015-08-10 Thread Ben Ward
Hi, I have implemented a basic immutable type with a type alias for a vector of said type: immutable CIGAR OP::Operation Size::Int end function CIGAR(op::Char, size::Int) return CIGAR(Operation(op), size) end function convert(::Type{String}, cigar::CIGAR) return

[julia-users] Julia's Scheduler and Event Loop

2015-07-21 Thread Ben Ward
Hi there, I'd like to try some event driven programming, where a segment of code is set to run, but only when an event occurs - think like EventListeners in Node.js. I think this should be pretty easy with Julia's Scheduler, and I'm currently going over the standard library reference

[julia-users] Getting Errors / messages from an external program.

2015-07-03 Thread Ben Ward
Hi, I want to run an external command in Julia. Should a command fail I want to get the message from the external command. I know failed commands raise a general exception that can be caught: *run(`dat hi`)* dat: hi is not a valid command *ERROR: failed process: Process(`dat hi`,

[julia-users] Re: Creating function with a macro

2015-06-17 Thread Ben Ward
Vector{Int} f f (generic function with 1 method) julia f(Int[]) Array{Int64,1} On Wednesday, June 17, 2015 at 2:13:41 PM UTC-4, Ben Ward wrote: Hi, I want to create a macro with which I can create a function with a custom bit of code: In the repl I can do a toy example: *name = :hi

[julia-users] Creating function with a macro

2015-06-17 Thread Ben Ward
Hi, I want to create a macro with which I can create a function with a custom bit of code: In the repl I can do a toy example: *name = :hi* *vectype = Vector{Int}* *quote** function ($name)(v::$vectype)* *println(hi)* *end* *end* However if I try to put this in a macro and use

[julia-users] Re: Creating function with a macro

2015-06-17 Thread Ben Ward
UTC+2, Ben Ward wrote: Hi, I want to create a macro with which I can create a function with a custom bit of code: In the repl I can do a toy example: *name = :hi* *vectype = Vector{Int}* *quote** function ($name)(v::$vectype)* *println(hi)* *end* *end* However if I try

[julia-users] Re: Creating function with a macro

2015-06-17 Thread Ben Ward
. On Wednesday, June 17, 2015 at 11:20:47 PM UTC+1, Ben Ward wrote: I guess for Base sort! passing a functior overriding call() as lt is possible, if it accepts the three arguments passed to lt in lt(o, x, v[j-1 ]) On Wednesday, June 17, 2015 at 9:11:22 PM UTC+1, Kristoffer Carlsson wrote: You

Re: [julia-users] Re: upper_bound and lower_bound equivalents for Julia

2015-06-13 Thread Ben Ward
function for any alternatives. By returning s, you ensure that LLVM won't do anything tricky like noticing you don't actually use the output value and optimize your test away. --Tim On Friday, June 12, 2015 08:52:56 PM Ben Ward wrote: Just to update, I realised this might be a prime

Re: [julia-users] Re: upper_bound and lower_bound equivalents for Julia

2015-06-13 Thread Ben Ward
tuned to the problem you care about, rather than being forced to use library functions. --Tim On Saturday, June 13, 2015 07:07:22 AM Ben Ward wrote: Just gave it a go - My code translated from C++ still performs very well. function runss(arr, limits) s = 0 for l in limits

Re: [julia-users] Re: upper_bound and lower_bound equivalents for Julia

2015-06-13 Thread Ben Ward
. See, for example, https://github.com/JuliaLang/julia/pull/11685, which speeds up a bunch of other functions using functors. These ideas should probably be applied to sorting as well. Cheers, Kevin On Sat, Jun 13, 2015 at 10:35 AM, Ben Ward axolotl...@gmail.com javascript: wrote

Re: [julia-users] Re: upper_bound and lower_bound equivalents for Julia

2015-06-13 Thread Ben Ward
be applied to sorting as well. Cheers, Kevin On Sat, Jun 13, 2015 at 10:35 AM, Ben Ward axolotl...@gmail.com javascript: wrote: Thanks Kevin, I hadn't seen searchsortedfirst until now, presumably you can specify a function to use to sort more complex objects (for example an array

[julia-users] Re: upper_bound and lower_bound equivalents for Julia

2015-06-12 Thread Ben Ward
findfirst(x - x 10, arr)* 1.606 milliseconds (25 allocations: 1642 bytes) *4* *@time upperBound(arr, 1, length(arr), 10)* 7.284 microseconds (6 allocations: 208 bytes) *4* Thanks, Ben. On Saturday, June 13, 2015 at 2:41:27 AM UTC+1, Ben Ward wrote: Hi, I'm implementing some C

[julia-users] upper_bound and lower_bound equivalents for Julia

2015-06-12 Thread Ben Ward
Hi, I'm implementing some C++ code in Julia and the code uses the upper_bound and lower_bound functions from the C++ standard library http://www.cplusplus.com/reference/algorithm/lower_bound/. I was wondering if a method for achieving a similar result with arrays has been achieved in Julia?

[julia-users] Copying a simple immutable types

2015-04-26 Thread Ben Ward
I've written a simple immutable type and I'm a little confused by some behaviour I've seen: immutable GapAnchor gapPos::Int seqPos::Int end function Base.copy(src::GapAnchor) return GapAnchor(src.gapPos, src.seqPos) end a = GapAnchor(5, 9) GapAnchor(5,9) b = copy(a)

[julia-users] Re: Copying a simple immutable types

2015-04-26 Thread Ben Ward
a = 156.123 156.123 julia pointer_from_objref(b) Ptr{Void} @0x06e73a70 julia pointer_from_objref(a) Ptr{Void} @0x06e741e0 julia a === b true On Sunday, April 26, 2015 at 4:48:23 PM UTC+2, Ben Ward wrote: I've written a simple immutable type and I'm a little confused

[julia-users] Static parameter T doesen't occur in signature?

2015-03-05 Thread Ben Ward
Hi, I'm trying to write something that makes a type alias of Dict{PhyNode, T}, and then use that type alias in a composite type TreeAnnotations{T} as in the code below. However Julia tells me about the TreeAnnotations{T}(x::Phylogeny) function: Warning: static parameter T does not occur in

Re: [julia-users] Static parameter T doesen't occur in signature?

2015-03-05 Thread Ben Ward
and suitably Julian? Best, Ben. On Thursday, March 5, 2015 at 8:42:27 PM UTC, Tim Holy wrote: On Thursday, March 05, 2015 12:07:21 PM Ben Ward wrote: However Julia tells me about the TreeAnnotations{T}(x::Phylogeny) function: Warning: static parameter T does not occur in signature for call

[julia-users] Re: Making optional fields of unknown type more efficient

2015-02-24 Thread Ben Ward
on. Best, Ben. On Tuesday, February 24, 2015 at 1:30:57 AM UTC, Ben Ward wrote: Hi, In Julia, if you are not sure of an arguments type beforehand, you can use 'Any', or if you know it comes under an abstract type, you can use that. I've been working on a type for BioJulia which allows

Re: [julia-users] Making optional fields of unknown type more efficient

2015-02-24 Thread Ben Ward
{PhyNode{T}} parent::PhyNode{T} end If a user needs to have different types of things in PhyNode.extensions she can choose PhyExtension{Any} and loose some performance, otherwise a concrete type, like PhyExtension{Float64}, will be fast. On Tue, 2015-02-24 at 02:30, Ben Ward axolotlfan9

[julia-users] Making optional fields of unknown type more efficient

2015-02-23 Thread Ben Ward
Hi, In Julia, if you are not sure of an arguments type beforehand, you can use 'Any', or if you know it comes under an abstract type, you can use that. I've been working on a type for BioJulia which allows for representation of a node of a phylogenetic tree that will allow annotation with

[julia-users] Finding common values in arrays.

2014-08-02 Thread Ben Ward
Given a variable number of arrays, or an array of arrays, what is the best Julian way to find the values that occur in all of them? So for a = [1,2,3,4,5] b = [6,7,3,4,9] would return 3 and 4? I thought about using .== for every possible pair of the N arrays but I wondered if there was a

[julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
Hi, I've been writing a type for recursive tree structures, and several types that traverse that tree in various manners like breadth first or depth first. They have their own methods for getting the current tree node, moving to the next node, whether an end has been reached and so on. The

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
example, check out ProfileView.jl/src/tree.jl. Best, --Tim On Sunday, July 27, 2014 05:13:39 AM Ben Ward wrote: Hi, I've been writing a type for recursive tree structures, and several types that traverse that tree in various manners like breadth first or depth first. They have

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
/600cbcf645a73525fb6d563d5a148b9d8b2668aa/src/counter.jl but many other packages (DataFrames, Gtk, HDF5, etc) define iterators. --Tim On Sunday, July 27, 2014 06:41:43 AM Ben Ward wrote: I'm not nessecerily trying it iterate over the children of a node. Rather I have defined a series

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
, and make your iterator-types trivial? --Tim On Sunday, July 27, 2014 11:07:36 AM Ben Ward wrote: My traverser types are not exactly wrappers quite a simple as they contain FIFO and FILO structures that keep track of things - I struggle to imagine how else to have them. Do

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
Yesh I'm reading through Iterators.jl now to try and get my head around it. On Sunday, July 27, 2014 7:58:09 PM UTC+1, Tim Holy wrote: Did you check out the examples I suggested? :) On Sunday, July 27, 2014 11:56:16 AM Ben Ward wrote: I had not considered this - so state variable

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
AM Ben Ward wrote: I had not considered this - so state variable is a complex type which would have say the Queue/Stack and current value, and the start, next and done methods update it? On Sunday, July 27, 2014 7:48:56 PM UTC+1, Tim Holy wrote: Why can't you keep track

Re: [julia-users] Creation of custom iterators.

2014-07-27 Thread Ben Ward
` instead of `start`. That change will make your `start` function extend the one from Base with new methods, rather than being a separate function that happens to be named `start`. (This is a super common confusion.) -- Leah On Sun, Jul 27, 2014 at 2:40 PM, Ben Ward axolotl...@gmail.com

[julia-users] Checking for Undefined Reference.

2014-07-22 Thread Ben Ward
I have a type that contains references to other instances of the same type - like a doubly linked list or - as it's intended use, like a tree like structure. They contain references to a parent of the same types and an array of references to children of the same type. However a root or singly

[julia-users] String from a substring

2014-07-21 Thread Ben Ward
This is probably a simple question, I've done a string splitting operation with split(), which has given me an array of SubString types, but I want them to be of type String so as I can feed the bits of the split up string to some method that requires a String type. string(*substring type*)

Re: [julia-users] String from a substring

2014-07-21 Thread Ben Ward
are you calling where this doesn't work? -- Leah On Mon, Jul 21, 2014 at 11:13 AM, Ben Ward axolotl...@gmail.com javascript: wrote: This is probably a simple question, I've done a string splitting operation with split(), which has given me an array of SubString types, but I want them

Re: [julia-users] String from a substring

2014-07-21 Thread Ben Ward
function are you calling where this doesn't work? -- Leah On Mon, Jul 21, 2014 at 11:13 AM, Ben Ward axolotl...@gmail.com javascript: wrote: This is probably a simple question, I've done a string splitting operation with split(), which has given me an array of SubString types, but I

[julia-users] Specific methods for parametric types

2014-07-04 Thread Ben Ward
If I define a parametric type: type MyType{T} firstval::T secondval::T end Can specific methods then be written for specific forms of MyType? For example a method that only worked for MyType containing Int64 as T? I haven’t tried this yet - I've run into my first real world application of

[julia-users] Re: Tagging a package

2014-07-03 Thread Ben Ward
Ok I found the issue relating to this problem: https://github.com/JuliaLang/julia/issues/5998 I deleted the Julia Package manager token on GitHub as suggested and it now works! On Thursday, July 3, 2014 3:57:20 AM UTC+1, Ben Ward wrote: Hi, I'm trying to update a package for the first time

[julia-users] Tagging a package

2014-07-02 Thread Ben Ward
Hi, I'm trying to update a package for the first time with the new package manager commands like tag and so on: *julia **Pkg.publish()* *INFO: Validating METADATA* *INFO: Pushing Phylogenetics permanent tags: v0.0.2* Permission denied (publickey). fatal: Could not read from remote

Re: [julia-users] Macros inside functions

2014-04-18 Thread Ben Ward
of your text to the buffer, then calling takebuf_string(iobuf) at then end On Thu, Apr 17, 2014 at 11:38 PM, Ben Ward axolotl...@gmail.comjavascript: wrote: Hi Is it possible to use macros inside o functions in Julia if they are expanded at compile time as the manual says? I've been playing

Re: [julia-users] Macros inside functions

2014-04-18 Thread Ben Ward
concatenation using $ or * or string (all of which are exactly equivalent) is going to be slow compared to making an IOBuffer, printing / writing / or showing all of your text to the buffer, then calling takebuf_string(iobuf) at then end On Thu, Apr 17, 2014 at 11:38 PM, Ben Ward axolotl

[julia-users] expandmacro() on function definitions.

2014-04-18 Thread Ben Ward
Hi, Is it possible to use expandmacro() on a function/method definition which contains within it a code generating macro? If I put the function definition in a begin end block, and assign it to a variable called code and then do expandmacro(code) it just tells me *(generic function with 1

[julia-users] Recursive function works without macro but does not work with it.

2014-04-18 Thread Ben Ward
Hi, I have quite a complex couple of functions and a long winded problem, I'll be as clear as I can be. I have a function, which builds up composite types based on the contents of a data file (XML). I use a recursive function to do this: (Note it's not 100% finished but it does successfully

[julia-users] Equivalent to R's seq()?

2014-03-12 Thread Ben Ward
Hi all, In R if I want to generate a sequence of numbers, say 5, 10, 15, 20, in R seq(from=5, to=20, by=5) would achieve this. I've had a glance over the sections of the standard library functions doc and didn't see a function like this - (unless it has a totally different name or a package

[julia-users] Composite type fields and types defined

2014-03-01 Thread Ben Ward
Hi, Is there a way to extract the names and types of the fields in a given composite type? Say: type MyType a::Int end Is there a way to get the field 'a', and the type of the field Int? I think I've seen a way to get the type in the manual but not the name assigned to the field.

Re: [julia-users] Composite type fields and types defined

2014-03-01 Thread Ben Ward
Thanks Mauro! On Saturday, March 1, 2014 8:40:31 AM UTC, Mauro wrote: have a look at http://docs.julialang.org/en/release-0.2/stdlib/base/#reflection This works MyType.names MyType.types there is also the names function. Don't know if there is a corresponding 'types' function.

[julia-users] Metaprogramming and Typedefs

2014-03-01 Thread Ben Ward
Hi, I'm looking to make a flexible type which may or may not contain certain fields, as well as possibly the addition of fields later on i.e. it's final definition is decided at compilation. I figured meta-programming and macros might be the way to achieve this as well as be educational for

[julia-users] Maintaining a Julia Package - changes?

2014-01-17 Thread Ben Ward
Hi, I've been working on an R project as part of a PhD project for a long time and so have only recently returned to take a look at the Phylogenetics.jl package I started to create a while ago. Reading the documentation on packages I see what look to me like changes, like publishing checking

[julia-users] Re: Maintaining a Julia Package - changes?

2014-01-17 Thread Ben Ward
:12 PM UTC, Ben Ward wrote: Hi, I've been working on an R project as part of a PhD project for a long time and so have only recently returned to take a look at the Phylogenetics.jl package I started to create a while ago. Reading the documentation on packages I see what look to me like

Re: [julia-users] Re: Maintaining a Julia Package - changes?

2014-01-17 Thread Ben Ward
: libopenblas LIBM: libopenlibm On Saturday, January 18, 2014 3:46:55 AM UTC, Isaiah wrote: Strange. Well you could push manually and make a pull request against METADATA. What version of Julia are you running? (`versioninfo()`) On Fri, Jan 17, 2014 at 10:33 PM, Ben Ward axolotl