Re: Wh[ie]ther Infix Superposition ops
On 29 Oct 2002 at 11:22, Jonathan Scott Duff wrote: On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: Also the idea of allways using 'function' style for something so basic like superpositions doesn't appeal to me. Superpositions are basic in a fabric-of-the-universe kind of way, but they are hardly basic in the everyone-learns-them-in-grade-school kind of way. I think the latter is more important for huffman coding of operators for the unwashed masses. But I'm willing change my mind if we start teaching everyone superpositions in grade school :-) You are making the fundamental mistake of thinking superpositions as superpositions. When thinking them as another-kind-of or/and, their usefulness comes a lot clearer. perl5: if $x == 5 || $x == 7 || $x == 99 perl6: if $x == 5 | 7 | 99 perl5: ...loop to test every value in an array... perl6: if ! 28 = any(@days_in_months) = 31 { ERROR } (this probably has slight syntax error) perl5: if $x 0 $x 20 $y 0 $y 20 $z 0 $z 20 perl6: if 0 $x $y $z 20 perl5: if ($x = 10 $x = 20) || ($x = 30 $x = 40) perl6: if $x ~~ 10..20 | 30..40 -- Markus Laire 'malaire' [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
On Wednesday, October 30, 2002, at 07:18 AM, Jonathan Scott Duff wrote: The only thing this inspires in my brain is Schoolhouse Rock flashbacks. o/~ Conjuction Junction, what's your function? o/~ Heh. That's what I heard, too. David -- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394 http://david.wheeler.net/ Yahoo!: dew7e Jabber: [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
On Wed, Oct 30, 2002 at 06:45:52PM +0200, Markus Laire wrote: You are making the fundamental mistake of thinking superpositions as superpositions. When thinking them as another-kind-of or/and, their usefulness comes a lot clearer. perl5: if $x 0 $x 20 $y 0 $y 20 $z 0 $z 20 perl6: if 0 $x $y $z 20 I find that really quite confusing written like that. but like this if 0 ($x $y $z) 20 it makes more sense to me. What's the precedence? Although as regular user of numerical bitops in C, I find it visually jarring that isn't what it means in C, C++, perl and most other current languages. Nicholas Clark -- Brainfuck better than perl? http://www.perl.org/advocacy/spoofathon/
Re: Wh[ie]ther Infix Superposition ops
On Wed, 30 Oct 2002, Nicholas Clark wrote: : On Wed, Oct 30, 2002 at 06:45:52PM +0200, Markus Laire wrote: : : You are making the fundamental mistake of thinking superpositions as : superpositions. When thinking them as another-kind-of or/and, their : usefulness comes a lot clearer. : : perl5: if $x 0 $x 20 $y 0 $y 20 $z 0 $z 20 : perl6: if 0 $x $y $z 20 : : I find that really quite confusing written like that. but like this : :if 0 ($x $y $z) 20 : : it makes more sense to me. What's the precedence? The parens aren't required, but they certainly do help the readability there. : Although as regular user of numerical bitops in C, I find it visually jarring : that isn't what it means in C, C++, perl and most other current languages. That may well be part of why it's hard for us to group it visually the other way. But I really don't think we want to require parens on: if $x == 1 | 2 | 3 {...} Larry
Re: Wh[ie]ther Infix Superposition ops
-- On Wed, 30 Oct 2002 07:13:40 Damian Conway wrote: Yes. That superpositions are going to be so widely used once people catch on, that users going to curse us every time they have to write Cuse ops ':superpositions'; at the start of every scope. So, I open my inbox and see that it has been stuffed with Perl 6 language. It's like a little gift. :-) But then I see this debate over the use of superpositions. If there are those who are still disbelieving then go look at the prior art. Icon is a fine little programming language (though a little too pretty for my tastes) that uses very similar syntax to what were talking about here. The big difference is that Icon supports loads of (very nice and clean) backtracking. | and are Icon's || and , but Icon's backtracking gives us a really cool idiom. Superpositions offer us the same thing in Perl 6. Take a look at Icon over at http://www.cs.arizona.edu/icon/ . Once I saw it I did a Piers: This is something I want in Perl and I want it right now! ;-) Damian Get 25MB of email storage with Lycos Mail Plus! Sign up today -- http://www.mail.lycos.com/brandPage.shtml?pageId=plus
Re: Wh[ie]ther Infix Superposition ops
On 29 Oct 2002 at 5:45, Piers Cawley wrote: Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? In this case I find the latter to be easier to decode and more appealing. There are less chars and paretheses are seen much more easily. The 'one(...)' especially seems to be superficial, as it's just 'this or that' operation in this case, and so single operator fits perfectly. Also the idea of allways using 'function' style for something so basic like superpositions doesn't appeal to me. Of course this might just be that I'm too used to use strange mathematical symbols. (Nobody ever understood my solutions in high-school...) -- Markus Laire 'malaire' [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
Markus Laire [EMAIL PROTECTED] writes: On 29 Oct 2002 at 5:45, Piers Cawley wrote: Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? In this case I find the latter to be easier to decode and more appealing. There are less chars and paretheses are seen much more easily. The 'one(...)' especially seems to be superficial, as it's just 'this or that' operation in this case, and so single operator fits perfectly. Also the idea of allways using 'function' style for something so basic like superpositions doesn't appeal to me. Of course this might just be that I'm too used to use strange mathematical symbols. (Nobody ever understood my solutions in high-school...) But they *aren't* 'strange mathematical symbols', they're well understood symbols in algol style programming languages, and they mean 'bitwise logic'. I'm not agin the using the operators to mean 'superposition builder', but I do think there's a case for having to introduce them in a lexical scope with an appropriate USE statement. -- Piers It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite. -- Jane Austen?
Re: Wh[ie]ther Infix Superposition ops
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm From: Piers Cawley [EMAIL PROTECTED] Date: Tue, 29 Oct 2002 05:45:01 + X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? Uh huh. This: if $x == 1 | 3 | 6 { print Small triangular } I imagine it will not take long for these to sink in to people's brains, and become used in very clever (and readable) ways. If you read | as or, and as and, instead of trying to translate them to any and all, things get very nice. Plus, a scripting (or, in the case of P6, high level) language with such small bitwise ops gives me the shivers. C, sure, they're common. Perl, no, not usually. I was even dissatisfied with them in C++, which is a high- low-level language. Luke
Re: Wh[ie]ther Infix Superposition ops
Luke Palmer [EMAIL PROTECTED] writes: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm From: Piers Cawley [EMAIL PROTECTED] Date: Tue, 29 Oct 2002 05:45:01 + X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? Uh huh. This: if $x == 1 | 3 | 6 { print Small triangular } I imagine it will not take long for these to sink in to people's brains, and become used in very clever (and readable) ways. So, if that's the way you're going to be using | in your code, just do Cuse ops ':superposistions' at the top of your file, in the same way as you do Cuse strict now. Or wrap it up in a policy file and do Cuse policy '...'. If you read | as or, and as and, instead of trying to translate them to any and all, things get very nice. Again, I'm not denying the usefulness, just worried that we're jumping through an awful lot of more or less ugly and complex syntactic hoops to get this particular chunk of behaviour into perl 6, when you could, instead, allow the behaviour to be pragma selectable without bending the rest of the syntax to accommodate. Plus, a scripting (or, in the case of P6, high level) language with such small bitwise ops gives me the shivers. C, sure, they're common. Perl, no, not usually. I was even dissatisfied with them in C++, which is a high- low-level language. Catch is, they're there now and useful, especially when you start dealing with the outside world (CO_RDWR | O_CREAT anyone?) -- Piers It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite. -- Jane Austen?
Re: Wh[ie]ther Infix Superposition ops
Cc: [EMAIL PROTECTED] From: Piers Cawley [EMAIL PROTECTED] Date: Tue, 29 Oct 2002 09:36:12 + Luke Palmer [EMAIL PROTECTED] writes: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm From: Piers Cawley [EMAIL PROTECTED] Date: Tue, 29 Oct 2002 05:45:01 + X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? Uh huh. This: if $x == 1 | 3 | 6 { print Small triangular } I imagine it will not take long for these to sink in to people's brains, and become used in very clever (and readable) ways. So, if that's the way you're going to be using | in your code, just do Cuse ops ':superposistions' at the top of your file, in the same way as you do Cuse strict now. Or wrap it up in a policy file and do Cuse policy '...'. Heh, I don't Cuse strict... or Cwarnings. :) As far as frequency goes, though, I think Cuse ops ':cbitwise' would would be more needed. I mean I'm not sure of that: I'm using a sample size of 1. But that's my best guess. You have a point. The larger programs will make use of the superpositions, and the smaller ones will make use of the bitwises. Better to make the bigger programs use pragmas, and the little ones be one-linerable. But who knows, superpositions could often be useful in scripts, too: find | perl -nle 'print join \n, (s+\.++ | s/~$//).states' Ok, that was a terrible example. But you know what I mean Plus, a scripting (or, in the case of P6, high level) language with such small bitwise ops gives me the shivers. C, sure, they're common. Perl, no, not usually. I was even dissatisfied with them in C++, which is a high- low-level language. Catch is, they're there now and useful, especially when you start dealing with the outside world (CO_RDWR | O_CREAT anyone?) Hopefully there won't be a need for that Csysopen stuff. The I/O system better be good enough to allow me to specify those flags without jumping through syntactc hoops in terms of those ugly C constants. Plus, who says CO_RDWR and CO_CREAT can't just be constants, and CO_RDWR | O_CREAT a superposition of them. It could mean the same thing :) Additionally, bitwise ops sure are useful... in a small amout of code. Three or four lines per program. That's why we're not getting rid of them, just making them longer. Superpositions will turn out to be unimaginably handy, possibly used in 10% or 15% of the code, so they get shorter names. In my mind, Perl is stepping away from being a direct derivative of C; rather, a derivative of Perl. And it doesn't seem that the bitwise ops are used enough anymore to get a single character. If they get a single character, surely =~ (~~) should have one. Luke
Re: Wh[ie]ther Infix Superposition ops
[EMAIL PROTECTED] (Markus Laire) writes: In this case I find the latter to be easier to decode and more appealing. There are less chars and paretheses are seen much more easily. Ack, I guess that means we need a one character DWIM operator. Although ... comes pretty close, I suppose. something so basic like superpositions Now I'm just scared. -- I knew that a goodly number of train operating companies had introduced quiet coaches, but I was still a little concerned to find that my tickets were prominently marked NOT READING. - Geraint Jones
Re: Wh[ie]ther Infix Superposition ops
--- Piers Cawley [EMAIL PROTECTED] wrote: one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) Would it be practical/meaningful to say $result = bitwise ($a $b $c) ^ ($d | $e | $f); $result = superpose ($a $b $c) ^ ($d | $e | $f); And allow a use operation to select defaulting behavior? (With an appropriate warning if the code used one of these operators without specifying the use directive, even though crab-style is the default?) [ But it's crucial not to require more quotes and stuff. Just change the mode for the remainder of the subexpression. ] =Austin __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
Re: Wh[ie]ther Infix Superposition ops
On Tue, Oct 29, 2002 at 03:06:51AM -0700, Luke Palmer wrote: Superpositions will turn out to be unimaginably handy, possibly used in 10% or 15% of the code, so they get shorter names. Statements like this bother me. Not because I don't think it might be true, but because it's in future tense. If someone (named Damian :-) wrote a superposition synopsis that showed the many and varied uses of superpositions in contexts that ordinary programmers can relate to, it would bother me less when people make claims about the usefulness of superpositions. I mean, if superpositions are so useful, who's using them now? How many modules on CPAN require them? Why hasn't the word spread like wildfire about them such that your average sysadmin is using them in his code? I don't know of anyone using superpositions casually or in production code. In my mind, Perl is stepping away from being a direct derivative of C; rather, a derivative of Perl. And it doesn't seem that the bitwise ops are used enough anymore to get a single character. If they get a single character, surely =~ (~~) should have one. I agree. -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
[EMAIL PROTECTED] (Jonathan Scott Duff) writes: Statements like this bother me. Not because I don't think it might be true, but because it's in future tense. If someone (named Damian :-) wrote a superposition synopsis that showed the many and varied uses of superpositions in contexts that ordinary programmers can relate to, it would bother me less when people make claims about the usefulness of superpositions. I'll take one of those for perl.com! I mean, if superpositions are so useful, who's using them now? How many modules on CPAN require them? Why hasn't the word spread like wildfire about them such that your average sysadmin is using them in his code? I don't know of anyone using superpositions casually or in production code. I was very tempted to use a superposition in production code, but realised a grep of an array did the same job. -- Oh dear. I've just realised that my fvwm config lasted longer than my marriage, in that case. - Anonymous
Re: Wh[ie]ther Infix Superposition ops
On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: Also the idea of allways using 'function' style for something so basic like superpositions doesn't appeal to me. Superpositions are basic in a fabric-of-the-universe kind of way, but they are hardly basic in the everyone-learns-them-in-grade-school kind of way. I think the latter is more important for huffman coding of operators for the unwashed masses. But I'm willing change my mind if we start teaching everyone superpositions in grade school :-) Or if someone can show that they aren't really something new and amazing, but something old and comfortable but with a funny name and more power. -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
Simon Cozens [EMAIL PROTECTED] writes: [EMAIL PROTECTED] (Jonathan Scott Duff) writes: Statements like this bother me. Not because I don't think it might be true, but because it's in future tense. If someone (named Damian :-) wrote a superposition synopsis that showed the many and varied uses of superpositions in contexts that ordinary programmers can relate to, it would bother me less when people make claims about the usefulness of superpositions. I'll take one of those for perl.com! I keep meaning to look into nondeterministic algorithms to see if you can use Superpositions to get them working... -- Piers It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite. -- Jane Austen?
Re: Wh[ie]ther Infix Superposition ops
At 11:22 AM -0600 10/29/02, Jonathan Scott Duff wrote: On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: Also the idea of allways using 'function' style for something so basic like superpositions doesn't appeal to me. Superpositions are basic in a fabric-of-the-universe kind of way, but they are hardly basic in the everyone-learns-them-in-grade-school kind of way. I think the latter is more important for huffman coding of operators for the unwashed masses. But I'm willing change my mind if we start teaching everyone superpositions in grade school :-) Perhaps the best thing to do is to define a word operator for superpositions and, if they later become really popular, snag some generally-available* extended character to represent the operators. *Generally available meaning in all of the Shift-JIS, Big5, and Unicode sets, assuming there are some that aren't Kanji -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Wh[ie]ther Infix Superposition ops
On Tue, 29 Oct 2002, Dan Sugalski wrote: : Perhaps the best thing to do is to define a word operator for : superpositions and, if they later become really popular, snag some : generally-available* extended character to represent the operators. Sorry, I believe in the transactional model of QM, and the future has already reached back in time and grabbed | and . :-) : *Generally available meaning in all of the Shift-JIS, Big5, and : Unicode sets, assuming there are some that aren't Kanji I believe and | already satisfy that particular constraint. :-) So does X, for that matter. Now, we'd be in real trouble if we'd picked \ for xor, since that's the yen sign in Japanese. Larry
Re: Wh[ie]ther Infix Superposition ops
On Tue, 29 Oct 2002, Jonathan Scott Duff wrote: : On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: : Also the idea of allways using 'function' style for something so : basic like superpositions doesn't appeal to me. : : Superpositions are basic in a fabric-of-the-universe kind of way, but : they are hardly basic in the everyone-learns-them-in-grade-school kind : of way. I think the latter is more important for huffman coding of : operators for the unwashed masses. But I'm willing change my mind if we : start teaching everyone superpositions in grade school :-) That won't happen, because they don't *have* to be taught in grade school. You learn any() and all() as part of language before you ever get to grade school. What kindergartener can't understand a logically entangled list of nouns? I want a tricycle or a video game or a teddy bear for Christmas. I want a tricycle and a video game and a teddy bear for Christmas. That's no different from: $self.want($tricycle | $video_game | $teddy_bear); $self.want($tricycle $video_game $teddy_bear); Logically entangle nouns *are* more basic than grade school. Kids are even sophisticated enough to disambiguate xor from or by context, despite the fact that English has no xor operator: Which do you want? A popsicle or a Mickey Mouse hat? That's something like: $you.pick($popsicle X $hat); : Or if someone can show that they aren't really something new and : amazing, but something old and comfortable but with a funny name and : more power. Well, quantum superpositions really is a very funny name. I've been reducing that to super lately, but even that's misleading, because it's hard to think of something super as basic. I prefer to think of them as logically related nouns like we use all the time in English. Logic for nouns rather than verbs. Something a toddler can understand. So I would look favorably on finding a replacement for superposition. Larry
Re: Wh[ie]ther Infix Superposition ops
On Tuesday, October 29, 2002, at 09:08 AM, Jonathan Scott Duff wrote: Statements like this bother me. Not because I don't think it might be true, but because it's in future tense. If someone (named Damian :-) wrote a superposition synopsis that showed the many and varied uses of superpositions in contexts that ordinary programmers can relate to, it would bother me less when people make claims about the usefulness of superpositions. I think superpositions will, indeed, be extensively used, but I don't think they'll be called superpositions by most of the people that use them. They're typically used more like set operations. Something as basic as if any($x,$y,$z) 10 # if ($x | $y | $z) 10 is pretty useful, even in simple code. As is my $n = (1..100) | don't care; The collapsification to a discrete value would, I imagine, be typically used to select a random entry from a set. my $r = any(set); print $r; # assuming this _does_ collapse And I'm *really* looking forward to having union/intersection operations, because it solves lots of the typical Cookbook recipes for lists and hashes as one-liners. This is why I am nervous about introducing terms like eigenbunny, etc., into the general vocabulary of the language. It attempts to make it sound harder than it is, I think -- there are plenty of uses for these operators outside the collapsing dynamics they allow. If we focus first on an explanation that does not take directly from quantum mechanics, but rather sort of ...slide... into the QM meanings after explaining the more easily understood set meanings, I think it will be quite quickly adopted by newbies. MikeL
Re: Wh[ie]ther Infix Superposition ops
[EMAIL PROTECTED] (Larry Wall) writes: So I would look favorably on finding a replacement for superposition. Predicate calculus? :) Seriously, I see no problem with calling them set operators. -- For true believers, LORD would be K\textsc{nuth} in TeX, and L\textsc{amport} in LaTeX. Atheists prefer \phantom{LORD}. Agnostics may need to use the ifthen package. - Chris Boyd, comp.text.tex
RE: Wh[ie]ther Infix Superposition ops
From: Simon Cozens [mailto:simon;ermine.ox.ac.uk] [EMAIL PROTECTED] (Larry Wall) writes: So I would look favorably on finding a replacement for superposition. Predicate calculus? :) Seriously, I see no problem with calling them set operators. Great minds think alike. Or in this case even me ;) I was just describing superpositions as set operations to one of our developers... I'm left wondering what the relationship between Perl6 and relational databases will be. Where one will leave off and the other will begin. -- Garrett Goebel IS Development Specialist ScriptPro Direct: 913.403.5261 5828 Reeds Road Main: 913.384.1008 Mission, KS 66202 Fax: 913.384.2180 www.scriptpro.com [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
At 10:02 AM -0800 10/29/02, Larry Wall wrote: On Tue, 29 Oct 2002, Dan Sugalski wrote: : Perhaps the best thing to do is to define a word operator for : superpositions and, if they later become really popular, snag some : generally-available* extended character to represent the operators. Sorry, I believe in the transactional model of QM, and the future has already reached back in time and grabbed | and . :-) Well, I suppose when people use them as bitwise operators they won't be any more confusingly wrong then they often are now... : *Generally available meaning in all of the Shift-JIS, Big5, and : Unicode sets, assuming there are some that aren't Kanji I believe and | already satisfy that particular constraint. :-) So does X, for that matter. I was thinking more of the double-vertical bar or one of the stars. I admit I'm really not sure that the quantum operations will be used enough to warrant blowing people's expectations of bitwise operations, even if the bitwise operations aren't used that much. Not my call, though--it's all assembly as far as I'm concerned. :) -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Wh[ie]ther Infix Superposition ops
On 29/10/02 09:58 -0800, Larry Wall wrote: On Tue, 29 Oct 2002, Jonathan Scott Duff wrote: : On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: So I would look favorably on finding a replacement for superposition. How about christmasgift or gift? You don't know what it is until you open it. It could be any, all or none of what you expected. How about envelope? (noun) Or better yet pocket. What has it gots in its pocketses my precious? To keep that QM feel you could call it a hotpocket. Cheers, Brian
Re: Wh[ie]ther Infix Superposition ops
On Tue, Oct 29, 2002 at 10:22:36AM -0800, Michael Lazzaro wrote: This is why I am nervous about introducing terms like eigenbunny, etc., into the general vocabulary of the language. It attempts to make it sound harder than it is, I think -- there are plenty of uses for these operators outside the collapsing dynamics they allow. I like the eigen- prefix. It adds to the unique flavor of perl jargon (where else will you see the term sigil bandied about?). If we called yadda*3 gedanken code that wouldn't bother me either. :-) -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
On Tue, Oct 29, 2002 at 11:12:28AM -0800, Brian Ingerson wrote: On 29/10/02 09:58 -0800, Larry Wall wrote: On Tue, 29 Oct 2002, Jonathan Scott Duff wrote: : On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: So I would look favorably on finding a replacement for superposition. How about christmasgift or gift? You don't know what it is until you open it. It could be any, all or none of what you expected. Then we should definitely call it cat ;-) -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
On Tuesday, October 29, 2002, at 09:58 AM, Larry Wall wrote: What kindergartener can't understand a logically entangled list of nouns? I want a tricycle or a video game or a teddy bear for Christmas. I want a tricycle and a video game and a teddy bear for Christmas. That's no different from: $self.want($tricycle | $video_game | $teddy_bear); $self.want($tricycle $video_game $teddy_bear); I think that this (and the remainder of your message) is a beautiful demonstration of the utility of the superposition operators. I notice that the naysayers suddenly quieted down after this message. So I would look favorably on finding a replacement for superposition. Well, I like set operators, too, but what's the grammatical term for the above logically entangled list of nouns? Regards, David -- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394 http://david.wheeler.net/ Yahoo!: dew7e Jabber: [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
I think this may be in response to an earlier message of yours looking for a replacement for superposition. But I recall getting a Dilbert calendar for Xmas some years back with a cover featuring the PHB saying I'm not indecisive - I'm flexible! Thus, flexops. And flexpressions (flexprs, for short). With operator:flexible|, operator:flexible, and operator:flexible^. And $result = flexible ($a $b $c) ^ ($d | $e | $f); instead of $result = bitwise ($a $b $c) ^ ($d | $e | $f); (Of course, flexprs are the default, so you won't need to specify that. See below.) --- Larry Wall [EMAIL PROTECTED] wrote: On Tue, 29 Oct 2002, Austin Hastings wrote: : --- Piers Cawley [EMAIL PROTECTED] wrote: : : one(any($a, $b, $c), all($d, $e, $f)) : : Is a good deal more intention revealing than the superficially : appealing than : : ($a $b $c) ^ ( $d | $e | $f ) First I would like to point out that the and | are backwards there from the original. means all(), and | means any(). Which implies, since no one else has pointed this out, that function-style is not as clear as operator-style. (FYI: The little 's around -style descriptors is shorthand for some sort of Saturday afternoon Kung Fu Theatre combat pose. As in, Your stork is no match for my drunken guppy. My sister will be avenged!) : Would it be practical/meaningful to say : : $result = bitwise ($a $b $c) ^ ($d | $e | $f); : $result = superpose ($a $b $c) ^ ($d | $e | $f); : : And allow a use operation to select defaulting behavior? (With an : appropriate warning if the code used one of these operators without : specifying the use directive, even though crab-style is the default?) All other things being equal, I think people will find modal operators more confusing than if we just make separate operators. To quote Rene Descartes, I think not! (poof!) From what everyone has chipped in thus far, the discussion is between the conservatives who feel that since everyone knows 'C', we should keep the 'C' operator semantics when possible, and the avant garde who feel that bitops are dead, long live flexops! Frankly, I have a hard time imagining a perl program where bitops are generally useful. (In functions, yes. But will they permeate the code?)On the other hand, flexops may well be. So I propose that we give the nervous types a way to clearly specify both, and provide a default (new-style). There's no going back, of course. But the ability to give warnings on unspecific ops and the ability to override the default should satisfy the conservatives long enough to get them addicted to qrack.. That being said, I'm still wondering whether we can finesse it. Damian's default any() semantics in numeric context select a random element. If we made that not the default, we could have an alternate default semantics in numeric (or, at least, integer) context. So suppose we introduce for the pick one semantics an explicit verb named, oddly enough, pick(). my int $foo = pick( 1 | 2 | 4 ); # $foo gets (1,2,4)[rand 3] my int $bar = 1 | 2 | 4; # $bar gets 7 It seems to me that flexible results are more like NaN than anything else. Once they go into an expression, they corrupt the expression. my $var = 1 | 3; print $var * 2 - 1; Should print something like: ANY-SCALAR(1|5) Or perhaps it should give a warning: Doubleplusungood: Eigenbunny at line 3. Scalar expected. People can be scared if they like, but I am also of the opinion that superpositions are more basic than bitops, at least in a sense. My reasoning for that is that they don't commit to an interpretation prematurely. A 1 | 2 | 4 means a 1, a 2, or a 4, nothing more. You can make other things out of a superposition depending on the context. Damian already made them mean two different things in numeric vs string context. Can I say bitwise $str ^~^= 16:20 x ...; # Each chr in $str xor= shift; to change case? Or is one ^ enough? (Admittedly an ASCII hack, but ..) So I wonder about whether, in $result = superpose ($a $b $c) ^ ($d | $e | $f); the superpose is really a no-op. I don't think so. Or at least, if it is, I'm not sure how to deal with it. Because I fear trying to mix eval and whatever parser magic is implied below. And if you don't do that, then there's property-creation going on which will upscrew the optimizer, I think. (See next para below.) If you go on to say my int $foo = pick( $result );# random element filling contract my int $bar = $result;# bitwise then the superposition would collapses as specified. What do you do for actions at a distance. That is, you say my int $foo = (3 | 4); here, and return $foo, and store it away in a hash, and some time later, possibly in a different module written months earlier, take that value OUT of that hash (or, worse, read it back in from a serialized representation). Did you carry the
Re: Wh[ie]ther Infix Superposition ops
Simon Cozens wrote: In this case I find the latter to be easier to decode and more appealing. There are less chars and paretheses are seen much more easily. Ack, I guess that means we need a one character DWIM operator. Although ... comes pretty close, I suppose. Great minds think alike. Acme::DWIM http://search.cpan.org/author/DCONWAY/Acme-Bleach-1.12/lib/Acme/DWIM.pm gave Perl5ers exactly that, 18 months ago. ;-) Damian
Re: Wh[ie]ther Infix Superposition ops
On Tue, Oct 29, 2002 at 11:26:56AM -0800, David Wheeler wrote: Well, I like set operators, too, but what's the grammatical term for the above logically entangled list of nouns? I'd call them ents if not for Austin Hastings' more sensible flexops (unless someone wants to take a stab at relating superpositions to tree people :-) -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Wh[ie]ther Infix Superposition ops
Piers Cawley wrote: Whilst I don't wish to get Medieval on your collective donkey I must say that I'm really not sure of the utility of the proposed infix superposition ops. I'm a big fan of any/all/one/none, I just think that one(any($a, $b, $c), all($d, $e, $f)) Is a good deal more intention revealing than the superficially appealing than ($a $b $c) ^ ( $d | $e | $f ) I very much doubt that most people will write either of those. I suspect it will be quite unusual to see nested superpositions in code. Most folks are going to be using them for simple but very common checks like: if ( $start $finish 0 } { ($finish,$start) = [-]($start,$finish); # hyper negate } if ( $start | $finish 0 ) { print Bad index\n and die; } given $start { when 1|3|5|7|9 { print That's odd...\n } when 2|4|6|8|10 { print Even so...\n } default { print Taking off shoes...\n } } my $seen = $start | $finish; for - $next { print $next unless $next == $seen; $seen |= $next; } which takes rather more decoding. And if you *do* want to use such operators, surely you could just do use ops ':superpositions'; in an appropriate lexical scope. Am I missing something? Yes. That superpositions are going to be so widely used once people catch on, that users going to curse us every time they have to write Cuse ops ':superpositions'; at the start of every scope. ;-) Damian
Re: Wh[ie]ther Infix Superposition ops
If someone (named Damian :-) wrote a superposition synopsis that showed the many and varied uses of superpositions in contexts that ordinary programmers can relate to, it would bother me less when people make claims about the usefulness of superpositions. I'll take one of those for perl.com! And I'll certainly write one, when/if it's appropriate. Hint: we may need an Apocalypse N.5 and a corresponding Exegesis N.5 to deal with superpositions, since they don't really fit into the existing chapter structure of the Camel. Hmmm, I guess that, since superpositions are both value and operators, that should be Exegesis any(2,3) ;-) I was very tempted to use a superposition in production code, but realised a grep of an array did the same job. Sure. TMTOWTDI. And under the current Q::S implementation, Cgrep almost certainly did it faster too. But for simple cases, I suspect that using a built-in Perl 6 superposition: if any(values) % 2 { print That's odd...\n } is more maintainable (and probably faster) than Cgrep: if grep { $_ % 2} values { print That's odd...\n } Damian
Re: Wh[ie]ther Infix Superposition ops
Brian Ingerson writes: On 29/10/02 09:58 -0800, Larry Wall wrote: On Tue, 29 Oct 2002, Jonathan Scott Duff wrote: : On Tue, Oct 29, 2002 at 10:13:39AM +0200, Markus Laire wrote: So I would look favorably on finding a replacement for superposition. How about christmasgift or gift? You don't know what it is until you open it. It could be any, all or none of what you expected. How about envelope? (noun) Or better yet pocket. What has it gots in its pocketses my precious? To keep that QM feel you could call it a hotpocket. Cheers, Brian maybe something containing parallel since that is what they are doing : put those things in parallel universes and let them go. ( as opposed to seqential thinking in Classical language ) parallel parallel_ ??? # do not know english enouth to come with something here or maybe taking analogu from do { ... } # immediate code sub{ ... } # deferred code 1 or 2 immediate choice 1 | 2 choice is deferred so deferred logic arcadi
Re: Wh[ie]ther Infix Superposition ops
David Wheeler wrote: Well, I like set operators, too, but what's the grammatical term for the above logically entangled list of nouns? Superposition. Damian
Re: Wh[ie]ther Infix Superposition ops
I confess, I don't get it. To me, it appears to iterate over the input, printing unique values except that two values ($start, $finish) are considered to have already been encountered. If that's all, then okay. But does it somehow skip all entries before/after the delimiter? Also, in a related vein, how do flexen and rexen interact? That is, what happens if I try to match a flexpr? Do I get flexprs in all the match variables, or what? =Austin --- John Siracusa [EMAIL PROTECTED] wrote: On 10/29/02 3:13 PM, Damian Conway wrote: I suspect it will be quite unusual to see nested superpositions in code. Most folks are going to be using them for simple but very common checks like: [...] my $seen = $start | $finish; for - $next { print $next unless $next == $seen; $seen |= $next; } I just spent 2 minutes staring at that last example until I finally understood it. While I agree that there are many common uses for this stuff, not all common uses are simple, IMO. I think my hang-up mostly had to do with all the existing knowledge I have about how | and |=, and even == are supposed to work. Had the example used the English versions of the operators, I would have gotten it instantly: my $seen = any($start, $finish); for - $next { print $next unless $next == $seen; $seen = any($seen, $next); } (Okay, maybe I would have gotten stuck for a moment on the $next == $seen part, but that's about it :) Anyway, I think this is just a long-winded way of expressing my support for an article explaining set operators (or cat-bunny slippers or whatever :) and all their wonderful uses. And I also think the English versions of the operators are much easier to understand, at least initially, if only due to the historical baggage of |, , and friends. -John __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
Re: Wh[ie]ther Infix Superposition ops
Brian Ingerson wrote: Oh! I just remembered the ultimate word for a container. It's cozy, of course! Every eigenbunny needs a supercozy! The plural of which is, presumable, supercozens. Now *I'm* really scared! ;-) Damian
Re: Wh[ie]ther Infix Superposition ops
At 1:34 PM -0800 10/29/02, Brian Ingerson wrote: On 29/10/02 14:47 -0500, Dan Sugalski wrote: At 10:22 AM -0800 10/29/02, Michael Lazzaro wrote: This is why I am nervous about introducing terms like eigenbunny, etc. Oh, I dunno, I kind of like it. Of course, now my kids want eigenbunny slippers... (Though the trouble with those is they may or may not be keeping your feet warm--you can never tell) Oh! I just remembered the ultimate word for a container. It's cozy, of course! Every eigenbunny needs a supercozy! Absolutely. Eigenbunnies in supercozens. Sounds like we've found the mascot for Perl 6! -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Wh[ie]ther Infix Superposition ops
[EMAIL PROTECTED] (David Wheeler) writes: Well, I like set operators, too, but what's the grammatical term for the above logically entangled list of nouns? Conjunctions and disjunctions. -- Wouldn't you love to fill out that report? Company asset #423423 was lost while fighting the forces of evil. -- Chris Adams in the scary.devil.monastery
Re: Wh[ie]ther Infix Superposition ops
On Tue, 29 Oct 2002, Dan Sugalski wrote: At 1:34 PM -0800 10/29/02, Brian Ingerson wrote: Every eigenbunny needs a supercozy! Absolutely. Eigenbunnies in supercozens. Sounds like we've found the mascot for Perl 6! I really want to work a pear pimples for hairy fishnuts reference in here somewhere, but I can't quite make it work. Dave Storrs