import Prelude hiding (take)
import Test.QuickCheck
take :: Int -> [a] -> [a]
take _ [] = []
take 0 _ = []
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We actually need more words, as entropy of the words is less than characters. | |
Suppose there is about 50000 words (There is 301 000 main entries in OED). | |
Than | |
50000^x > 94^13 => x => 5.5 | |
So i would say that | |
"balloons are very nice" < "@$XsBv2JMc473" | |
Also entropy of word like "are" is almost zero, so predictable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// works with clang++ bundled with xcode 4.4 | |
// clang++ -std=c++11 -stdlib=libc++ maybe.cc -o maybe | |
#include <iostream> | |
#include <utility> | |
// didn't realize how to make this a class to hide members | |
template <typename T> | |
struct maybe { | |
// private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
110 viikkovisa #1 | |
--------------------------- | |
Piirretään ruutupaperille numeroita myötäpäivään "ympyrään" alkaen vasemmasta yläkulmasta: | |
1 | |
... | |
1 2 | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Theorem plus_comm : forall (n m : nat), | |
n + m = m + n. | |
Proof. | |
intros n. induction n as [| n']. | |
(* case n = 0 *) | |
intros m. rewrite <- plus_n_O. rewrite -> plus_O_n. trivial. | |
(* case n = S n' *) | |
intros m. rewrite <- plus_n_Sm. rewrite -> plus_Sn_m. | |
apply eq_S. apply IHn'. Qed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Export Poly. | |
Inductive pal {X:Type} : list X -> Prop := | |
| pal_nil : pal nil | |
| pal_singleton : forall x:X, pal [x] | |
| pal_cons_snoc : forall (x:X) (l : list X), pal l -> pal (x :: snoc l x). | |
Inductive lrevl {X:Type} : list X -> Prop := | |
| pal_lrevl : forall (l : list X), l = rev l -> lrevl l. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Docopt where | |
import System.Environment (getArgs) | |
import Regexp | |
data DocoptResult = DocoptCommand Bool | |
| DocoptPositionalArg (Maybe String) | |
| DocoptRepatableArg [String] | |
| DocoptFlag Bool |
% cat test2.py
"""
Usage:
test2.py [options] <file>...
Options:
% cat tar.py
"""
Usage:
tar [-c] [options] <files>...
tar [-r | -u] -f ARCHIEVE [options] <files>...
tar [-t | -x] [options] [...]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using moreUsable.js style | |
indexedDB.open(DBNAME, DBVERSION, DBSCHEMA) | |
.then(function(connection) { | |
return connection.transaction(["table1"]) // undefined -> readonly, state undefined also | |
.then(function(obj) { | |
return obj.transaction.get(obj.state, "table1", "foo"); | |
}) | |
.then(function(obj) { | |
return obj.state; | |
}); |
OlderNewer