Kurt StephensNerd Up! | ||
|
Kurt on Sun, 2006-10-22 22:26.
Data Transform Programming Style is somewhere between imperative and functional programming. Data representations flow towards the desired result, from least expressive to most expressive. This allows greater reuse of code on multiple data representations, greater locality of intent and more literal coding. The nested nature of functional application is flattened into an imperative style that reads more like pseudo-code, while retaining functional elements. Imagine a Perl program that takes a list of URIs and turns them into HTML <a href> tags:
# Imperative Example 1:
sub format_uri_as_html
{
my ($uri) = @_;
$uri = qq{<a href="$uri">$uri</a>};
$uri;
}
my $uris = [
'http://kurtstephens.com',
'http://google.com',
'http://digg.com',
];
print map(format_uri_as_html($_) . "\n", @$uris);
Simple imperative programming; we side-effect Now requirements change… Reply |
||
Recent comments
22 hours 23 min ago
2 days 10 hours ago
3 days 5 hours ago
3 days 18 hours ago
5 days 8 hours ago
5 days 11 hours ago
1 week 13 hours ago
1 week 1 day ago
1 week 2 days ago
3 weeks 19 hours ago