View triangle.rs
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
#[allow(unused_imports)] | |
use std::sync::Arc; | |
#[allow(unused_imports)] | |
use std::vec::IntoIter as VecIntoIter; | |
#[allow(unused_imports)] | |
use vulkano::device::Device; | |
#[allow(unused_imports)] | |
use vulkano::descriptor::descriptor::DescriptorDesc; |
View wtf.rs
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
extern crate time; | |
#[derive(Debug, Clone)] | |
struct Vertex { position: [f32; 2], velocity: [f32; 2] } | |
fn main() { | |
let mut arr = vec![ Vertex { position: [0.0, 0.0], velocity: [0.0, 0.0] }; 200000 ]; |
View broken.nim
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
var x : auto = 10 | |
# Error: internal error: getTypeDescAux(tyExpr) | |
# No stack traceback available | |
# To create a stacktrace, rerun compilation with ./koch temp c <file> |
View gist:208ac923ecc66f42caf2
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 unittest | |
type memory* [T=byte] = distinct ptr T | |
proc `+`*[T](mem: memory[T]; offset: int): memory[T] = | |
cast[memory[T]](cast[int](mem) + offset*sizeof(T)) | |
proc `-`*[T](mem: memory[T]; offset: int): memory[T] = | |
cast[memory[T]](cast[int](mem) - offset*sizeof(T)) |
View gist:c9d9741a1f67d7d5ca94
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
proc incval(x: string; y: string): string = | |
"completely unrelated" | |
proc test(): tuple[incval: proc(); getval: proc():int] = | |
var val = 0 | |
proc incval() = | |
inc val |
View gist:b2b5c4310e0d7164e614
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
{.experimental.} | |
type Mat2F | |
[ | |
rowCount, colCount: static[int]; | |
elementType | |
] = | |
object ## A 2-dimensional fixed-sized matrix of an arbitrary type | |
elementList: array[rowCount*colCount, elementType] |
View aahh.nim
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 unittest, typetraits | |
suite "aahh": | |
test "aahh": | |
var a = 5 | |
let cond = (name(type(a)) == "int") | |
require(cond) # works |
View gist:0827f2e27dda2cc5fcd2
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 sequtils | |
template test(x: int; list: varargs[int]): expr = | |
foldl(list, a*(b+x)) | |
echo test(5, 1, 2, 3, 4) # 504 | |
View gist:4082fd7e43f221e06570
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 memory | |
type MatD*[ElementT] = tuple | |
elementCount: uint32 | |
dimensionCount: uint16 | |
data: memory[byte] | |
template matD(dimensions: varargs[float64]; elementT: typedesc): expr = |
View gist:cbb3b7f4453604c3d6ff
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
type MatF[ElementT, PLEASE_HELP] = object | |
data: array[SOME_VARIABLE_LENGTH_HERE, ElementT] | |
template matF*(elementT: typedesc; dimensions: varargs[int]): expr = | |
let dimensionCount = len(dimensions) | |
let elementCount = foldl(dimensions, a*b) | |
??? |
NewerOlder