Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inline::Pugs landed to Pugs tree

3 views
Skip to first unread message

Autrijus Tang

unread,
May 18, 2005, 4:52:02 PM5/18/05
to perl6-c...@perl.org
An one-hour hack of mine proved fruitful. This is Perl 5 script,
calling into Perl 6 functions defined inline:

#!/usr/bin/perl
use Inline Pugs => '
sub postfix:<!> { [*] 1..$_ }
sub sum_factorial { [+] 0..$_! }
';
print sum_factorial(3); # 21

The implementation is in lib/Inline/Pugs.pm that comes with Pugs tree.
You'll need Inline.pm from CPAN to run the example above.

Patches, suggestions, etc welcome. :-)

Enjoy,
/Autrijus/

Brian Ingerson

unread,
May 19, 2005, 7:04:39 PM5/19/05
to Autrijus Tang, perl6-c...@perl.org

*evil grin*

An five-minute hack of mine proved fruitful. This is Perl 5 script,


calling into Perl 6 functions defined inline:

#!/usr/bin/perl
use pugs;


sub postfix:<!> { [*] 1..$_ }
sub sum_factorial { [+] 0..$_! }

no pugs;
print sum_factorial(3); # 21

The implementation is in lib/pugs.pm that comes with Pugs tree.


You'll need Inline.pm from CPAN to run the example above.

Patches, suggestions, etc welcome. :-)

Enjoy,
/ingy/

0 new messages