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 / test.idr
Created Apr 4, 2017
Attempt to generate a function type
View test.idr
data PathType = NAT | BOOL
interpPathType : PathType -> Type
interpPathType NAT = Nat
interpPathType BOOL = Bool
Func : Type
Func = (List PathType, PathType)
interp : Func -> Type
bvssvni /
Last active Jan 17, 2017
YEAH! It compiles!
pub fn par_trans2(
pos: V2<f32>,
f: Box<Fn(&[V2<f32>], &mut [bool]) + Sync>
) -> Box<Fn(&[V2<f32>], &mut [bool]) + Sync>{
const SIZE: usize = 1024;
Box::new(move |input, output| {
.for_each(|(i, o): (&[V2<f32>], &mut [bool])| {
/// Use stack memory to avoid allocations.
View gist:10a1cf737fcea6feca2a14c79bf05767
$ cargo publish --verbose
Updating registry ``
error: failed to update registry
Caused by:
failed to fetch ``
Caused by:
[9/-3] Object not found - no match for id (af86e67bfa42abc6f7362a4f1de845b4e3a943f3)
bvssvni / syntax.txt
Created Jan 3, 2017
Syntax for a subset of English that is activity focused
View syntax.txt
_seps: "."
8 sentence = [activity:"activity" .w? "."]
9 expression = .s!([.w! {"&":"&" "|":"|"} .w!] activity:"term")
10 if = [{"if" "when"} .w! expression:"condition" .w! "then" .w! expression:"then"
.r?([.w! "else" .w! "if" .w! expression:"else_if_condition" .w!
"then" .w! expression:"else_if_then"])
?[.w! "else" .w! expression:"else"]]
11 activity = [!{"then" "else" "&" "|"} {
bvssvni /
Created Jan 2, 2015
Cross platform watch script for Rust - updated for `cargo build`
#written by zzmp
# This script will recompile a rust project using `cargo build`
# every time something in the specified directory changes.
# Watch files in infinite loop
watch () {
bvssvni /
Last active Sep 17, 2016
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 /
Last active May 6, 2016
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 /
Created Feb 18, 2016
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 /
Last active Jan 22, 2016
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
You can’t perform that action at this time.