|
aaronla
|
|
codepad
|
|
|
aaronla
|
Saved pastes by aaronla:
using System;
using System.Runtime.InteropServices;
using System.Drawing;
namespace ConsoleApplication1
|
| view (46 lines) |
# simplified monadic packrat (almost CFG) parser
# derived from parse6.py, added (lazy) backtracking
#
# parser :: str -> [ (value, str) ]
class lcons (object):
|
| view (140 lines, 22 lines of output) |
# simplified monadic (PEG) parser. no memoization, some backtracking.
# parser :: str -> maybe (value, str)
def ret (value):
return lambda s: (value, s)
|
| view (98 lines, 16 lines of output) |
from parse import *
from test1 import timeit
def group(p):
return p % (lambda v: ('group', v))
|
| view (31 lines) |
# first, some boilerplate
class Seq:
def __init__(self, defer):
self._defer = defer
def force(self):
|
| view (53 lines, 6 lines of output) |
# first, some boilerplate
class Seq:
def __init__(self, defer):
self._defer = defer
def force(self):
|
| view (56 lines, 6 lines of output) |
#include <iostream>
template <typename T> struct Base {
void f(int) {
std::cout << "Base<T>::f\n";
|
| view (23 lines, 1 line of output) |
#include <iostream>
template <typename T> struct Base {
void f(int) {
std::cout << "Base<T>::f\n";
|
| view (23 lines, 2 lines of output) |
typedef int HRESULT ;
bool SUCCEEDED(HRESULT x){return(x)>=0;}
HRESULT f(){return 0;}
#define g f
#define h f
|
| view (38 lines) |
// in reference to http://hbfs.wordpress.com/2011/08/09/programming-challenge-luminance/
#include <iostream>
#include <iomanip>
using namespace std;
|
| view (66 lines, 2 lines of output) |
#! python
# digraph.txt used: http://jnicholl.org/Cryptanalysis/Data/DigramFrequencies.php
import math
|
| view (42 lines, 4 lines of output) |
;; QR card for scheme
;; (c) 2011 Aaron Lahman
;; r5rs load module
(load {filename-string})
|
| view (152 lines) |
def adds_dynamic_z_decorator(f):
def replacement(*arg,**karg):
# create a new 'z' binding in globals, saving previous
if 'z' in globals():
oldZ = (globals()['z'],)
|
| view (42 lines, 9 lines of output) |
/// answer to question on blog post
/// http://eli.thegreenplace.net/2008/12/22/an-rc-circuit-puzzle/
///
/// From the exercise, Eli said "But the current through the capacitor
/// and resistor is the same current". I'm not sure where you get this
|
| view (11 lines) |
struct to_listoftuples
{
template <class OuterContainerType>
static PyObject* convert(OuterContainerType const& a)
|
| view (18 lines) |
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
template <class It>
|
| view (28 lines, 1 line of output) |
#include <iostream>
#include <iomanip>
#include <set>
#include <algorithm>
#include <iterator>
|
| view (40 lines, 5 lines of output) |
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <iterator>
|
| view (40 lines, 5 lines of output) |
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
using namespace std;
|
| view (25 lines, 5 lines of output) |
#include <iostream>
#include <iomanip>
#include <iterator>
#include <vector>
using namespace std;
|
| view (25 lines, 5 lines of output) |
#include <iostream>
using namespace std;
template <int I, bool Fizz = !(I % 3), bool Buzz = !(I % 5)> struct number {};
template <int I> void fizzbuzz(number<I, false, false>){ cout << I << "\n"; }
template <int I> void fizzbuzz(number<I, true, false>){ cout << "Fizz\n"; }
|
| view (21 lines, 100 lines of output) |