This file contains hidden or 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
#lang racket/base | |
(require racket/function | |
racket/list | |
racket/dict) | |
(provide (struct-out lens) | |
lens-get | |
lens-mod | |
lens-set |
This file contains hidden or 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
#lang racket/base | |
(require racket/control) | |
(struct monad (bind return) #:transparent) | |
(define-syntax-rule (with-monad ([val m]) body ...) | |
(let* ([m-once m] | |
[val | |
(lambda (ma) |
This file contains hidden or 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 demethodize = function(func) { | |
"use strict"; | |
return function(...args) { | |
func.apply(args[0], args.slice(1)) | |
}; | |
}; | |
This file contains hidden or 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
fn mut_to_pure<'f, A, FI>(mut f: FI) -> Box<FnMut(A) -> A+'f> | |
where FI: FnMut(&mut A)+'f { | |
Box::new(move |mut a| {f(&mut a); a}) | |
} | |
fn pure_to_mut<'f, A, FI>(mut f: FI) -> Box<FnMut(&mut A)+'f> | |
where FI: FnMut(A) -> A+'f { | |
Box::new(move |a: &mut A| { | |
unsafe { | |
let mut temp: A = std::mem::uninitialized(); |
This file contains hidden or 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(dead_code)] | |
struct HNil; | |
struct HCons<H, T> { | |
head: H, | |
tail: T | |
} | |
trait Contains<A> { |
This file contains hidden or 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(dead_code)] | |
use std::fmt; | |
use std::error; | |
#[derive(Debug)] | |
enum SplitMutError { | |
AliasedMut | |
} |
This file contains hidden or 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
create name !A!b=1, animate me . 1 1 0; at tm A:=0 100, name !A!b=1; at tm A:=1 101, name !A!b=0; at tm B:=0 102, animate me . 1 1 0; at tm B:=1 103, animate me . 1 1 1000000000; at tm A*B 104, astart !A!b=1; adone timer !A&!B=1 200 reset | |
create name !Ab=1; at tm A:=0 100, name !Ab=1; at tm A:=1 101, name !Ab=0; at tm B:=0 102, animate me . 1 1 1000000000; at tm B:=1 103, animate me . 1 1 0; at tm A*B 104, astart !Ab=1; adone timer !A&B=1 200 reset | |
create name Ab=0; at tm A:=0 100, name Ab=0 ; at tm A:=1 101, name Ab=1; at tm B:=0 102, animate me . 1 1 1000000000; at tm B:=1 103, animate me . 1 1 0; at tm A*B 104, astart Ab=1; adone timer A&B=1 200 reset | |
create animate me . 1 1 0, name A!b=0; at tm A:=0 100, name A!b=0; at tm A:=1 101, name A!b=1; at tm B:=0 102, animate me . 1 1 0; at tm B:=1 103, animate me . 1 1 1000000000; at tm A*B 104, astart A!b=1; adone timer A&!B=1 200 reset | |
at tm A&B=1 100, timer A&!B=0 200 reset, timer !A&B=0 200 reset, timer !A&!B=0 200 reset, timer A=1 200 reset, timer B=1 200 re |
This file contains hidden or 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
float estimated_min_attempt_vel(float fps) | |
{ | |
vector pos = llGetPos(); | |
float alt = pos.z; | |
integer shell = llFloor(llLog(alt)/llLog(2.0)); | |
return fps * llPow(2.0, (float)shell - 24.0); | |
} | |
show(float attempting, float getvel, float actual, float fps, float dilation) | |
{ |
This file contains hidden or 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
use std::marker::PhantomData; | |
pub enum Void {} | |
impl Void { | |
fn any(&self) -> ! { | |
match *self {} | |
} | |
} |
This file contains hidden or 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
use std::rc::{Rc, Weak}; | |
use std::cell::RefCell; | |
pub struct Scope<'t, T: 't> { | |
filled: bool, | |
hole: &'t mut T | |
} | |
impl<'t, T: 't> Scope<'t, T> { | |
unsafe fn new(mut_ref: &'t mut T) -> (T, Self) { |