Re: RC4 < 182 bytes

2002-02-17 Thread Andrew . Savige
Eugene van der Pijll schreef op 17 februari 2002: > 151: > > sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x]; > $s[$x++]+$s[$y]}@k=pop=~/../g;$y+=hex$k[ > $x%@k],f for@s=0..255;$x=1;$y=0;$x%=@s,p > rint$_^chr$s[f()%@s]for<>=~/./g I haven't got a clue about RC4, but inspecting Eugene's masterpiece, can yo

RE: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Philip Newton
On 18 Feb 02, at 10:46, [EMAIL PROTECTED] wrote: > Philip Newton wrote: > > Well, existing compilers tend to be slow to implement new > > standards such as C99 > > > > So for my purposes, "standard C" is "ANSI C" i.e. "K&R 2nd ed.". YMMV. > > Interestingly, in this particular case, many vend

Re: interesting typo I couldn't see

2002-02-17 Thread Ronald J Kimball
On Sun, Feb 17, 2002 at 12:02:49PM -0500, Bill -OSX- Jones wrote: > > >Vicki writes: > > > >> if (...) { > >>my @item_parts = split(/\n/, $item); > >>printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", > >> $quantity, $item_par

RE: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Andrew . Savige
Philip Newton wrote: > Well, existing compilers tend to be slow to implement new > standards such as C99 > > So for my purposes, "standard C" is "ANSI C" i.e. "K&R 2nd ed.". YMMV. Interestingly, in this particular case, many vendors are very *quick* to implement, often implementing before it

Re: Fwd: Re: interesting typo I couldn't see

2002-02-17 Thread Lars Henrik Mathiesen
[EMAIL PROTECTED] ("Philip Newton") writes: >On 17 Feb 02, at 11:05, Patrik Grip-Jansson wrote: >> No, you're wrong there. Using '//' as a comment is a part of the C >> standard. Have a look at a recent version, for example the one at; >> http://www.cl.cam.ac.uk/~mgk25/volatile/ISO-C-FDIS.1999-0

Re: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Philip Newton
On Sun, 17 Feb 2002 11:55:27 +0100, [EMAIL PROTECTED] (Peter Makholm) wrote: > Philip Newton <[EMAIL PROTECTED]> writes: > > > Well, not really C since you rely on '//' introducing a > > comment-to-end-of-line. > > I cannot find the C99 standard. But it looks like '//' was introduced > as comme

Re: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Philip Newton
On Sun, 17 Feb 2002 12:02:43 -0800, [EMAIL PROTECTED] wrote: > On Sun, Feb 17, 2002 at 07:35:24AM +0100, Philip Newton wrote: > > On Sun, 17 Feb 2002 09:42:55 +1100, [EMAIL PROTECTED] (Andrew Savige) > > wrote: > > > > > you have a choice of 3 different languages (Perl, C or C++). ^.^ > > > > W

Re: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Dmitry Kohmanyuk Дмитрий Кохманюк
On Sun, Feb 17, 2002 at 07:35:24AM +0100, Philip Newton wrote: > On Sun, 17 Feb 2002 09:42:55 +1100, [EMAIL PROTECTED] (Andrew Savige) > wrote: > > > you have a choice of 3 different languages (Perl, C or C++). ^.^ > > Well, not really C since you rely on '//' introducing a > comment-to-end-of-l

Re: interesting typo I couldn't see

2002-02-17 Thread Uri Guttman
> "VB" == Vicki Brown <[EMAIL PROTECTED]> writes: >> my $p_item = ( ... ) ? (split( /\n/, $item ))[0] : $item ; >> printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", >> $quantity, $p_item, $price, $ext); VB> You realize, don't you, that I didn't post the whole script...? probably, b

Re: interesting typo I couldn't see

2002-02-17 Thread Vicki Brown
At 14:04 -0500 2/17/02, Uri Guttman wrote: >another reason to write better perl code. the two printf's are so >similar that they should be reduced to one and only the 2nd arg needs to >be dealt with. > > > my $p_item = ( ... ) ? (split( /\n/, $item ))[0] : $item ; > printf ORDER ("\n%4

RE: Re: interesting typo I couldn't see

2002-02-17 Thread Vicki Brown
At 11:40 -0500 2/17/02, Ala Qumsieh wrote: > } else { > printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", > } $quantity, $item, $price, $ext); Another reason to use Emacs :) Ptooie :)~ -- - Vicki Vicki Brown ZZZ

Re: interesting typo I couldn't see

2002-02-17 Thread Uri Guttman
> "AQ" == Ala Qumsieh <[EMAIL PROTECTED]> writes: AQ> Vicki writes: > if (...) { > my @item_parts = split(/\n/, $item); > printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", > $quantity, $item_parts[0], $price, $ext); > } else { > printf ORDER ("\n%4d %-50

Re: Fwd: Re: interesting typo I couldn't see

2002-02-17 Thread Philip Newton
On 17 Feb 02, at 11:05, Patrik Grip-Jansson wrote: > On Sun, 17 Feb 2002, Philip Newton wrote: > > > Well, not really C since you rely on '//' introducing a > > comment-to-end-of-line. That's a C++-ism which some C compilers support > > but which isn't part of the C standard. > > No, you're wro

Re: interesting typo I couldn't see

2002-02-17 Thread Bill -OSX- Jones
Actually, I am really wondering why the syntax check doesn't feel it was an error... > printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", >} $quantity, $item, $price, $ext); > Aren't the $quantity, $item, $price, $ext); somehow orphaned after the brace? _Sx

Re: interesting typo I couldn't see

2002-02-17 Thread Bill -OSX- Jones
:| :} OK, so to put the others out of their (possible) misery: > Vicki writes: > >> if (...) { >> my @item_parts = split(/\n/, $item); >> printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", >>$quantity, $item_parts[0], $pr

RE: Re: interesting typo I couldn't see

2002-02-17 Thread Ala Qumsieh
Vicki writes: > if (...) { > my @item_parts = split(/\n/, $item); > printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", >$quantity, $item_parts[0], $price, $ext); > } else { > printf ORDER ("\n%

Re: RC4 < 182 bytes

2002-02-17 Thread Eugene van der Pijll
Rocco Caputo schreef op 16 februari 2002: > I can't seem to get it below 160 characters. This is split > arbitrarily at 40 characters; it will not work until joined. > > sub f{@s[$x,$y]=@s[($y+=$s[$x])%=@s,$x]; > $s[$x]+$s[$y]}@k=pop=~/../g;$y+=hex$k[$x > %@k],f,$x++for@s=0..255;$x=$y=0;$x++,$x%

Re: RC4 < 182 bytes

2002-02-17 Thread Rocco Caputo
On Sat, 16 Feb 2002 12:01:21 -0800, Samy Kamkar wrote: > > It's RC4, so far in 182 bytes, accepts a hex key (e.g., a0b1c2) in > $ARGV[0] and reads input from <>: > sub > f{@s[$x,$y]=@s[$y,$x]}@k=map{hex}pop=~/../g;$y=($y+$k[$_%@k]+$s[$x=$_])%256,f > for@t=@s=0..255;$x=$y=0;$x++,$y+=$s[$x%=256]

Re: Explanation of my 189-stroke "Perl-is-C;C-is-Perl" entry

2002-02-17 Thread Peter Makholm
Philip Newton <[EMAIL PROTECTED]> writes: > Well, not really C since you rely on '//' introducing a > comment-to-end-of-line. I cannot find the C99 standard. But it looks like '//' was introduced as comment-to-end-of-line in ISO 9899-1999 (aka. C99). So only if you see K&R as the One True Author

Re: RC4 < 182 bytes

2002-02-17 Thread John W. Krahn
Samy Kamkar wrote: > > Hi everyone! Hello, > Uri just pointed me out to this list today and I'm glad he did :) > > Well, I'd like to know if any of you are able to shorten this, I spent a > few minutes last night and this morning shortening it to 182 bytes and > I'm not sure what else can be d

Re: Fwd: Re: interesting typo I couldn't see

2002-02-17 Thread Patrik Grip-Jansson
On Sun, 17 Feb 2002, Philip Newton wrote: > Well, not really C since you rely on '//' introducing a > comment-to-end-of-line. That's a C++-ism which some C compilers support > but which isn't part of the C standard. No, you're wrong there. Using '//' as a comment is a part of the C standard. Hav

Re: Fwd: Re: interesting typo I couldn't see

2002-02-17 Thread Hasanuddin Tamir
On Sun, 17 Feb 2002, Dave Hoover <[EMAIL PROTECTED]> wrote, > Vicki wrote: > >It took me a while to find the problem... when I did I was somewhat amused > > > > --- Begin Forward --- > > > > > > if (...) { > >my @item_parts = split(/\n/, $item); > >prin

Re: Fwd: Re: interesting typo I couldn't see

2002-02-17 Thread Dave Hoover
Vicki wrote: >It took me a while to find the problem... when I did I was somewhat amused > > --- Begin Forward --- > > > if (...) { >my @item_parts = split(/\n/, $item); >printf ORDER ("\n%4d %-50s %3.2f %3.2f\n", > $qu