Skip to content

Instantly share code, notes, and snippets.

@mturjak
Created January 25, 2014 10:38
Show Gist options
  • Select an option

  • Save mturjak/8614579 to your computer and use it in GitHub Desktop.

Select an option

Save mturjak/8614579 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$a: 1 2 3 4;
$b: 2 3 4;
@function matrix($a, $b) {
$c: ();
@each $i in $a {
$c: append( $c, if(
type-of($b)=="list",
matrix($b, $i),
$i * $b
));
}
@return $c;
}
// matrix test print
@mixin print_matrix($m) {
#matrix-test {
@for $i from 1 through length($m) {
l#{$i}: nth($m,$i);
}
}
}
$c: matrix($a, $b);
@include print_matrix($c);
#matrix-test {
l1: 2 3 4;
l2: 4 6 8;
l3: 6 9 12;
l4: 8 12 16;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment