Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
my $letters = shift or die "Specify letters";
my @letters = split //, $letters;
my $size = shift or die "Specify count";
open(DICT, "</usr/share/dict/words");
my $words = {};
#!/usr/bin/perl
use strict;
use warnings;
my $dictionary = "/usr/share/dict/words";
open DICTIONARY, "<$dictionary" or die "$!";
my $map = {};
while(my $word = <DICTIONARY>){
chomp $word;
@emacdona
emacdona / Main.java
Created June 23, 2011 13:13
Compound Interest and Rounding
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Main{
private static Transformer<BigDecimal> floor = new BigDecToDiscreteViaFloor();
private static Transformer<BigDecimal> ceil = new BigDecToDiscreteViaCeil();
private static Transformer<BigDecimal> round = new BigDecToDiscreteViaRound();
private static Transformer<BigDecimal> i = new BigDecIdentity();
#!/opt/local/bin/perl -w
use strict;
our($fac0, $fac1, $fac2); #keep "use strict" happy
my $num = shift;
#Take 0
#Everyone's first implementation of factorial (except using function
#pointers instead of functions). Get used to function pointers; I'll be using