This file contains 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 strict; | |
use warnings; | |
sub my_map (&@) { | |
my $code = shift; | |
my @array; | |
for (@_) { | |
local $_ = $_; | |
push @array, $code->(); | |
} |
This file contains 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 strict; | |
use warnings; | |
sub my_map (&@) { | |
my $code = shift; | |
my @array; | |
for (@_) { | |
local $_ = $_; | |
push @array, $code->(); | |
} |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Encode qw( encode ); | |
use FileHandle; | |
use Getopt::Long; | |
use Perl6::Say; | |
use Pod::Usage; |
This file contains 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 util.stream) | |
; ストリームの負数番目を取ると死ねる(GCが落ちる) | |
(define fib | |
(stream-cons 0 | |
(stream-cons 1 | |
(stream-map + fib (stream-cdr fib))))) | |
; ------------------------------------------------ |
This file contains 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 srfi-1) | |
; flat-list tree | |
(define (flat-list tree) | |
(cond | |
[(null? tree) '()] | |
[(list? (car tree)) | |
(append (flat-list (car tree)) (flat-list (cdr tree)))] | |
[else (cons (car tree) (flat-list (cdr tree)))])) |
This file contains 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 srfi-1) | |
(use gauche.test) | |
;; return values of pair keywords and single keywords. | |
(define (pairs&singles lis) | |
(define (loop lis pairs singles) | |
(if (null? (cdr lis)) | |
(if (and (pair? lis) (keyword? (car lis))) | |
(values (filter (lambda (elt) (not (eq? (car lis) elt))) |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
{ | |
local $SIG{__WARN__} = sub { | |
my $errmsg = shift; |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Perl6::Say; | |
BEGIN { | |
say 'one'; | |
} |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Perl6::Say; | |
sub a2 { | |
{ package DB; () = caller 1 } |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use constant { | |
MAX_TERM_WIDTH => 42 | |
}; | |
use Win32::Die; | |
use Win32::Process; |
OlderNewer