IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Deconstructed
If you understand what this does:

echo {A,B}{A,B,C}{A,B}

then you shouldn't be surprised at

perl -e'print"$_\\n"for glob"{A,B}{A,B,C}{A,B}"'

The key is therefore how to produce that string. Well we do it as:

perl -e'print"$_\\n"for glob join"","{A,B}","{A,B,C}","{A,B}"'

Now we just need to produce those. Well our first trick is $" and array interpolation. If you set $" to ",", then a list interpolates into a string with comma separators. So with that global set, "@{[A..C]}" is "A,B,C". Slap braces around that, and you see what "{@{[A..$_]}}" does.

Now we just need to get the right list of characters. BCB=~/./g does that in list context, which we are in. (I didn't think of that trick at first. My initial versions in the revision history used split.)

And that's it.

Cheers,
Ben

PS You will note that I am making liberal use of unquoted barewords as strings. This wouldn't exactly pass strict, but I don't have that on so I don't care.
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New Ahh
I'm religiously opposed to glob so it didn't click!
Maynow, as an internal, it is safe.
But I always got burned on "command line too long" from globs so I always
opendir, grep for what I want, close dir.
New Ditto, but I remember the stupid trick for golf
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
     Combinatron - (tablizer) - (39)
         Python example (using generators) - (admin) - (3)
             Nice language - reads as easy as pseudocode - (deSitter) - (2)
                 Post the code. -NT - (admin) - (1)
                     The idiom - (deSitter)
         OK, so the generators were nifty, but not needed :-) - (admin) - (34)
             Probably more efficient: - (admin) - (33)
                 And the readable version :P - (FuManChu) - (32)
                     Ick. Globals. - (admin) - (31)
                         Granted. - (FuManChu) - (30)
                             Like this? - (admin) - (29)
                                 This is probably worth decomposing, too - (admin)
                                 Now you've EARNED my nasty Perl tricks... - (ben_tilly) - (25)
                                     Yabut... - (admin) - (20)
                                         Re: Yabut... - (deSitter) - (1)
                                             Appearances *are* complexity - (FuManChu)
                                         They can? - (ben_tilly) - (17)
                                             Ruby? (Perl was impressive, knock me out dude) -NT - (deSitter) - (15)
                                                 Sorry, I am rusty enough not to attempt it - (ben_tilly)
                                                 Two Ruby Versions - (JimWeirich) - (13)
                                                     Recursive + stack space... - (admin) - (10)
                                                         Re: Recursive + stack space... - (JimWeirich) - (7)
                                                             Ah, ok. - (admin) - (6)
                                                                 Proof by induction - (deSitter) - (5)
                                                                     ... - (admin) - (4)
                                                                         (sheepish grimace) - (deSitter)
                                                                         Recursion and Lisp - (JimWeirich) - (2)
                                                                             You still misunderstand me. - (admin) - (1)
                                                                                 Re: You still misunderstand me. - (deSitter)
                                                         Only other people's... :) - (FuManChu) - (1)
                                                             No, I should go look that one up. -NT - (admin)
                                                     Let me golf the one-liner a little... - (ben_tilly) - (1)
                                                         Ooo ... Good call on split - (JimWeirich)
                                             Wrong interpretation. - (admin)
                                     Please deconstruct it for me - (broomberg) - (3)
                                         Deconstructed - (ben_tilly) - (2)
                                             Ahh - (broomberg) - (1)
                                                 Ditto, but I remember the stupid trick for golf -NT - (ben_tilly)
                                 Mein Gott. - (FuManChu) - (1)
                                     Yep. It's a great language. -NT - (admin)

SHUT THAT BLOODY BOUZOUKI UP!
84 ms