Skip to content

Instantly share code, notes, and snippets.

View brendanzab's full-sized avatar
😵‍💫
writing elaborators

Brendan Zabarauskas brendanzab

😵‍💫
writing elaborators
View GitHub Profile
@brendanzab
brendanzab / Makefile
Created February 12, 2013 20:55 — forked from dpc/Makefile
RUSTC ?= rustc
#LOG_FLAGS ?= RUST_LOG=rustc::metadata::creader
all: glhex
run: all
./glhex
glhex: main.rs *.rs
@brendanzab
brendanzab / map_cast.rs
Created October 26, 2012 01:13 — forked from erickt/gist:3956374
map_cast Rust macro
use to_str::ToStr;
macro_rules! map_cast(
(~[$($elems:expr),+] -> $T:ty) => (~[$($elems as $T),+]);
(@[$($elems:expr),+] -> $T:ty) => (@[$($elems as $T),+]);
($arr:expr -> $T:ty) => ($arr.map(|a| *a as $T));
)
fn main() {
let arr1 = map_cast!(~[1, 2.5] -> ToStr);
fn main() {
let stuff = ~[~"one", ~"two", ~"three"];
stuff
.map(|s| str::append(~"lol", *s))
.map(|s| io::println(*s));
}