Skip to content

Instantly share code, notes, and snippets.

@masak
Created August 24, 2010 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/548328 to your computer and use it in GitHub Desktop.
Save masak/548328 to your computer and use it in GitHub Desktop.
use Remember;
todo {
remember "to buy milk";
remember "to make toys for my pet dragons";
remember "to stop by the gen-eng shop and pick up the 10 foot butterfly";
}
remember "to only remember things in todo blocks"; # warn: can't remember outside todo
.say for todo-list() # milk, toys, butterfly
# ... and this is all the module code that's needed:
module Remember;
my @todo-list;
sub todo-list() is export { @todo-list }
sub remember(*@_) is export {
try {
&*remember(@_);
}
if $! {
warn "Can't remember outside of todo";
}
}
sub todo(&code) is export {
my &*remember = -> *@_ { push @todo-list, [~] @_ };
&code();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment