Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-17 Thread MA Laforge
Thanks for clarifying that Josh. I thought my issues were because of a subtlety of Julia's type system that I did not understand.

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-17 Thread MA Laforge
Thanks Matt, I kind of like the explicit nature of "Exactly". I will have to let the idea sink in a bit more.

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-16 Thread Josh Langsfeld
On Saturday, November 14, 2015 at 10:59:26 AM UTC-5, MA Laforge wrote: > > >> - `immutable KD{Symbol} end` does not force the type parameter to be a >> symbol. It does the same thing as the more typical 'T' (which could be >> :tfund, Int, Array{Symbol,2}, or anything else). >> > Hmm... I

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-16 Thread Matt Bauman
Instead of keyword argument ordering, you could use an "Exactly" wrapper type. This would allow you to dispatch and potentially error if the exact constraints cannot be satisfied. immutable Exactly{T} val::T end foo(Exactly(1.0), 2.0, Exactly(3.0)) # the second argument might get fudged

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-14 Thread MA Laforge
> > This looks like overengineering of what should be a simple problem. Why do > you want turn the keywords into arguments for dispatch? Dispatch is best > when you need different behavior for different types but here all your > input and output types are fixed. > I suppose there is some

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-13 Thread Josh Langsfeld
This looks like overengineering of what should be a simple problem. Why do you want turn the keywords into arguments for dispatch? Dispatch is best when you need different behavior for different types but here all your input and output types are fixed. You may have already known, but you can

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-13 Thread MA Laforge
OK, I'll give it a try (sorry about the length of the reply). *Idea behind "timespace":* Generates time vector (range) from sampling period & fundamental Automatically computes # of time steps, N. Why? Computation of N can easily be off-by-1 - if specified directly. So... with timespace, users

Re: [julia-users] linspace-like range generators and keyword ordering

2015-11-12 Thread Spencer Russell
Can you give a little more context for what you’re trying to do? I’m not clear on the various behaviors you want from the different `timespace` variants. I’m actually not sure whether the order can be relied on, but I think the proposed API might be confusing for users of your function because

[julia-users] linspace-like range generators and keyword ordering

2015-11-12 Thread MA Laforge
Hi users, I want to be able to generate ranges using a syntax similar to: t1=timespace(tstart = 2e-9, ts=1e-9, tfund=20e-9); t11=timespace(fs=1/1e-9, tfund=20e-9, tstart=3e-9); t2=timespace(tfund=20e-9, tstart=4e-9, ts=1e-9); *Why not just use different function names?*Simply put, I would