Some of my projects have 3-component version numbers. Others have 4-component version numbers. Be aware that the meaning of these two kinds of version numbers differ.
0.0.0
| | |
(declare-fun a () Int) | |
(declare-fun b () Int) | |
(declare-fun c () Int) | |
;; (assert (= a (div -7 -3))) | |
;; (assert (= b (div 7 -3))) | |
;; (assert (= c (div -7 3))) | |
;; (assert (= a (mod -7 -3))) | |
;; (assert (= b (mod 7 -3))) | |
;; (assert (= c (mod -7 3))) |
// stat.c | |
// | |
// TO RUN: cc -Wall stat.c && ./a.out | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> |
TIMEUNIT_MICROSECOND = 0 | |
TIMEUNIT_SECOND = 1 | |
TIMEUNIT_MINUTE = 2 | |
TIMEUNIT_HOUR = 3 | |
TIMEUNIT_DAY = 4 | |
TIMEUNIT_MONTH = 5 | |
TIMEUNIT_YEAR = 6 | |
def round_datetime(timeunit): | |
'''Round the given time downward to some unit of time. For example: |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C | |
data Vec a = Vec { vecx, vecy, vecz :: !a } | |
instance Functor Vec where | |
fmap f (Vec x y z) = Vec (f x) (f y) (f z) | |
instance Applicative Vec where | |
pure x = Vec x x x |
Type classes are rather fragile: it's really hard to make changes to a type class once because it can often break code downstream.
Type classes are in a sense like implicit parameters, with the additional constraint of coherency. If we think of them as such, then defining an instance such as
instance Monad Maybe where
(>>=) = …
I hereby claim:
To claim this, I am signing this object:
0 | |
o\ | |
=0\ | |
-+-0 | |
d=''' | |
KAkAAA | |
BzCwAAA | |
E1BU1RFU | |
k1JTkQKcx | |
EAAABFbnRl |