Skip to content

Instantly share code, notes, and snippets.

View metaperl's full-sized avatar

Structure and Interpretation of Computer Programs metaperl

View GitHub Profile
my @product = qw(
WSDOMREGUS
WSDOMREGTO
WSDOMREGORGNZ
WSDOMREGORGAU
WSDOMREGORG
WSDOMREGNETNZ
WSDOMREGNET
WSDOMREGMOBI
WSDOMREGINFO
myflat([],[]).
myflat([H|T], AllFlat) :- is_list(H), myflat(H, HFlat), myflat(T, TFlat), append(HFlat, TFlat, AllFlat).
myflat([H|T], [H|TFlat]) :- myflat(T,TFlat).
We couldn’t find that file to show.
compress([],[]).
compress([X],[X]).
compress([X,X|T], Result) :- compress([X|T], Result).
compress([X,Y|T], [X|Rest]) :- compress([Y|T], Rest).
@metaperl
metaperl / renesys challenge
Created August 28, 2010 14:54
renesys challenge
wget http://www.renesys.com/challenge_site/static/data/no_zealand.txt.bz2
bzip2 -d no_zealand.txt.bz2
# http://www.renesys.com/challenge_site
CREATE TABLE IF NOT EXISTS ipnos (
ip varchar(40) default NULL,
source varchar(40) NOT NULL,
country varchar(4) default NULL,
region varchar(40) default NULL,
{
my $acct_code = $self->get_domreg_account_code;
$acct_code =~ s/REG/NEW/; # ENH27417
# Populate billing structure
my $product =
{
virtkey => $self->get_name,
length => $args->{length},
acct_code => $acct_code
#!/usr/bin/perl
# appease songbird
use strict;
use warnings;
while (my $filename = <STDIN>) {
chomp $filename;
@metaperl
metaperl / gchords.sty
Created November 23, 2010 08:55
the gchords style file
%
% GCHORDS, a LaTeX2e package to draw guitar chord diagrams.
%
% $Id: gchords.sty,v 1.20 2009/02/04 20:25:59 peekas Exp $
%
% Copyright (C) 2001-2009 Kasper Peeters <[email protected]>
% Available under the GNU General Public License.
%
% - minor additions by D. R. Lovell, 05-nov-1998
% - bug fixes by Yotam Medini <[email protected]>, 11-aug-2001
% http://sites.google.com/site/prologsite/prolog-problems/1
% working on 1.08
compress([], []).
compress([X,Y], [X,Y]) :- X /= Y.
compress([X,Y], [X]) :- X = Y.
% problems writing other clauses
% http://sites.google.com/site/prologsite/prolog-problems/1
% working on 1.08
compress([], []).
compress([X,Y], [X,Y]) :- X /= Y.
compress([X,Y], [X]) :- X = Y.
% problems writing other clauses