Questions about design of perl, parrot

2008-04-17 Thread Miller, Hugh
Is there something for perl analogous to the sort of formal presentation
seen in e.g., Robin Milner's Definition of Standard ML ?

Is there any confluence between things perl and things found in the
literature on partial evaluation (e.g., John Launchbury's thesis, papers
etc.) ?

Thanks!

-
Hugh Miller
e-mail: [EMAIL PROTECTED]

True science is about that which really exists -- T. d'Aquino


RE: cross operator and empty list

2008-04-14 Thread Miller, Hugh
 

-Original Message-
From: Mark A. Biggar [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 13, 2008 11:22 PM
To: Miller, Hugh
Cc: Moritz Lenz; p6l
Subject: Re: cross operator and empty list

Miller, Hugh wrote:
 From: Moritz Lenz [mailto:[EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
 Technically the Cartesian cross operator doesn't have an
 identity value.
 It has.
 The set which contains only the emty set, or in perl terms ([]); Or 
 am I missing something?
 Should be a (any) 1 point set for the identity.
 How about considering models from category theory, rather than set 
 theory ? Seems much more fruitful for computer issues than 
set theory.

No an identity would be a set E such that for any set A: A x E 
= A, but no such set exists.  A singleton set get close, but 
the result is only isomorphic (there is a natural bijection) 
not equal. Even in category theory you only get isomorphism.


--
[EMAIL PROTECTED]
[EMAIL PROTECTED]


Just so! Been looking at category theory so much lately that equality
has become just a special case of isomorphism without my noticing it.
-
Hugh Miller
e-mail: [EMAIL PROTECTED]


RE: cross operator and empty list

2008-04-13 Thread Miller, Hugh
 

-Original Message-
From: Moritz Lenz [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 12, 2008 10:37 AM
To: [EMAIL PROTECTED]
Cc: p6l
Subject: Re: cross operator and empty list

[EMAIL PROTECTED] wrote:
 Technically the Cartesian cross operator doesn't have an 
identity value.

It has.
The set which contains only the emty set, or in perl terms ([]);

Or am I missing something?

Cheers,
Moritz
--
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/



Should be a (any) 1 point set for the identity.

How about considering models from category theory, rather than set
theory ? Seems much more fruitful for computer issues than set theory.

-
Hugh Miller
e-mail: [EMAIL PROTECTED]


RE: Nomenclature Question - BEGIN etc.

2008-04-10 Thread Miller, Hugh
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Mark J. Reed
Sent: Thursday, April 10, 2008 4:26 PM
To: perl6-all@perl.org; [EMAIL PROTECTED]
Subject: Re: Nomenclature Question - BEGIN etc.


but tag
for the keyword feels right to me.  We could just call them 
tagged blocks, but that's a syntactic description, which 
fails to convey anything about the semantics.

So maybe event tags and event blocks, with the combination 
of the two constituting an event handler?

Perhaps event match block ?

-
Hugh Miller
e-mail: [EMAIL PROTECTED]


RE: Query re: duction and precedence.

2008-03-31 Thread Miller, Hugh (hdmi)
The inevitable question - why not support Polish Notation or Reverse
Polish ? Well known to be easier to use, since it involves no
ambiguities in regard to association, is notationally clearer (not
needing parentheses). Seems to make it easier to analyze what one might
want to mean by

[op] (p1 p2 p3 ... )

E.g., 

Convention 1

[op] (p1 p2 p3 ... ) =by definition= p1 p2 op  p3 op ... pN op

Convention 2

  [op] (p1 p2 p3 ... ) =by definition= p1 p2 p3 ... pN op op op ...
op

One could support both conventions (with notational differences) ...

Example

[^] (2 3 4) =defn 1= 2 3 ^ 4 ^ , i.e., (2^3)^4

  [^] (2 3 4) = defn 2= 2 3 4 ^^ , i.e., (2^(3^4))

Etc.

-
Hugh Miller
e-mail: [EMAIL PROTECTED]


-Original Message-
From: Darren Duncan [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 30, 2008 2:00 AM
To: p6l
Subject: Re: Query re: duction and precedence.

Mark J. Reed wrote:
 You anticipated me. So, is there a core method for 
 foldl/foldr/inject/reduce, or do you have to roll your own as in p5?
 
 On 3/29/08, Larry Wall [EMAIL PROTECTED] wrote:
 On Sat, Mar 29, 2008 at 10:18:53PM -0400, Mark J. Reed wrote:
 : In general, is
 :
 : [op] (p1,p2,p3,p4...)
 :
 : expected to return the same result as
 :
 : p1 op p2 op p3 op p4...
 :
 : including precedence considerations?

 Yes, in fact the section on Reduction Operators uses exponentiation 
 obliquely in one of its examples of something that should work 
 right-to-left.  Admittedly it's not clearly stated there...

 But the basic idea is always that the reduction form should produce 
 the same result as if you'd written it out with interspersed infixes.
 It's a linguistic construct, not a functional programming construct.
 It's not intended to be in the same league as foldl and foldr, and is

 only just slightly beyond a macro insofar as it can intersperse 
 however many operators it needs to for an arbitrarily sized list.
 It's not making any attempt to deal with anonymous first-class 
 functions though.  Call a real function for that. :)

I think it would be powerful while not too difficult for Perl 6's
reduce 
to be able to do everything you'd get in functional programming, at
least some of the time.

Generally speaking, as long as the base operator is associative, then

   [op] *$seq_or_array_etc

... should auto-parallelize with a deterministic result; or as long as
the base operator is both associative and commutative, then

   [op] *$set_or_bag_or_seq_or_array_etc

... should also auto-parallelize with a deterministic result.

And then you get all the functional programming goodies.  The first
example works for string catenation, but the second doesn't; the second
does work for sum|product|and|or|xor|union|intersection though.

Some base operators have an identity value in case the input collection
is empty, as is the case with the above operators, but others only work
with a non-empty input, such as mean|median|mode.

For other operators, non-assoc etc, the work will probably all have to
be linear.  Eg difference|quotient|exponentiation.

Something I'm wondering, though, realistically how often would one
actually be reducing on an operator that is not associative?  What
practical use is there for [-] (3,4,5) for example?

Are you just supporting that with all operators for parsing rule
simplicity as per a macro?  I can understand that reasoning, but
otherwise ...

I would think it makes sense to restrict the use of the reduction
meta-operator to just work over operators that are at least associative.

-- Darren Duncan