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
use std::io; | |
fn main() { | |
eval(bytes!("++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.")); // I stole this off of wikipedia, sorry, wikipedia :( | |
} | |
fn eval(program: &[u8]) { | |
let mut pointer = 0u; | |
let mut memory = [0u8, ..1024]; | |
let mut jmp_stack = vec!(); |
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
use std::iter::Iterator; | |
fn map<T, U, I: Iterator<T>>(fun: |T| -> U, mut iter: I) -> Vec<U> { | |
let mut acc = vec![]; | |
for elt in iter { | |
acc.push(fun(elt)); | |
} | |
acc | |
} |
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
rustc src/lib.rs -o idris/idrisfs.o --crate-type=lib --emit=obj | |
Undefined symbols for architecture x86_64: | |
"___morestack", referenced from: | |
_sizeof_int in idrisfs.o | |
sizeof_int::__rust_abi in idrisfs.o | |
mem::size_of::h1f2d9faff57bec09oaa::v0.0 in idrisfs.o | |
ld: symbol(s) not found for architecture x86_64 | |
clang: error: linker command failed with exit code 1 (use -v to see invocation) | |
FAILURE: gcc -O2 -fwrapv -fno-strict-overflow -I. ./idrisfs.o -x c /var/folders/_t/g72k9vzd30b5svvyd1nxpwp40000gn/T/idris5178 -L/Users/sven/Library/Haskell/ghc-7.6.3/lib/idris-0.9.12/share/rts -lidris_rts -lgmp -lpthread -I/Users/sven/Library/Haskell/ghc-7.6.3/lib/idris-0.9.12/share/rts -I. -I/Users/sven/Library/Haskell/ghc-7.6.3/lib/idris-0.9.12/share/prelude -I/Users/sven/Library/Haskell/ghc-7.6.3/lib/idris-0.9.12/share/base -o /var/folders/_t/g72k9vzd30b5svvyd1nxpwp40000gn/T/idris5176 |
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
#!/bin/sh | |
if [ "`uname`" = "Darwin" ]; then | |
target=x86_64-apple-darwin | |
else | |
target=x86_64-unknown-linux-gnu | |
fi | |
mkdir /tmp/rust-update | |
cd /tmp/rust-update |
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 collections; | |
use std::collections::HashMap; | |
use std::collections::hashmap::Entries; | |
use collections::hash::Hash; | |
struct Counter<T> { | |
counts: HashMap<T, uint>, | |
} |
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
[package] | |
name = "triangle" | |
version = "0.1.0" | |
authors = [ "Brendan Zabarauskas" ] | |
[[bin]] | |
name = "triangle" # the name of the executable to generate |
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
#!/bin/sh | |
cd /tmp/ | |
git clone --recursive https://github.com/rust-lang/cargo | |
cd cargo | |
make | |
make install | |
cd $HOME | |
rm -rf /tmp/cargo |
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
/// Sends cloned values to multiple monitoring `Receiver`s. | |
pub struct Signal<T> { | |
txs: Vec<Sender<T>>, | |
} | |
impl<T: Send> Signal<T> { | |
/// Create a signal with no monitors connected. | |
pub fn new() -> Signal<T> { | |
Signal { txs: Vec::new() } | |
} |
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
#![feature(macro_rules)] | |
macro_rules! flag { | |
($Flag:ident) => { | |
flag!($Flag { Yes, No }) | |
}; | |
($Flag:ident { $Yes:ident, $No:ident, }) => { | |
flag!($Flag { $Yes, $No }) | |
}; | |
($Flag:ident { $Yes:ident, $No:ident }) => { |
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
// user application | |
loop { | |
window.poll_events(); | |
} | |
// mac/glutin | |
fn poll_events(&self) { | |
nsapp_waitevent(); |