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
fn main() { | |
let nums = [0u, 1, 2, 3]; | |
let iter = nums.iter(); | |
let fil = iter.filter(|&x| x % 2 == 0); | |
let m : ~[uint] = fil.collect::<~[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
extern mod extra; | |
use extra::arc::Arc; | |
use std::rand; | |
use std::vec; | |
fn pnorm(nums: &~[float], p: uint) -> float { | |
nums.iter().fold(0.0, |a,b| a+(*b).pow(&(p as float)) ).pow(&(1f / (p as float))) | |
} |
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
struct Yoba { | |
value: uint | |
} | |
impl Yoba { | |
fn new(value: uint) -> Yoba { | |
Yoba { value: value } | |
} |
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
import qwe | |
qwe.dilda = ["sgushenka"] | |
qwe.ohuet() |
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
from IPython.terminal.embed import InteractiveShellEmbed | |
from IPython.core.interactiveshell import DummyMod | |
import sys | |
import mako.template | |
from mako import util, compat | |
# call - ${ invoke_ipython() } |
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
test |
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
# generic with extends Interface | |
class PointableProtocol(Protocol): | |
x: Any | |
y: Any | |
def __init__(self, x: Any, y: Any) -> None: | |
pass |