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
{------------------------------------------------ | |
A Haskell solution to: http://www.coinheist.com/rubik/a_regular_crossword/grid.pdf | |
using the Z3 SMT solver. | |
Z3 finds the following solution in about 7 mins | |
on my Mac Core-i5, and another 7 mins to prove | |
it's unique. | |
NHPEHAS | |
DIOMOMTH |
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
// Copyright (C) 2012 Benoit Sigoure | |
// Copyright (C) 2012 StumbleUpon, Inc. | |
// This library is free software: you can redistribute it and/or modify it | |
// under the terms of the GNU Lesser General Public License as published by | |
// the Free Software Foundation, either version 2.1 of the License, or (at your | |
// option) any later version. This program is distributed in the hope that it | |
// will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | |
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | |
// General Public License for more details. You should have received a copy | |
// of the GNU Lesser General Public License along with this program. If not, |
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
import io | |
import numpy as np | |
from PIL import Image | |
import tensorflow as tf | |
class Tensorboard: | |
def __init__(self, logdir): | |
self.writer = tf.summary.FileWriter(logdir) | |
def close(self): |
The Y Combinator is a classic lambda calculus construct that many people find baffling. Here's my attempt to explain it as clearly as possible (no promises!). Familiarity with Haskell syntax is assumed.
The problem we're trying to solve is how to write an anonymous function (a "lambda") that is recursive. Normally, if you want to write a recursive function, it looks like this:
fac n = if n == 0 then 1
else n * fac (n-1)