Created
January 9, 2017 04:02
-
-
Save gsilvis/bc643a7ee8e57a6d22c2ed56673fac03 to your computer and use it in GitHub Desktop.
MACROOOOOOOOOOOOOOS
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(prelude_import)] | |
#![no_std] | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate std as std; | |
fn bind<T, U, F: FnMut(T) -> Option<U>>(m: Option<T>, mut f: F) -> Option<U> { | |
match m { Some(a) => f(a), None => None, } | |
} | |
pub fn ret<T>(x: T) -> Option<T> { Some(x) } | |
pub fn mzero<T>() -> Option<T> { None } | |
fn main() { | |
::io::_print(::std::fmt::Arguments::new_v1({ | |
static __STATIC_FMTSTR: | |
&'static [&'static str] | |
= | |
&["Hello, world!\n"]; | |
__STATIC_FMTSTR | |
}, &match () { () => [], })); | |
bluh(); | |
} | |
fn bluh() -> () { | |
let n = | |
bind(Some(4), | |
move |x| | |
bind(Some(5), | |
move |y| | |
{ | |
let z: i32 = 2; | |
bind([(2, 3), | |
(4, | |
5)].iter().fold(mzero(), | |
move |_, &(a, b)| | |
bind(Some(a + 3), | |
move |c| | |
bind(Some(2), | |
move | |
|q: | |
i32| | |
bind([()].iter().cycle().fold(mzero(), | |
move | |
|_, | |
_| | |
bind(Some(5), | |
move | |
|c: | |
u32| | |
ret(5))), | |
move | |
|_| | |
Some(c | |
+ | |
b))))), | |
move |_| ret(x + y + z)) | |
})); | |
::io::_print(::std::fmt::Arguments::new_v1({ | |
static __STATIC_FMTSTR: | |
&'static [&'static str] | |
= | |
&["", "\n"]; | |
__STATIC_FMTSTR | |
}, | |
&match (&n,) { | |
(__arg0,) => | |
[::std::fmt::ArgumentV1::new(__arg0, | |
::std::fmt::Debug::fmt)], | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment