Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on How Ruby Borrowed a Decades Old Idea From Lisp. Parent comment
PS. Here's an example of creating something similar with Perl:
sub IF (&@) { my ($block, $flow) = @_; [ map { $flow->{$_} || sub {} } qw/else then/ ]->[ $block->() ]->(); } sub THEN (&@) { my $block = shift; my $flow = shift || {}; $flow->{then} = $block; $flow; } sub ELSE (&) { my $block = shift; +{ else => $block }; } IF { 1 == 0 } THEN { say "True" } ELSE { say "False" };
my $result = IF { 1 == 1 } THEN { "True" } ELSE { "False" };
There are no comments on this comment yet.
PS. Here's an example of creating something similar with Perl:
And with these being functions and not statements we can also do: