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
| import java.util.Random; | |
| public class GC { | |
| static class Foo { | |
| byte[] raw; | |
| public Foo(int n) { | |
| raw = new byte[n]; | |
| } | |
| } |
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
| #include <stdio.h> | |
| char foo() | |
| { | |
| return 'x'; | |
| } | |
| char bar() | |
| { | |
| return 'y'; |
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
| combinations :: [a] -> [[a]] | |
| combinations [] = [[]] | |
| combinations (x:xs) = concat [[t, (x:t)] | t <- combinations xs] |
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
| isPalindrome :: String -> Bool | |
| isPalindrome str = isPalindrome' str [] (len `div` 2) | |
| where | |
| len = length str | |
| isPalindrome' [] _ _ = True | |
| isPalindrome' xs ys 0 = if len `mod` 2 == 0 then xs == ys else (tail xs) == ys | |
| isPalindrome' (x:xs) ys n = isPalindrome' xs (x:ys) (n - 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
| #include <stdio.h> | |
| #include <mysql_version.h> | |
| #include <mysql/plugin.h> | |
| struct st_mysql_daemon hello_daemon_plugin = | |
| { MYSQL_DAEMON_INTERFACE_VERSION }; | |
| static FILE *fp; | |
| int hello_daemon_plugin_init(void *p) |
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
| (define (make-interval a b) (cons a b)) | |
| (define (upper-bound r) (max (car r) (cdr r))) | |
| (define (lower-bound r) (min (car r) (cdr r))) | |
| (define (mul-interval x y) | |
| (define (cross-zero? a b) | |
| (and (<= a 0) (>= b 0))) | |
| (let ((a (lower-bound x)) |
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 strict; | |
| use warnings; | |
| use Data::Dump qw(dump); | |
| use Regexp::Assemble; | |
| my $regexp1 = Regexp::Assemble->new; | |
| $regexp1->track; | |
| $regexp1->add('foo.*'); | |
| $regexp1->add('bar.*'); |
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 Vector; | |
| use strict; | |
| use warnings; | |
| use List::Util qw(sum); | |
| use List::MoreUtils qw(pairwise); | |
| our ($a, $b); | |
| sub new { | |
| my ($class, $data) = @_; |
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 strict; | |
| use warnings; | |
| use Benchmark qw/cmpthese/; | |
| sub ret_by_value { | |
| my $n = shift; | |
| my @seq = (0..$n); | |
| return @seq; | |
| } |
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 Foo; | |
| use 5.010; | |
| use strict; | |
| use warnings; | |
| sub TIESCALAR { | |
| my $class = shift; | |
| bless \(my $init = "initial value"), $class; | |
| } |
NewerOlder