Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: (golf) Interlaced Strings

by premchai21 (Curate)
on May 02, 2001 at 07:00 UTC ( #77216=note: print w/replies, xml ) Need Help??


in reply to (golf) Interlaced Strings

#!/usr/bin/perl use strict; sub interlace { ### ENGAGE GOLF MODE ### my@a=@_;my$z='';($z=chop($a[0]).chop($a[1]).$z)while($a[0]||$a[1]) +;$z ### DISENGAGE GOLF MODE ### } print interlace 'Ti sats.', 'hsi et ';

69 chars with strict on, according to Emacs.

Update: D'oh! Changed something and forgot to change the other part to match. Now is six characters longer.

Replies are listed 'Best First'.
Re: Re: (golf) Interlaced Strings
by Masem (Monsignor) on May 02, 2001 at 07:08 UTC
    Do you even need to define @a? I think you can drop this by 7 characters more...
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      Eight, you mean. But I do need to define it; since I'm passing in constants, @_ is considered read-only.
Re: Re: (golf) Interlaced Strings
by koolade (Pilgrim) on May 02, 2001 at 19:54 UTC

    Am I missing something? This doesn't work for me. $x and $y are never defined. Do you mean:

    my@a=@_;my$z='';($z=chop($a[0]).chop($a[1]).$z)while($a[0]||$a[1]);$z

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://77216]
help
Chatterbox?
[marto]: not if you keep telling people :P
[zentara]: I had to disable hyperthreading on my machine because of that.
[Discipulus]: thanks marto but... at the moment this seems a bit beyond my faculties.. ;=)
[zentara]: a thread goes into a wait state after emitting a wait to all other threads. It locks up a machine completely.
[marto]: if you mean the recent hyperthreading bug, I don't think that's NSA related?
[zentara]: s/thread/cpu/
[marto]: xkcd://538
[Discipulus]: these opcodes mentioned in the wiki pages are the same opcode perl is translated into? or is just the same term but in different fields?
[zentara]: it's useful if you want to lockup a multicore machine :-)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-07-28 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (428 votes). Check out past polls.