These examples compile on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700)
// vector testing
// Vector is kind of complicated part of Rust, partly because it's also convolved with pointers ~, &.
use std::io::BufferedReader; | |
use std::io::stdin; | |
// Google Code Jam: Qualification Round 2009, Problem A. Alien Language | |
//https://code.google.com/codejam/contest/90101/dashboard#s=p0 | |
// Compiles on Rust 0.11-pre | |
// This uses unwrap() functions that can fail. | |
// This is okay for programming contest problems. |
// Compiles on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700) | |
use std::io::BufferedReader; | |
use std::io::stdin; | |
fn main(){ | |
let mut stdin = BufferedReader::new(stdin()); | |
let l = stdin.read_line(); | |
match l { | |
Ok(ll) => { |
// Compiles on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700) | |
use std::io::BufferedReader; | |
use std::io::stdin; | |
fn main(){ | |
let mut stdin = BufferedReader::new(stdin()); | |
for line in stdin.lines() { | |
match line { | |
Ok(l) => print!("{}",l), |
// tiff.rs | |
// Compiles on rustc 0.10-pre (6eae7df 2014-03-20 15:01:47 -0700) | |
#[crate_id = "tiff"]; | |
#[crate_type="bin"]; | |
#[license = "MIT"]; | |
#[desc = "TIFF reading example"]; | |
//! TIFF reading library. | |
//! Supports multipage tiff files. |
// gsltest.rs | |
// | |
// Rust version clone of the example of GSL linear algebra at | |
// http://www.gnu.org/software/gsl/manual/html_node/Linear-Algebra-Examples.html | |
// | |
// Works with Rust 0.9. | |
// | |
// Command for compiling on Mac OSX. You need to have GSL installed: | |
// rustc gsltest.rs -L/opt/local/lib |
use std::int::pow; | |
use std::rand; | |
use std::rand::Rng; | |
struct Matrix { | |
p: ~[int], | |
height: uint, | |
width: uint | |
} |
{-# LANGUAGE OverloadedStrings #-} | |
import Graphics.Triangulation.Delaunay | |
import Data.Vector.V2 | |
import Data.Aeson | |
import Data.ByteString (ByteString) | |
import Data.Text.Lazy.Encoding (encodeUtf8) | |
import Data.Text.Lazy (Text) | |
import qualified Data.Text.Lazy as TL |
import httplib, urllib, marshal | |
def getVal(table, i): | |
x = table.getValue('X', i) | |
y = table.getValue('Y', i) | |
return [x, y] | |
def draw_triangles(imp, triangles): | |
ip = imp.getProcessor() |
binwidth = 1 | |
bin(x,width)=width*floor(x/width) | |
plot 'histdata.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes |