This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [] | |
; see - http://stackoverflow.com/questions/18231434/in-a-series-what-is-the-best-way-of-removing-the-last-element | |
remove-last: func [ | |
"Removes value(s) from tail of a series." | |
series [series! port! bitset! none!] | |
/part range [number!] "Removes to a given length." | |
][ | |
either part [take/last/part series range] [take/last series] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [] | |
; PHP | |
; $string = preg_replace( '/^@(.*?)@$/', '#$1#', $string ); | |
; | |
; Perl | |
; $string =~ s/^\@(.*?)\@$/#$1#/; | |
; | |
; # or... | |
; $string =~ s/\A\@(.*?)\@\Z/#$1#/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
see-gist: https://gist.github.com/miyagawa/5455942 | |
also-this: https://gist.github.com/shanselman/5422230#comment-823247 | |
comment: "My fledgling Rebol port of this Perl code" | |
requires: "Rebol/View - for https:// port" | |
github-support: "Thank you Austin@Github for (initiating) the fix for Rebol syntax highlighting" | |
] | |
split-string: func [text delim /local s coll] [ | |
coll: copy [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REBOL [ | |
Purpose: "Providing Rebol example of a Lisp macro given in HN comment" | |
HNcomment: https://news.ycombinator.com/item?id=5482124 | |
usage: "select [word-value from collection-list]" | |
] | |
select: func [block /local totals] [ | |
parse block [ | |
set this word! | |
'from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.016; | |
use warnings; | |
# See: http://news.ycombinator.com/item?id=5141179 | |
# | |
# This fasta.pl is a port of fasta.rb and is 2.6 times quicker than original alioth fasta.pl | |
use constant IM => 139968; | |
use constant IA => 3877; | |
use constant IC => 29573; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.016; | |
use warnings; | |
# Inspired by: http://news.ycombinator.com/item?id=5024754 | http://news.ycombinator.com/item?id=5025485 | |
# (port of) - https://gist.github.com/3755270 | |
package Bear { | |
sub new { | |
my ($class, $porridge, $chair, $bed) = @_; | |
bless { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[~]$ date | |
Wed 30 May 2012 13:01:15 BST | |
[~]$ perlbrew install perl-5.16.0 | |
Fetching perl-5.16.0 as /Users/barry/perl5/perlbrew/dists/perl-5.16.0.tar.gz | |
Installing /Users/barry/perl5/perlbrew/build/perl-5.16.0 into ~/perl5/perlbrew/perls/perl-5.16.0 | |
This could take a while. You can run the following command on another shell to track the status: | |
tail -f ~/perl5/perlbrew/build.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# see http://perl.plover.com/idiocy/Addition.pm by MJD | |
# | |
use 5.014; | |
use warnings; | |
{ | |
package Compute; | |
use Carp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
package AnotherPerson; | |
use Moose; | |
use namespace::autoclean; | |
has _firstname => (is => 'rw', isa => 'Str', accessor => 'firstname'); | |
has _lastname => (is => 'rw', isa => 'Str', accessor => 'lastname' ); | |
} | |
my $you = AnotherPerson->new; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arity := block ( | |
"You provided #{call argCount} args" interpolate println | |
call evalArgs foreach (arg, "... #{arg}" interpolate println) | |
) | |
// "call evalArgs" is a shortcut for "call message argsEvaluatedIn(call sender)" | |
var := "test" | |
arity call( "1", 2 + 2, var ); | |
arity call |