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) | |
??? |
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 = |
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 | |
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 |
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] |
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 |
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)) |
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> |
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 ]; |
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; |
OlderNewer