Actually, that might be good for a side-by-side comparison.
The Ruby version is way cleaner.
Daniel Carrera | OpenPGP fingerprint:
Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
UMD (301) 405-5137 | http://www.math.umd.edu/~dcarrera/pgp.html
···
On Fri, Jul 11, 2003 at 07:31:02AM +0900, Xavier Noria wrote:
On Friday 11 July 2003 00:22, Daniel Carrera wrote:
def twice
yield
yield
end
twice { puts “Ruby rocks!” }
sub twice(&) {
my $sub = shift;
&$sub;
&$sub;
}
twice { print “Ruby rocks!\n” }
Xavier Noria graced us by uttering:
Daniel Carrera wrote:
def twice
yield
yield
end
twice { puts “Ruby rocks!” }
sub twice(&) {
my $sub = shift;
&$sub;
&$sub;
}
twice { print “Ruby rocks!\n” }
How about solving that puts() gripe you mentioned:
sub twice (&) { my $sub = shift; &$sub; &$sub; }
sub puts { print "$_\n" for @_ }
twice { puts "Ruby rocks!" } # Now in Ruby *AND* Perl!
Ugly, but flexible. No point condemning a language just because
it doesn’t use an entirely different function to tack a newline
onto arguments. Much better to discriminate based on appearances.

Tim Hammerquist
···
–
guru, n: a computer owner who can read the manual.
Saluton!
- Tim Hammerquist; 2003-07-11, 12:27 UTC:
Reminds me of an answer posted on the vim mailing list:
: > …any ideas on how to make vim behave like the ‘tail’ command in unix?
: >
:
: On my system “cp /usr/bin/tail /usr/local/bin/vim” does the trick,
: though Vi compatibility is subsequently somewhat impaired.
That reminds me of something. Create a $HOME/.vimrc.more containing this:
···
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
" No compatibility – necessary for mappings to work.
set nocompatible
" Status line
set laststatus=0
set cmdheight=1
set nomodifiable " Only in version 6.0
set readonly
" My xterms have a navy-blue background, so I need this line too.
set background=dark
" Turn syntax on
syntax on
" Key bindings.
nmap b
nmap q :q
" To type the following line, type two C-V’s followed by two
" spaces. This is how you map the spacebar.
nmap ^V
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and alias “vmore” to “vim -u $HOME/.vimrc.more” and you have a pager
that does RUBY syntax highlighting.
Gis,
Josef ‘Jupp’ Schugt
N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon
In article slrnbgrrkq.du2.tim@vegeta.ath.cx,
(ignoring the puts gripe 
How about solving that puts() gripe you mentioned:
sub twice (&) { my $sub = shift; &$sub; &$sub; }
sub twice (&) { (my $sub = shift)->(); &$sub }
sub twice (&) { $_[0]() for (1, 2) }
or
sub twice (&) { $0; $0 }
seem more perlish. What are all those human readable variable names
doing in your version 
Ugly, but flexible. No point condemning a language just because
it doesn’t use an entirely different function to tack a newline
onto arguments. Much better to discriminate based on appearances.

Hey, I resemble that remark!
Mike
···
Tim Hammerquist tim@vegeta.ath.cx wrote:
–
mike@stok.co.uk | The “`Stok’ disclaimers” apply.
http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA
mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60
http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA
Saluton!
- Tim Hammerquist; 2003-07-11, 12:27 UTC:
Reminds me of an answer posted on the vim mailing list:
: > …any ideas on how to make vim behave like the ‘tail’ command in unix?
: >
:
: On my system “cp /usr/bin/tail /usr/local/bin/vim” does the trick,
: though Vi compatibility is subsequently somewhat impaired.
That reminds me of something. Create a $HOME/.vimrc.more containing this:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
" No compatibility – necessary for mappings to work.
set nocompatible
" Status line
set laststatus=0
set cmdheight=1
set nomodifiable " Only in version 6.0
set readonly
" My xterms have a navy-blue background, so I need this line too.
set background=dark
" Turn syntax on
syntax on
" Key bindings.
nmap b
nmap q :q
" To type the following line, type two C-V’s followed by two
" spaces. This is how you map the spacebar.
nmap ^V
nmap
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and alias “vmore” to “vim -u $HOME/.vimrc.more” and you have a pager
that does RUBY syntax highlighting.
Gis,
Josef ‘Jupp’ Schugt
N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon
also, I use a shell function rather than an alias, this way I
can make it works when there is no parameters (reading from
stdin) :
vmore()
{
if [ $# -eq 0 ]
then
vim -u ~/.vim/rc.more - -c ‘:set nomodified’
else
vim -u ~/.vim/rc.more “$@”
fi
}
···
On Sat, Jul 12, 2003 at 05:34:37AM +0900, Josef ‘Jupp’ Schugt wrote:
–
Benoît PIERRE pierre_b@epita.fr
Étudiant EPITA GISTR promo 2004
.-------------------------------------. [GnuPG FingerPrint]
Avoid the Gates of Hell. Use Linux | BDEE523CB7AE6D9DB4C0
_____________________________________| 8B0288677E698B65CC35
Josef ‘Jupp’ Schugt wrote:
" To type the following line, type two C-V’s followed by two
" spaces. This is how you map the spacebar.
nmap ^V
I’ve seen this information before, but can’t find it at the moment:
How do you get the ^V into Vim on Windows … where ^V means “paste”
??
Harry O.
Josef ‘Jupp’ Schugt graced us by uttering:
Saluton!
Is that Esperanto? 
That reminds me of something. Create a $HOME/.vimrc.more
containing this:
[ snippage ]
and alias “vmore” to “vim -u $HOME/.vimrc.more” and you have a
pager that does RUBY syntax highlighting.
In $VIMRUNTIME/macros there are two files: less.sh and less.vim.
less.sh is a drop-in replacement for less and takes care of just
about everything for you. You may want to store a local copy in
your ~/.vim/macros/ with tweaked settings, but it’s in the
standard distribution for a while now.
HTH,
Tim Hammerquist
···
–
Did I mention that I can’t tell you how to get rich?
If I could, I’d be rich, and not here.
– Martien Verbruggen in comp.lang.perl.misc
Who condemned anything?
The point was that for this particular challenge being able to iterate
with both the element and the index and having puts are advantages.
– fxn
···
On Friday 11 July 2003 14:14, Mike Stok wrote:
Ugly, but flexible. No point condemning a language just because
it doesn’t use an entirely different function to tack a newline
onto arguments. Much better to discriminate based on appearances.

Hey, I resemble that remark!
Saluton!
- Benoît PIERRE; 2003-07-12, 19:26 UTC:
nmap ^V
nmap
I took the information from vim.org. It did work so I didn’t try to
look for improvements.
also, I use a shell function rather than an alias
Not all shells have functions…
Anyway: I don’t know of any other pager that has syntax highlighting
- syntax highlighting for Ruby in particular.
Gis,
Josef ‘Jupp’ Schugt
···
–
N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon
Thanks! I’ll give that a go when I get back into work (I’m exclusively Linux
here at home).
H.
···
On Sun, 13 Jul 2003 18:15, Pit Capitain wrote:
On 13 Jul 2003 at 15:44, Harry Ohlsen wrote:
How do you get the ^V into Vim on Windows … where ^V means “paste” 
??
^Q