Re: Superpositions and laziness

2002-11-21 Thread Piers Cawley
Damian Conway [EMAIL PROTECTED] writes: Piers Cawley wrote: Cis is compile-time. So, how would one create a class which inherits from some other class when you don't know what said other class is until runtime? Use Perl5-ish classes, or an Ceval. Perl5-ish classes? You mean 'bless {},

Re: Superpositions and laziness

2002-11-20 Thread Piers Cawley
Damian Conway [EMAIL PROTECTED] writes: Piers Cawley wrote: [Speculations elided] Which is somewhat dependent on being able to do Cclass is $class. Which you can't do, since Cis is compile-time. So, how would one create a class which inherits from some other class when you don't know what

Re: Superpositions and laziness

2002-11-20 Thread Damian Conway
Piers Cawley wrote: Cis is compile-time. So, how would one create a class which inherits from some other class when you don't know what said other class is until runtime? Use Perl5-ish classes, or an Ceval. Does this work: class { push @ISA, $class; ... } I

RE: Superpositions and laziness

2002-11-20 Thread Brent Dax
Piers Cawley: # So, how would one create a class which inherits from some # other class when you don't know what said other class is # until runtime? AUTOLOAD! *ducks* --Brent Dax [EMAIL PROTECTED] @roles=map {Parrot $_} qw(embedding regexen Configure) If you want to propagate an

Re: Superpositions and laziness

2002-11-16 Thread Damian Conway
Piers Cawley wrote: [Speculations elided] Which is somewhat dependent on being able to do Cclass is $class. Which you can't do, since Cis is compile-time. Damian

Re: Superpositions and laziness

2002-11-13 Thread Peter Haworth
On Tue, 12 Nov 2002 21:11:36 +, Piers Cawley wrote: Michael Lazzaro [EMAIL PROTECTED] writes: On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote: I still prefer cached, which sounds less lingo-ish than memoized but reads better than same (Same as what?). Insert

Re: Superpositions and laziness

