Re: Adding linear interpolation to an array

2005-03-14 Thread Thomas Sandlaß
Juerd wrote: Larry Wall skribis 2005-03-11 8:45 (-0800): On Fri, Mar 11, 2005 at 03:58:13PM +0100, Thomas Sandlaß wrote: : Int @i; : Num @n = @i; # type error? I think the naive user is going to expect that to work, and I also suspect the naive user is right to expect it, because it makes sense.

Re: Adding linear interpolation to an array

2005-03-14 Thread Larry Wall
On Mon, Mar 14, 2005 at 04:15:35PM +0100, Thomas Sandlaß wrote: : Hmm, since what is compile to you is runtime for the compiler : it might by a normal store attempt that is then rejected by the object : and caught by the compiler---cool. Is there also an unchecked store : operation that can be

Re: Adding linear interpolation to an array

2005-03-11 Thread Thomas Sandlaß
Doug McNutt wrote: A word of caution: Just as in vector operators had their names changed to pacify the mathematicians - thank you - there is a conflict in terms. Covariant and contravariant tensors are the meat of Einstein's formulation of relativity. It all has to do with transformations

Re: Adding linear interpolation to an array

2005-03-11 Thread Thomas Sandlaß
HaloO David, you wrote: I appreciate you attempting to explain this, but it remains clear as mud, at least to me. Could you please try again, using very short, very non-technical words and not assuming a mathematical or scientific background on the part of your reader? Ok, second attempt! The :

Re: Adding linear interpolation to an array

2005-03-11 Thread Larry Wall
On Fri, Mar 11, 2005 at 03:58:13PM +0100, Thomas Sandlaß wrote: : Int @i; : Num @n = @i; # type error? I think the naive user is going to expect that to work, and I also suspect the naive user is right to expect it, because it makes sense. This may be one of those areas where we can successfully

Re: Adding linear interpolation to an array

2005-03-11 Thread Juerd
Larry Wall skribis 2005-03-11 8:45 (-0800): On Fri, Mar 11, 2005 at 03:58:13PM +0100, Thomas Sandlaß wrote: : Int @i; : Num @n = @i; # type error? I think the naive user is going to expect that to work, and I also suspect the naive user is right to expect it, because it makes sense. This

Re: Adding linear interpolation to an array

2005-03-10 Thread Thomas Sandlaß
HaloO Luke, you wrote: The words 'covariant' and 'contravariant' in this context seem like voodoo math. Please explain what you mean. 'Co' means together like in coproduction. And 'contra' is the opposite as in counterproductive. With instanciating parametric types the question arises how a

Re: Adding linear interpolation to an array

2005-03-10 Thread Michele Dondi
On Thu, 10 Mar 2005, [UTF-8] Thomas Sandla~_ wrote: 'Co' means together like in coproduction. And 'contra' is the opposite 'Streaming of digestive byproducts'? ;-) Sorry for the OT - couldn't resist! This pun

Re: Adding linear interpolation to an array

2005-03-10 Thread Doug McNutt
At 17:53 +0100 3/10/05, Thomas Sandlaß wrote: 'Co' means together like in coproduction. And 'contra' is the opposite as in counterproductive. With instanciating parametric types the question arises how a subtype relation between instanciating types propagates to the template. E.g with Int : Num,

Re: Adding linear interpolation to an array

2005-03-10 Thread David Storrs
At 17:53 +0100 3/10/05, Thomas Sandlaß wrote: [request for clarification of 'covariant' and 'contravariant' usage] 'Co' means together like in coproduction. And 'contra' is the opposite as in counterproductive. With instanciating parametric types the question arises how a subtype relation

Re: Adding linear interpolation to an array

2005-03-08 Thread Thomas Sandlaß
Dave Whipp wrote: I don't see why I need the conditional there. If I'm going to copy the array, I might as well declare up front the that darget does LinearInterpolation: sub foo (Num @raw_in) { my Num @in does LinearInterpolation = @raw_in; ... } This depends on how initialization works.

Re: Adding linear interpolation to an array

2005-03-08 Thread Dave Whipp
Thomas Sandlaß wrote: Or perhaps even sub foo (Num @in is copy does LinearInterpolation) { ... } This is my big questionmark on roles: is the above a contraint or merely a directive. In the former case only Arrays of Num that do LinearInterpolation are allowed, in the latter case every Array

Re: Adding linear interpolation to an array

2005-03-08 Thread Larry Wall
On Tue, Mar 08, 2005 at 10:19:10AM +0100, Thomas Sandlaß wrote: : Or perhaps even : : sub foo (Num @in is copy does LinearInterpolation) : { :... : } : : This is my big questionmark on roles: is the above a contraint : or merely a directive. In the former case only Arrays of Num that : do

Re: Adding linear interpolation to an array

2005-03-08 Thread Thomas Sandlaß
Larry Wall wrote: One can always mixin a does LinearInterpolation at run time in the body of the sub to get the effect of a directive, so I think the most useful thing is to treat roles in signatures as constraints where they can be used to select for MMD. Further questions concerning MMD: 1) How

Re: Adding linear interpolation to an array

2005-03-08 Thread Juerd
Larry Wall skribis 2005-03-08 9:42 (-0800): Maybe we need to work in the linguistic notion of pretends to be somehow. If this needs a keyword, I suggest plays :) Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html

Re: Adding linear interpolation to an array

2005-03-08 Thread Luke Palmer
Thomas Sandla writes: Larry Wall wrote: One can always mixin a does LinearInterpolation at run time in the body of the sub to get the effect of a directive, so I think the most useful thing is to treat roles in signatures as constraints where they can be used to select for MMD. Further

Re: Adding linear interpolation to an array

2005-03-08 Thread Larry Wall
On Tue, Mar 08, 2005 at 03:21:42PM -0700, Luke Palmer wrote: : 3) I guess the distance function is not specified yet, right? : : It was specified as simple manhattan. I've been arguing for the past : year to get this changed (to 'pure', where there is no distance : function; two methods, which

Adding linear interpolation to an array

2005-03-07 Thread Dave Whipp
I was trying to work out how to get non-integer indexes working for an array -- initially using linear interpolation, though perhaps later it would be generalized. Can anyone comment on whether this simple role would work as I expect. Does defining the invocant as Num @self is constant

Re: Adding linear interpolation to an array

2005-03-07 Thread Aldo Calpini
Dave Whipp wrote: Does defining the invocant as Num @self is constant constrain the application of the role to read-only uses of indices? I don't think you need is constant. arguments are readonly by default, unless you give them the is rw trait. I guess that is constant means that you can

Re: Adding linear interpolation to an array

2005-03-07 Thread Dave Whipp
Aldo Calpini wrote: I don't think you need is constant. arguments are readonly by default, unless you give them the is rw trait. I guess that is constant means that you can specify the index only using a literal, not a variable, eg: @test[1]; # ok, 1 is a costant my $idx = 1;