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
# Copyright 1999-2012 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: /home/portage/generic/dev-lang/rust/rust-0.3.ebuild $ | |
EAPI=4 | |
DESCRIPTION="Rust a safe, concurrent, practical language" | |
HOMEPAGE="http://www.rust-lang.org" | |
SRC_URI="http://dl.rust-lang.org/dist/${P}.tar.gz" |
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 to_str::*; | |
class bf_stack { | |
priv { | |
let mut data : ~[int]; | |
} | |
new() { | |
self.data = ~[0]; | |
} |
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 io::*; | |
import to_str::*; | |
enum some_enum { | |
foo(~[some_enum]), | |
bar | |
} | |
impl to_str for some_enum { | |
fn to_str() -> str { |
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@note ~/soft/mine/rust $ rustc example.rs && ./example | |
example.rs:13:32: 13:43 error: failed to find an implementation of interface core::to_str::to_str for some_enum | |
example.rs:13 foo(nest) { "foo" + nest.to_str() } | |
^~~~~~~~~~~ |
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 io::*; | |
import to_str::*; | |
impl <T : to_str copy> of to_str for ~[mut T] { | |
fn to_str() -> str { | |
let tmp = copy self; | |
tmp.map(|x| { x.to_str() }).to_str() | |
} | |
} |
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 io::*; | |
import to_str::*; | |
impl <T : to_str copy> of to_str for @[mut T] { | |
fn to_str() -> str { | |
let tmp = self; | |
tmp.map(|x| { x.to_str() }).to_str() | |
} | |
} |
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 io::*; | |
import to_str::*; | |
impl <T : to_str copy> of to_str for @[mut T] { | |
fn to_str() -> str { | |
let tmp = self; | |
tmp.map(|x| { x.to_str() }).to_str() | |
} | |
} |
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
module Main where | |
import Data.Char | |
import Data.List | |
import Control.Monad | |
main :: IO () | |
main = return () | |
fibonacci :: [Integer] |
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
void exploreLCG() { | |
uint64_t min = pow(10,1); | |
uint64_t max = pow(10,2); | |
auto f = computeLCG(min, max); | |
srand(time(0)); | |
uint64_t terminator = min + (rand() % (max-min)); | |
uint64_t x = f(terminator); | |
std::cout << x << "\n"; | |
while (x != terminator) { |
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 bus | |
import ( | |
"fmt" | |
"testing" | |
) | |
type intMessage struct { | |
value int | |
} |
OlderNewer