Re: Fun with junctions (was Sets vs Junctions)

2005-02-14 Thread Michele Dondi
On Sat, 12 Feb 2005, Damian Conway wrote:
 @xyz = uniq @xyz;
or better still:
 @xyz.=uniq;
Speaking of which, while I think that methods on the implicit topicalizer 
and the C.= assignement operator are indeed cool, I wonder if any 
provision will be made for a convenient stand in for whatever is on the 
left side of an assignment operator, e.g.

  @xyz=uniq _;  # indirect object notation
(I guess that _ won't be taken for filhandles any more, I don't know if 
it's already taken for something else...)

Michele
--
The trouble with engineers is that given the problem of knocking down
a stack of 100 bricks, they will start at the top, and work all
day removing them one at a time, while the mathematician will, after
a momemt's thought, remove the bottom brick and be done with it.
The trouble part, is having to brook the noise of the engineer
boasting about how much harder he worked while one is trying to
think about the next problem.
- Bart Goddard in sci.math


Re: proposal: use \ as none junction delimeter

2005-02-14 Thread Thomas Sandlaß
HaloO Luke,
you wrote:
if $a \  $b == 3 {...}
   *If  A nor B is 3 ...
What does the * in front of the if mean? Not?
With grammar reason I meant the formal grammar of Perl6
not the one of natural english. Are you aware of such reasons?

In English it's more like:
if \  $a  \ $b == 3 {...}
If neither A nor B is three ...
I'm not a native english/american speaker but I think it's
pretty much the same as the German weder ... noch ... for
neither ... nor ... and entweder ... oder ... for the
either ... or ... of xor. Also the plural/singular usage
is the same. So I fully agree with you, that xor and nor have
the same feature/burden as infix ops.
But since xor, ^ and ^^ are in the language already, consistency
would at least allow nor, \ and \\. And nor is a proper english word,
xor isn't ;)
BTW, there also was a thread about ',' and 'then'. There people
complained about the missing 'and' in front of it.

I definitely like the symmetry.  But we have to remember that the P in
Perl (can) stand for Practical.  The advantages of having syntactic
symmetry are nice, and they aid learning.  But they aren't nearly as
important as semantic symmetry/consistency.  (Not to say that they
aren't important)
The lack of infix ops to go with the none junction has worried others
before me. Unfortunately I don't find the thread were Larry rambles
about this. The only thing I found was Damian disliking ! and !!.
Of course I wouldn't ask for a nand infix op for two reasons:
1) there's no corresponding junction
2) what should be the high precedence version?

We have a surplus of semantic ideas, and a shortage of characters on the
keyboard.  Adding seldom-used (and in this case, confusing) operators in
the face of consistency is a Maxwellian thing, but I don't think it's
hiding any deep truth behind it this time.
Well, not depth but notational convenience for small to medium sized 
junctions.
Do you see chances to get that through? Or is the design more or less finished?

Compare:
say nope if $a \\ $b;

say nope unless $a  $b;

I find the latter actually reads well in our precious natural languages.
The former just seems like golfing.
I agree fully. The if/unless and while/until pairs are nice lunguistic
concessions of Perl. On the other hand, as a programmer it's not so far
out. Definitly not more than xor---but I repeat myself.
Good night!
--
TSa (Thomas Sandla)



Re: proposal: use \ as none junction delimeter

2005-02-14 Thread Luke Palmer
Thomas Sandla writes:
 HaloO Luke,
 
 you wrote:
 if $a \  $b == 3 {...}
*If  A nor B is 3 ...
 
 What does the * in front of the if mean? Not?

Ungrammatical

 With grammar reason I meant the formal grammar of Perl6 not the one
 of natural english. Are you aware of such reasons?

Ahh.  Using \ as an infix operator doesn't conflict with the grammar of
Perl 6.  It's perfectly feasable in that regard.

 In English it's more like:
 
 if \  $a  \ $b == 3 {...}
 If neither A nor B is three ...
 
 I'm not a native english/american speaker but I think it's pretty much
 the same as the German weder ... noch ... for neither ... nor ...
 and entweder ... oder ... for the either ... or ... of xor. Also
 the plural/singular usage is the same. So I fully agree with you, that
 xor and nor have the same feature/burden as infix ops.
 
 But since xor, ^ and ^^ are in the language already, 

See, I'm trying to change that.  The former and probably the latter can
stay, but I'm convinced that the operator form of ^ doesn't huffmanly
belong, even if it does mnemonically.  

 BTW, there also was a thread about ',' and 'then'. There people
 complained about the missing 'and' in front of it.

Yeah, and it got rejected, too.  People complain about a lot of things.  
That's why I'm here: to comfort people out of their complaints, and to
replace them with my own.  :-)

 I definitely like the symmetry.  But we have to remember that the P in
 Perl (can) stand for Practical.  The advantages of having syntactic
 symmetry are nice, and they aid learning.  But they aren't nearly as
 important as semantic symmetry/consistency.  (Not to say that they
 aren't important)
 
 The lack of infix ops to go with the none junction has worried others
 before me. Unfortunately I don't find the thread were Larry rambles
 about this. The only thing I found was Damian disliking ! and !!.
 
 Of course I wouldn't ask for a nand infix op for two reasons:
 1) there's no corresponding junction
 2) what should be the high precedence version?

And 3) who the hell would use it?

 
 
 We have a surplus of semantic ideas, and a shortage of characters on the
 keyboard.  Adding seldom-used (and in this case, confusing) operators in
 the face of consistency is a Maxwellian thing, but I don't think it's
 hiding any deep truth behind it this time.
 
 Well, not depth but notational convenience for small to medium sized
 junctions.  Do you see chances to get that through? Or is the design
 more or less finished?

Well, the design is more or less finished in that we have enough
information that the language can be implemented completely.  The design
is not finished because it keeps changing.

I never consider the design to be finished (even after it's
implemented).  I just assign it an ever-thickening viscosity.  If we
wish to make sweeping changes that will change the langauge for the
better, now is the time to do it, because it only gets harder as time
progresses.

Luke


Re: Sets vs Junctions

2005-02-14 Thread Damian Conway
Jonathan Lang wrote:
Maybe set should be an operator akin to any, all, one, and none,
at least in terms of  and |.  That is, if junctions are special cases
of sets, why not allow for the creation of generic sets in much the same
way?  Then you could have:
# $A and $B are sets,
  union($A, $B)=:= ($A | $B); 
  intersection($A, $B) =:= ($A  $B); 
  not($A)  =:= (! $A); 
  difference($A, $B)   =:= ($A - $B); 
  $e is_element_of $A  =:= ($e ~~ $A);
  $A is_subset_of $B   =:= ($A = $B); 
  $A is_superset_of $B =:= ($A = $B); 

...and so on.  Hmm...
I certainly wouldn't have a problem with that. Of course, you could also 
easily implement those semantics on top of disjunctions:

class Set is Disjunction {
multi sub set is export(:MANDATORY) (Junction $j) {
return Set.new(values=$j.values)
}
multi sub set is export(:MANDATORY) ([EMAIL PROTECTED]) {
return Set.new(values=@_)
}
multi sub infix:! (Set $a, Set $b){ set($a | $b) }
multi sub infix: (Set $a, Set $b){ set($a  $b) }
multi sub infix:- (Set $a, Set $b){ set( $a  none($b) ) }
multi sub prefix:- (Set $a)   { set(none($b)   ) }
multi sub infix:«=» (Set $a, Set $b)   { true all($a.values) ~~ $b }
multi sub infix:«=» (Set $a, Set $b)   { true $a ~~ all($b.values) }
}
Damian