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
Here is a section of a message I sent to Francois-Regis Sinot regarding his paper | |
Complete Laziness: A Natural Semantics | |
http://www.lsv.ens-cachan.fr/Publis/PAPERS/PDF/sinot-wrs07.pdf | |
--------------- | |
I have simplified the problem down to this expression: | |
(\z. (\x. \y. x) (\w. z)) I I I | |
Where I is the identity function. Preprocessing, this translates to (with some manual simplifications): |
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
struct Thunk<'a, T> { | |
f : ~fn() -> & 'a T | |
} |
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
enum ThunkData<T> { | |
Val (T), | |
Fun (~fn() -> T) | |
} | |
struct Thunk<T> { | |
thunkData: ThunkData<T> | |
} | |
impl<T : Clone> Thunk<T> { |
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
ncInq :: NCID -> IO (Int, Int, Int, Int) | |
ncInq ncid = | |
alloca $ \ndims_ptr -> | |
alloca $ \nvars_ptr -> | |
alloca $ \natts_ptr -> | |
alloca $ \unlimdimid_ptr -> do | |
status <- nc_inq ncid ndims_ptr nvars_ptr natts_ptr unlimdimid_ptr | |
ndims <- peek ndims_ptr | |
nvars <- peek nvars_ptr | |
natts <- peek natts_ptr |
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
ncInq :: NCID -> IO (Int, Int, Int, Int) | |
ncInq ncid = do | |
alloca $ \ndims_ptr -> do | |
alloca $ \nvars_ptr -> do | |
alloca $ \natts_ptr -> do | |
alloca $ \unlimdimid_ptr -> do | |
status <- nc_inq ncid ndims_ptr nvars_ptr natts_ptr unlimdimid_ptr | |
ndims <- peek ndims_ptr | |
nvars <- peek nvars_ptr | |
natts <- peek natts_ptr |
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
# cat packages | xargs apt-get install | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
The following package was automatically installed and is no longer required: | |
libgmp3-dev | |
Use 'apt-get autoremove' to remove them. | |
The following extra packages will be installed: | |
libgmp-dev libgmp10 libgmp3-dev libgmpxx4ldbl zlib1g-dev | |
Suggested packages: |
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
data NumTree a b = NumNode (a, b) (Maybe [NumTree a b]) | |
| NumNil | |
deriving (Eq, Show) | |
data Tree a = Node a (Maybe [Tree a]) | |
| Nil | |
deriving (Eq, Show) | |
numberTree :: Tree a -> State Int (NumTree Int a) | |
numberTree Nil = return NumNil |
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-A-A | |
-A-A- | |
B-B-B | |
-B-B- | |
1-1-1 | |
-3-3- | |
2-3-2 | |
-1-1- |
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
1. Map each ant to the number of ants it's fighting. | |
2. For each number, keep it only if all of its opposing neighbors are larger. | |
Example: | |
A A A - | |
A B C D | |
A1 A2 A3 -- | |
A1 B3 C2 D1 |
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
+-------+-------+ | |
| | | | |
| A1-> | <-B | | |
| | | | |
+-------+-------+ | |
| ^ | | | |
| A2 | | | |
| | | | |
+-------+-------+ |
NewerOlder