Skip to content

Instantly share code, notes, and snippets.

Sven Nilsen bvssvni

Block or report user

Report or block bvssvni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bvssvni
bvssvni / example.rs
Last active Sep 17, 2016
Major breakthrough in path semantics: First working prototype of dependently paths!!!!
View example.rs
/*
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
A pre-training example for deep learning in Dyon
View deep_learning.rs
fn sigmoid(x) -> {
return 1 / (1 + exp(-x))
}
fn layer(inputs, outputs) -> {
return [[0; inputs]; outputs]
}
fn tensor(sizes) -> {
@bvssvni
bvssvni / cube.rs
Created Feb 18, 2016
Cube example
View cube.rs
use gl;
use gl::types::*;
use image;
use helper;
use color::Color;
use mat4::Mat4;
pub struct Cube {
@bvssvni
bvssvni / helper.rs
Created Feb 18, 2016
helper module for OpenGL
View helper.rs
// 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 Jan 22, 2016
working on a home made scripting language - name suggestions?
View main.rs
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 Aug 6, 2015
Cargo.lock for piston-examples
View Cargo.lock
[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)",
View gist:bbbacc43c30e86673206
[(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 Aug 29, 2015
Bump "0.0.x" to "0.1.0"
View progress.md
  • 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 Aug 29, 2015
Notation for reasoning about parsing - described in its own notation
View gist:18aa2ebac87081cafdd0
whitespace { optional }:
whitespace?
token("whitespace")
select(
token("?") as optional
token("!") as !optional
)
whitespace?
parameter { name, args, value }:
View gist:c5d43f69bbf80f8370de
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)
You can’t perform that action at this time.