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 gl.gl; | |
enum : uint | |
{ | |
MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83, | |
ONE_MINUS_SRC_ALPHA = 0x0303, | |
STENCIL_BACK_FUNC = 0x8800, | |
AND_REVERSE = 0x1502, | |
.... | |
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 std.stdio; | |
class Foo | |
{ | |
void foo() { writeln("foo1"); } | |
void foo() { writeln("foo2"); } | |
void bar() { writeln("bar"); } | |
}; | |
int main() |
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
(defmacro matchfn | |
"Compiles a pattern match to a lambda that matches against it's parameters. | |
Patterns are analyzed and if no pattern contains varargs (&) then patterns will be split in to | |
different fn aritity overloads. If & is present in one or more patterns all arguments are captured | |
in to args seq and matching is done on it as ([pattern] :seq)." | |
[& body] | |
(let [fname (if (symbol? (first body)) (first body) nil) | |
cases (if fname (rest body) body) | |
pattern-expression (partition 2 cases) | |
pattern-varargs (some (fn [[pattern _]] (when-not (= :else pattern) (some (partial = '&) pattern))) pattern-expression)] |
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
(ns test) | |
(defn foo [a] | |
{:pre [(> a 2)]} | |
(println a)) | |
(binding [*assert* false] | |
(println *assert*) | |
(foo 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
=> (defmacro locking-read | |
"Utility to lock a readLock from the read-write lock provided and put body part in a try expression body where | |
finally unlocks the lock." | |
[rwlock & body] | |
`(let [readlock (.readLock ~rwlock)] | |
(.lock readlock) | |
(try | |
(do ~body) | |
(finally (.unlock rwlock))))) |
NewerOlder