Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Variation on a (JAPH) theme

by kelan (Deacon)
on Dec 06, 2004 at 16:33 UTC ( #412688=obfuscated: print w/replies, xml ) Need Help??

The algorithm present in this JAPH is a variation on another JAPH I wrote, although the look is quite different. It only has one trick that I consider surprising, but I thought the formatting turned out rather nice.

s oohaa ctkseurjogis; s ii rpeehrtlo nisom; +$ -= + split $ +; ; print + splice @ ## ; _ => + $ ---, $ ++ 1 while + $ ---- $ ++ @ _

Replies are listed 'Best First'.
Re: Variation on a (JAPH) theme
by jdalbec (Deacon) on Dec 07, 2004 at 03:12 UTC
    Some documentation, some code modifications to try:
    s oohaa ctkseurjogis; #print "$_\n"; s ii rpeehrtlo nisom; #print "$_\n"; +$ -= + split $ +; ; =pod split In scalar context, returns the number of fields found and splits into the @_ array. Use of split in scalar context is deprecated, however, because it clobbers your subroutine argu- ments. $- The number of lines left on the page of the currently selected output channel. Used with formats. (Mnemonic: lines_on_page - lines_printed.) =cut #$\ = $/; do {local $\; print "$- "}, print + splice @ ## ; _ => + $ ---, $ ++ 1 while + $ ---- $ ++ @ _
    In My 1st post (japh) I saw 0-1=1 using $|. Now I see 0-1=0 using $-. You and blazar should write a tutorial on "special properties of special variables".
      Indeed I discovered the special property of $| while developing that JAPH. Someone pointed out that it's well known to golfers who often spot it to alternate between two values...
Re: Variation on a (JAPH) theme
by blazar (Canon) on Dec 10, 2004 at 13:32 UTC
    Indeed it's not too hard to understand, but it looks really nice. I'm *slightly* bothered by the missing ",\n" and I prefer s/j(?=ust)/J/ and s/p(?=erl)/P/ anyway. But it's so nice and small and delicate...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://412688]
Approved by dfaure
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2023-12-10 00:55 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (38 votes). Check out past polls.