2002-11-13 Thread Larry Wall
On Fri, Nov 08, 2002 at 08:35:00PM +1100, Damian Conway wrote: : What you want are conversion-to-(num|str|bool) methods: : : sub a_pure_func(Num $n) returns Num { : class is Num { : has Num $cache; : sub value { $n * $n } : method

Re: Superpositions and laziness

2002-11-13 Thread Larry Wall
On Tue, Nov 12, 2002 at 09:03:22PM +, Piers Cawley wrote: : Hang on, couldn't you rewrite things to not use the cache? : : class is $class { : sub value { func(*args) } : method operator:+ ($self is rw:) { +($self = value) } : method operator:~ ($self is rw:) { ~($self =

Re: Superpositions and laziness

2002-11-12 Thread Piers Cawley
Damian Conway [EMAIL PROTECTED] writes: Luke Palmer wrote: sub a_pure_func(Num $n) returns Num { class is Num { method FETCH { $n * $n } }.new } Yes? No? Not quite. sub a_pure_func(Num $n) returns Num { class is Num { has

Re: Superpositions and laziness

2002-11-12 Thread Piers Cawley
Michael Lazzaro [EMAIL PROTECTED] writes: On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote: I still prefer cached, which sounds less lingo-ish than memoized but reads better than same (Same as what?). Insert obligatory reference to Eiffel here, which IIR uses the word

Re: Superpositions and laziness

2002-11-12 Thread Paul Johnson
[ I've added some of Damian's text back into Michael's message to save replying to two separate messages. ] On Mon, Nov 11, 2002 at 09:44:37AM -0800, Michael Lazzaro wrote: On Monday, November 11, 2002, at 02:19 AM, Damian Conway wrote: I can certainly see your point, but to me this is

Re: Superpositions and laziness

2002-11-12 Thread Piers Cawley
Paul Johnson [EMAIL PROTECTED] writes: [ I notice that Piers has just said about the same as me in one sentence. ] Ah, but I get lots of practice boiling stuff down when I'm writing the summaries. Though the current one is still giving me headaches -- I'm about halfway through perl6-language

Re: Superpositions and laziness

2002-11-11 Thread Damian Conway
Nicholas Clark wrote: We're looking for a word that tersely expresses has_no_side_effects_and_can_safely_have_its_results_cached_based_on_parameter_types_ and_values_and_calling_context ? And to people in the perl5 know, Memoize is the module that implements this, hence why people who know

Re: Superpositions and laziness

2002-11-11 Thread Damian Conway
Paul Johnson wrote: Part of the reason I would prefer something like pure over something like cached is because it describes the function rather than telling the compiler how to deal with it. That feels better to me. It's working at a higher level. Maybe the end result is the same, or maybe

Re: Superpositions and laziness

2002-11-11 Thread Michael Lazzaro
On Monday, November 11, 2002, at 02:19 AM, Damian Conway wrote: One of the reasons I like Ccached is because it does specify exactly the way the subroutine is to behave (i.e. be called the first time, and not called every subsequent time the same arguments are supplied). So I can do

Re: Superpositions and laziness

2002-11-08 Thread Billy Naylor
Damian Conway wrote: we could make it lazy thus: sub a_pure_func(Num $n) is lazy returns Num { return $n ** $n } which would cause any invocation of Ca_pure_func to cache its arguments (probably in a closure) and return a proxy Num that carries out the computation

Re: Superpositions and laziness

2002-11-08 Thread Damian Conway
Billy Naylor asked: Would it be useful to apply memoization in a similar fashion... sub square ( Num $n ) is memo { return $n ** $n; } Yes. Larry indicated this in A2 (see http://search.cpan.org/perl6/apo/A02.pod#Properties). The name of the property is still under debate. Larry

Re: Superpositions and laziness

2002-11-08 Thread Damian Conway
Luke Palmer wrote: sub a_pure_func(Num $n) returns Num { class is Num { method FETCH { $n * $n } }.new } Yes? No? Not quite. sub a_pure_func(Num $n) returns Num { class is Num { has Num $cache; method FETCH { $cache //=

Re: Superpositions and laziness

2002-11-08 Thread Nicholas Clark
On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote: Billy Naylor asked: Would it be useful to apply memoization in a similar fashion... sub square ( Num $n ) is memo { return $n ** $n; } Yes. Larry indicated this in A2 (see

Re: Superpositions and laziness

2002-11-08 Thread Paul Johnson
On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote: On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote: The name of the property is still under debate. Larry favours: sub square ( Num $n ) is same {...} whereas others feel that: sub square ( Num $n

Re: Superpositions and laziness

2002-11-08 Thread Luke Palmer
Date: Fri, 8 Nov 2002 15:04:16 + From: Nicholas Clark [EMAIL PROTECTED] And to people in the perl5 know, Memoize is the module that implements this, hence why people who know of how and what Memoize can do favour that name. Except that it's not necessarily obvious to everyone else?

RE: Superpositions and laziness

2002-11-08 Thread Brent Dax
Luke Palmer: # What's wrong with Ccached? # # Cpure ain't bad either, but it won't appeal to # non-mathematicians---even certain kinds of mathematicians. # Mathematica thinks a pure function is what we think of as # an anonymous sub. So I like Ccached. How about Csteady, in an analogy to

Re: Superpositions and laziness

2002-11-08 Thread Paul Johnson
On Fri, Nov 08, 2002 at 12:12:53PM -0700, Luke Palmer wrote: What's wrong with Ccached? Cpure ain't bad either, but it won't appeal to non-mathematicians---even certain kinds of mathematicians. Mathematica thinks a pure function is what we think of as an anonymous sub. So I like Ccached.

Re: Superpositions and laziness

2002-11-08 Thread Jonathan Scott Duff
On Fri, Nov 08, 2002 at 05:30:00PM +0100, Paul Johnson wrote: On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote: On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote: The name of the property is still under debate. Larry favours: sub square ( Num $n ) is same

Re: Superpositions and laziness

2002-11-08 Thread Buddha Buck
Jonathan Scott Duff wrote: On Fri, Nov 08, 2002 at 05:30:00PM +0100, Paul Johnson wrote: On Fri, Nov 08, 2002 at 03:04:16PM +, Nicholas Clark wrote: On Fri, Nov 08, 2002 at 08:22:17PM +1100, Damian Conway wrote: The name of the property is still under debate. Larry favours: sub square

Re: Superpositions and laziness

2002-11-08 Thread Nicholas Clark
On Fri, Nov 08, 2002 at 11:41:38AM -0800, Brent Dax wrote: Luke Palmer: # What's wrong with Ccached? # # Cpure ain't bad either, but it won't appeal to # non-mathematicians---even certain kinds of mathematicians. # Mathematica thinks a pure function is what we think of as # an anonymous

Re: Superpositions and laziness

2002-11-08 Thread Adam D. Lopresto
I still prefer cached, which sounds less lingo-ish than memoized but reads better than same (Same as what?). Billy Naylor asked: Would it be useful to apply memoization in a similar fashion... sub square ( Num $n ) is memo { return $n ** $n; } Yes. Larry indicated this in

Re: Superpositions and laziness

2002-11-08 Thread Piers Cawley
Paul Johnson [EMAIL PROTECTED] writes: On Fri, Nov 08, 2002 at 12:12:53PM -0700, Luke Palmer wrote: What's wrong with Ccached? Cpure ain't bad either, but it won't appeal to non-mathematicians---even certain kinds of mathematicians. Mathematica thinks a pure function is what we think of

Re: Superpositions and laziness

2002-11-08 Thread Michael Lazzaro
On Friday, November 8, 2002, at 07:03 AM, Adam D. Lopresto wrote: I still prefer cached, which sounds less lingo-ish than memoized but reads better than same (Same as what?). Insert obligatory reference to Eiffel here, which IIR uses the word once: sub square ( Num $n ) is same { ... }

Re: Superpositions and laziness

2002-11-07 Thread Damian Conway
Piers Cawley mused: The idea being that, when you do a_pure_func($val1|$val2|$val3) instead of Perl going away and doing the calculation right away, you get back a 'special' superposition Remember to s/superposition/junction/g. For this week, at least ;-) which stores an 'invocation

Re: Superpositions and laziness

2002-11-07 Thread Luke Palmer
Date: Thu, 07 Nov 2002 20:48:50 +1100 From: Damian Conway [EMAIL PROTECTED] we could make it lazy thus: sub a_pure_func(Num $n) is lazy returns Num { return $n ** $n } which would cause any invocation of Ca_pure_func to cache its arguments (probably in a closure)

Re: Superpositions and laziness

2002-11-07 Thread Luke Palmer
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm From: Luke Palmer [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Thu, 7 Nov 2002 13:49:14 -0700 (MST) X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ Date: Thu, 07 Nov 2002 20:48:50 +1100 From: Damian Conway [EMAIL

Re: Superpositions and laziness

2002-11-07 Thread Buddha Buck
Luke Palmer wrote: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm From: Luke Palmer [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Thu, 7 Nov 2002 13:49:14 -0700 (MST) X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ Date: Thu, 07 Nov 2002 20:48:50 +1100 From: Damian Conway

Superpositions and laziness

2002-11-06 Thread Piers Cawley
It occurred to me that being able to set up 'pure' functions in such a way that they are lazily evaluated when passed a superposition might be a win. And then I got to thinking about what would be required from the language to allow me to implement this functionality in a module. I am assuming