Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 Data.List | |
| -- checks if a list of points forms a square, by checking: | |
| -- * if |b - a| == |c - a|, | |
| -- * if 0 == (b - a) . (c - a), and | |
| -- * if a + (b - a) + (c - a) == d | |
| -- (a, b, c, d are sorted by distance from a) | |
| isSquare (a:as) = and [ | |
| mag2 (b - a) == mag2 (c - a), | |
| 0 == (b - a) `dot` (c - a), |
This file contains hidden or 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
| MS4wMzkzfHwxMzgyNDAyOTUxMjU3OzEzODI0MDI5NTEyNTc7MTM4MzI2OTI4MDY1NXwwMTExMDB8NDMwODUxMDU4MjI5Mzk5Ljk0OzMzOTIzODg3NTE1OTYxNzMuNTszNzc2MDszNTE7MjE0MDM1NTgyMTM2MTE3LjcyOzMwMjM7LTE7LTE7MDswOzA7MDswOy0xOzA7MzUxOzA7MHwyMDAsMjAwLDEyOTQ4Mzk3MjY4NjMsMDswLDEyNSwyNTk3MDQ2MzA3MDEsMDsxNTAsMTUwLDQ1ODQzNTQwOTUsMDsxMDAsMTAwLDExMzg3MzQ4NTM4LDA7MTAwLDEwMCw0MDU3OTUzNTU3NiwwOzAsMTAwLDY3NzYwMTE2NzM0LDA7MCwxMDAsMjA2NzM4NDY3NjEzLDA7ODAsMTAwLDQ5ODAwMzc3NzU4NjUsMDs2MCw3MSwyNTg5OTE4MzU2NTc4NSwwOzcyLDcyLDE5NjI5NjY2ODgzOTc3MSwwO3w0NTAzNTk5NjI3MzcwNDk1OzQ1MDM1OTk2MjczNzA0OTU7MjgxNDc0OTc2NzEwNjU1OTs0NTAzNTczNzQ4NjQ0MzUxOzIyNTM0ODM0Mzg4OTkxOTk7MTM3NDM4OTUzNDczfDQ1MDM1OTc1MTMzNzU3NDM7MjI1NDg0NTQ4MDE4OTk1MTsxMDI3%21END%21 |
This file contains hidden or 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
| static inline void draw_triangle(OILImage *im, OILImage *tex, OILVertex v0, OILVertex v1, OILVertex v2, OILTriangleFlags flags) { | |
| CPUPriv *priv = im->backend_data; | |
| /* ranges of pixels that are affected */ | |
| int xmin, xmax, ymin, ymax; | |
| /* the (signed) area of the triangle in normalized 2d space */ | |
| float area; | |
| /* constant coefficients for alpha, beta, gamma */ | |
| float a12, a20, a01; | |
| float b12, b20, b01; | |
| float c12, c20, c01; |
This file contains hidden or 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 Expression { | |
| Symbol(~str), | |
| Compound(~str, ~[Expression]) | |
| } | |
| fn standard_form(expr: &Expression) -> ~str { | |
| match (*expr) { | |
| Compound(~"List", ref items) => ~"list", | |
| Compound(~"Blank", []) => ~"_", |
This file contains hidden or 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
| use std::util::Void; | |
| use std::ptr; | |
| type Type1 = Void; | |
| struct Type2; | |
| fn main() { | |
| let mut t1 : *Type1 = ptr::null(); | |
| let mut t2 : *Type2 = ptr::null(); | |
This file contains hidden or 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
| #[feature(macro_rules)]; | |
| use std::str; | |
| use std::io; | |
| use std::vec; | |
| // shim because Trait::<for T>::foo isn't implemented yet | |
| fn hintfunc<T>(x: T) -> T { x } | |
| macro_rules! hint( | |
| ($e:expr :: $t:ty) => (hintfunc::<$t>($e)) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import sys | |
| import time | |
| try: | |
| _, iface = sys.argv | |
| except ValueError: | |
| print("usage: {} [iface]".format(sys.argv[0])) | |
| sys.exit(1) |
This file contains hidden or 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
| #[feature(macro_rules)]; | |
| use std::fmt; | |
| use std::ops; | |
| /////////////////////////////////////// | |
| ////////// Basic Definitions ////////// | |
| /////////////////////////////////////// | |
| // Zero numeral, and a Successor operator |
This file contains hidden or 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
| ; lisp source file | |
| (defun incr (x) | |
| (+ x 1)) | |
| (defun main () | |
| (incr 42)) |