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
### Keybase proof | |
I hereby claim: | |
* I am ashutoshmehra on github. | |
* I am ashutoshmehra (https://keybase.io/ashutoshmehra) on keybase. | |
* I have a public key whose fingerprint is 366E 3FD5 75AC 22ED 9F5C 585D BB39 438B E008 71D6 | |
To claim this, I am signing this object: |
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
-- Peter Norvig's beautiful Python program (http://norvig.com/sudoku.html) | |
-- that uses constraint propagation (and ultimately searching) | |
-- to solve Sudoku instances | |
-- | |
-- Now in everybody's favorite language! | |
-- Haskell coding by Ashutosh Mehra (http://ashutoshmehra.net/blog/) | |
import List (elem, nub, filter, delete, intersperse, replicate) | |
import Data.Map (Map, fromList, (!), insert, keys, elems, toList) | |
import Data.List (intercalate) |
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
/* Solves the puzzle: Puzzle: recursive postfix evaluation. | |
Ref: http://rgrig.blogspot.com/2009/03/postfix-expressions.html | |
*/ | |
#include <stdio.h> | |
#define F 0x40 | |
char eval(int * pr) { | |
char ch; | |
int val; | |
switch((ch = getchar())) { |
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
(setq-default c-basic-offset 2) | |
(setq-default indent-tabs-mode nil) |
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
(dir-locals-set-class-variables | |
'beautiful-code | |
'((c++-mode . ((c-basic-offset . 8) | |
(tab-width . 8) | |
(indent-tabs-mode . t))))) | |
(dir-locals-set-directory-class | |
"d:/work/BeautifulCode/" 'beautiful-code) |
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
-- Code from: http://blog.unsafeperformio.com/?p=34 | |
module Main where | |
import GHC.Exts | |
type Nat = Int | |
memo :: (Nat -> Integer) -> [Integer] | |
memo f = map f [0..] | |
apply :: [Integer] -> (Nat -> Integer) | |
apply xs n = xs !! n |