- Create a
Species
model with justid
andname
columns - Create a
Mon
model inheriting fromAccount
with just additionalowner
andspecies
relationships- Create a migration which adds a
type
column defaulting to "Account" to theaccounts
table - Add a validation to
Mon
requiring that theuser
benil
.
- Create a migration which adds a
- Add a validation to
Mon
requiring that theowner
must not be aMon
.
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
int main(int argc, char **argv) { | |
foo_error error; | |
foo_bar bar; | |
error_init(&error); | |
if (!foo_init(&error)) | |
goto foo_init_error; | |
if (!foo_bar_init(&bar, "baz", &error)) |
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 v6; | |
sub with-attributes ($obj, *&callback) { | |
my %slot-values; | |
for &callback.signature.params -> $param { | |
my $slot = $param.name.substr(1); | |
%slot-values{$slot} = $obj."$slot"(); | |
} | |
callback |%slot-values; | |
} |
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
Copyright 2010. <SOMETHING> | |
This module is free software; you can | |
redistribute it and/or modify it under the terms of the Artistic | |
License 2.0. For details, see the full text of the license in the file | |
LICENSE. | |
This program is distributed in the hope that it will be useful, but it | |
is provided “as is” and without any express or implied warranties. For | |
details, see the full text of the license in the file LICENSE. |
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
(define (fib n k) | |
(cps-if (= n 1) | |
(lambda () ; base case | |
(k 1)) | |
(lambda () ; non-base case | |
(fib (- n 1) | |
(lambda (fib-n-1) | |
(fib (- n 2) | |
(lambda (fib-n-2) | |
(k (+ fib-n-1 fib-n-2))))))))) |
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 v6; | |
my $xml = ' | |
<test>test</test> | |
<hat test="20"> hat text here </hat> | |
<shoe> | |
<test>asdf</test> | |
<test>asdf2</test> | |
<test>asdf3</test> | |
<test>asdf4</test> |
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
%obj = type opaque* | |
declare void @bennu_init() | |
declare %obj @bennu_int_new (i32) | |
declare %obj @bennu_say (%obj) | |
define i32 @main () { | |
call void @bennu_init() | |
%__local_0 = call %obj @bennu_int_new(i32 42) | |
%a = %obj %__local_0 | |
%__local_1 = %obj %a |
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
declare i32 @printf (i8*, ...) | |
@INTPRINTF = internal constant [4 x i8] c"%d\0A\00" | |
define i32 @main () { | |
%__local_0 = add i32 0, 42 | |
%__temp_0 = getelementptr [04 x i8]* @INTPRINTF, i64 0, i64 0 | |
call i32 (i8, ...)* @printf(i8* %__temp_0, i32 %__local_0) | |
ret i32 0 | |
} |
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
What I did: | |
All of the following except where specified otherwise are referring to the gsoc_past_optimization branch. | |
* Implemented capturing of child and attribute sub-patterns of PAST::Patterns. | |
* Added .match and .subst methods to PAST::Node when PAST/Pattern.pbc is loaded. | |
* Implemented :g/:global and :p/:pos attributes for matching PAST::Patterns. |
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
role FoldArithmetic::Actions does PAST::Optimization::Actions { | |
method foldAdd($/) { | |
my ($left, $right) := $<PAST::Val>; | |
my $result := PAST::Val.new(:value(pir::add($left.value(), $right.value()))); | |
make $result; | |
} | |
} |