Skip to content

Instantly share code, notes, and snippets.

View bvssvni's full-sized avatar

Sven Nilsen bvssvni

View GitHub Profile
@bvssvni
bvssvni / example.rs
Last active September 17, 2016 10:33
Major breakthrough in path semantics: First working prototype of dependently paths!!!!
/*
Diary, Sven Nilsen, 15.09.2016:
Reading mathematical papers does help.
Woke up with an idea that arguments could be represented as tuples.
This idea turned into functional currying.
Started coding from scratch today (in Rust of course!) and came this far.
I think I'm starting to understand how dependently types work!
Path semantics is a new field that might make dependently types more powerful and practical.
@bvssvni
bvssvni / deep_learning.rs
Last active May 6, 2016 14:31
A pre-training example for deep learning in Dyon
fn sigmoid(x) -> {
return 1 / (1 + exp(-x))
}
fn layer(inputs, outputs) -> {
return [[0; inputs]; outputs]
}
fn tensor(sizes) -> {
@bvssvni
bvssvni / cube.rs
Created February 18, 2016 22:16
Cube example
use gl;
use gl::types::*;
use image;
use helper;
use color::Color;
use mat4::Mat4;
pub struct Cube {
@bvssvni
bvssvni / helper.rs
Created February 18, 2016 22:13
helper module for OpenGL
// Version 0.0.1
use gl;
use gl::types::*;
use std::ffi::CString;
pub fn create_program(
vertex_shader: &str,
fragment_shader: &str
) -> Result<GLuint, String> {
@bvssvni
bvssvni / main.rs
Last active January 22, 2016 22:27
working on a home made scripting language - name suggestions?
fn set_x(a: 'return, val: 'a) -> {
a.x = val
return val
}
fn main() {
y := {x: {0: 0}}
set_x(y, {0: 2}) // ERROR: Requires reference to variable
println(y)
}
@bvssvni
bvssvni / Cargo.lock
Created August 6, 2015 18:08
Cargo.lock for piston-examples
[root]
name = "piston-examples"
version = "0.0.0"
dependencies = [
"camera_controllers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"find_folder 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_device_gl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"piston-ai_behavior 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
[(Range { offset: 20, length: 0, phantom: PhantomData }, StartNode("materials")), (Range { offset: 45, length: 0, phantom: PhantomData }, StartNode("material")), (Range { offset: 45, length: 7, phantom: PhantomData }, String("name", "metal")), (Range { offset: 86, length: 3, phantom: PhantomData }, F64("reflectivity", 1)), (Range { offset: 45, length: 59, phantom: PhantomData }, EndNode("material")), (Range { offset: 118, length: 0, phantom: PhantomData }, StartNode("material")), (Range { offset: 118, length: 9, phantom: PhantomData }, String("name", "plastic")), (Range { offset: 161, length: 3, phantom: PhantomData }, F64("reflectivity", 0.5)), (Range { offset: 118, length: 61, phantom: PhantomData }, EndNode("material")), (Range { offset: 20, length: 170, phantom: PhantomData }, EndNode("materials")), (Range { offset: 200, length: 0, phantom: PhantomData }, StartNode("entities")), (Range { offset: 224, length: 0, phantom: PhantomData }, StartNode("entity")), (Range { offset: 248, length: 6, phantom: Phantom
@bvssvni
bvssvni / progress.md
Last active August 29, 2015 14:22
Bump "0.0.x" to "0.1.0"
  • graphics (@bvssvni)
  • interpolation (@bvssvni)
  • texture (@bvssvni)
  • viewport (@bvssvni)
  • float (@bvssvni)
  • read_color (@bvssvni)
  • vecmath (@bvssvni)
  • piston_window (@bvssvni)
  • glutin_window (@bvssvni)
  • input (@bvssvni)
@bvssvni
bvssvni / gist:18aa2ebac87081cafdd0
Last active August 29, 2015 14:20
Notation for reasoning about parsing - described in its own notation
whitespace { optional }:
whitespace?
token("whitespace")
select(
token("?") as optional
token("!") as !optional
)
whitespace?
parameter { name, args, value }:
0 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError
1 CGLChoosePixelFormat(attribs = {kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core, kCGLPFAColorSize, 32, kCGLPFADepthSize, 16, kCGLPFADoubleBuffer, kCGLPFADisplayMask, 4, 0}, pix = &0x7ff0c9d00f10, npix = &2) = kCGLNoError
2 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError
3 CGLCreateContext(pix = 0x7ff0c9d00f10, share = NULL, ctx = &0x7ff0ca803600) = kCGLNoError
4 CGLSetParameter(ctx = 0x7ff0ca803600, pname = 1236, params = &-909113104) = kCGLNoError
5 CGLReleasePixelFormat(pix = 0x7ff0c9d00f10)
6 CGLSetSurface(ctx = 0x7ff0ca803600, cid = 0xd97b, wid = 68112, sid = 1642141264) = kCGLNoError
8 CGLUpdateContext(ctx = 0x7ff0ca803600) = kCGLNoError
9 CGLSetCurrentContext(ctx = 0x7ff0ca803600) = kCGLNoError
10 glViewport(x = 0, y = 0, width = 600, height = 600)