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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function square($x) { | |
$squared: $x * $x; | |
@return $squared; | |
} |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
p { | |
$color: red; | |
color: $color; | |
} | |
/* #{$color} */ |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
$names: Jim Sandy Clem; | |
@each $name in $names { | |
/* Hi, I am #{$name}. */ | |
$most-recent-name: $name; | |
} |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function f-fold($func, $list, $initial, $args...) { | |
$start: 1; | |
@if $initial == null { | |
// If there's no initial value, use the first in the list. | |
$start: 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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function f-fold($func, $prev, $list, $args...) { | |
@each $item in $list { | |
$prev: call($func, $prev, $item, $args...); | |
} | |
@return $prev; |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function f-apply($func, $list, $args...) { | |
$new-list: (); | |
@each $item in $list { | |
$new-list: append($new-list, call($func, $item, $args...)); | |
} |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function f-fold($func, $list, $initial, $args...) { | |
$start: 1; | |
@if $initial == null { | |
// If there's no initial value, use the first in the list. | |
$start: 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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
// Filter items from a list. Each function takes an item (and additional | |
// arguments) and returns a boolean value indicating whether the item passed the | |
// filter. | |
@function f-filter($func, $list, $args...) { | |
$new-list: (); |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
// 'map', 'transform', 'select', or 'project' function. Iterate over a list, | |
// performing a function on each item, and collecting the new items. Each | |
// function takes an item as a first argument and returns a transformed item. | |
// You can pass additional arguments to the function too, which is a decent poor | |
// man's function composition. |
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
// 'map', 'transform', 'select', or 'project' function. Iterate over a list, | |
// performing a function on each item, and collecting the new items. Each | |
// function takes an item as a first argument and returns a transformed item. | |
// You can pass additional arguments to the function too, which is a decent poor | |
// man's function composition. | |
// (I didn't call this f-map because the term 'map' is already used in Sass to | |
// denote a hash or dictionary.) | |
@function f-apply($func, $list, $args...) { | |
$new-list: (); | |
@each $item in $list { |