Skip to content

Instantly share code, notes, and snippets.

View moritz's full-sized avatar

Moritz Lenz moritz

View GitHub Profile
#!perl6
class For { }
class If {
has $.value;
method perl { "If.new($.value)" }
method Str { "<MANGLED_IF $.value>" }
void pseudo_sparse_solve(const eslu * const slu,
const esm &rhs,
esm &result,
const bool adjoint = false) {
assert( rhs.cols() == rhs.rows() );
int n = rhs.cols();
ers setter(result);
Eigen::VectorXcd *invCol = new Eigen::VectorXcd(n);
int transpose_flag;
use strict;
use warnings;
use 5.010;
use MIME::Lite;
my $prev = '8b643d6119fd9e4a460e6ec12711fa347207a0ec';
if (-e 'previous_mail_hash') {
$prev = `cat previous_mail_hash`;
chomp $prev;
use Test::More tests => 27;
use strict;
use warnings;
{
my ($x, $y);
$x := $y;
ok !defined($x), 'scalar binding leaves LHS undef';
ok !defined($y), 'scalar binding leaves RHS undef';
diff --git a/src/core/Cool-str.pm b/src/core/Cool-str.pm
index a045cd4..e231260 100644
--- a/src/core/Cool-str.pm
+++ b/src/core/Cool-str.pm
@@ -28,8 +28,19 @@ augment class Cool {
return self if @matches == 1 && !@matches[0];
my $prev = 0;
my $result = '';
+ my $caller_pad = Q:PIR{
+ $P0 = getinterp
@moritz
moritz / match-pretty.pl
Created January 7, 2011 20:39
Match.pretty output
grammar Color {
regex blue { :i "blue" }
regex green { :i "green" }
regex TOP { [<blue> | <green>] <rest> }
token rest { ' ' <alpha>+ }
}
my $match = Color.parse("Blue skies");
say $match.pretty;
@moritz
moritz / gist:773366
Created January 10, 2011 20:10
a new (non-spec) debugging feature for rakudo
./perl6 -e 'use STATEMENT_PRINT; say rand'
use STATEMENT_PRINT
say rand
0.458330045777501
@moritz
moritz / gist:798909
Created January 27, 2011 18:04
test
href="/raw$(echo b0rked)test"
@moritz
moritz / named-sprintf.pl
Created February 26, 2011 20:58
Named arguments for sprintf
# inspired by python's infix %
# see for example http://www.korokithakis.net/tutorials/python
sub named-sprintf(Str $format, *%args) {
my @args;
my $f = $format.subst(:g,
rx{ '%(' (\w+) ')' },
-> $/ { @args.push: %args{$0}; '%' }
);
sprintf $f, @args;
@moritz
moritz / gist:860081
Created March 8, 2011 09:27
nqp build, branch ctmo
moritz@jacq:~/p6/nqp>make
/home/moritz/p6/nqp/parrot_install/bin/parrot -o Regex.pbc src/Regex.pir src/Regex/constants.pir src/Regex/Cursor.pir src/Regex/Cursor-builtins.pir src/Regex/Cursor-protoregex-peek.pir src/Regex/Match.pir src/Regex/Method.pir src/Regex/Dumper.pir src/PAST/Regex.pir src/PAST/Compiler-Regex.pir
nqplexinfo.c:101: failed assertion 'PObj_constant_TEST(_self)'
Backtrace - Obtained 18 stack frames (max trace depth is 32).
/home/moritz/p6/nqp/parrot_install/lib/libparrot.so.3.0.0(+0x18bf8f) [0x2aae54e76f8f]
/home/moritz/p6/nqp/parrot_install/lib/libparrot.so.3.0.0(Parrot_confess+0x8b) [0x2aae54e76f5b]
dynext/nqp_group.so(+0xdfa7) [0x2aae58a7dfa7]
/home/moritz/p6/nqp/parrot_install/lib/libparrot.so.3.0.0(+0x305d4b) [0x2aae54ff0d4b]
/home/moritz/p6/nqp/parrot_install/lib/libparrot.so.3.0.0(+0x306906) [0x2aae54ff1906]
/home/moritz/p6/nqp/parrot_install/lib/libparrot.so.3.0.0(+0x3088b5) [0x2aae54ff38b5]