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 intrinsic::{tydesc, get_tydesc, visit_tydesc, ty_visitor}; | |
import libc::c_void; | |
trait MovablePtr { | |
fn move_ptr(adjustment: fn(*c_void) -> *c_void); | |
} | |
// FIXME #3262: this is a near-duplicate of code in core::vec. | |
type VecRepr = { | |
box_header: (uint, uint, uint, 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 std; // for tests | |
use reflect::*; | |
enum fmt_visitor = @{ | |
out: io::WriterUtil, | |
}; | |
// duplicated from syntax/ast.rs so as not to depend on it | |
enum mutability { m_mutbl, m_imm, m_const, } | |
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 x = (~"a",~"b"); | |
io::println(x.second()); | |
} |
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 C {mut d: ~[uint]} | |
fn main() { | |
let mut c = C {d: ~[1,2,3]}; | |
f(&c); | |
} | |
fn f(x: &C) { | |
for x.d.each |e| { | |
io::println(~"a"); |
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
I'm announcing an initial version of an API search tool for Rust. It is inspired by the api search tool for haskell | |
called Hoogle (http://www.haskell.org/hoogle). It is very new (I started working on it a week ago), so it has a long | |
way to go, but for a taste of the kind of things it can currently do: | |
rustle> str -> uint | |
core::str::capacity - fn capacity(s: & const ~str) -> uint - Returns the number of single-byte characters the | |
string can hold without reallocating | |
core::str::char_len - fn char_len(s: & str) -> uint - Returns the number of characters that a string holds | |
core::str::len - fn len(s: & str) -> uint - Returns the string length/size in bytes not counting the null 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
struct A {n: uint} | |
impl A: cmp::Eq { | |
pure fn eq(other: &A) -> bool { | |
self.n == other.n | |
} | |
pure fn ne(other: &A) -> bool { | |
!self.eq(other) | |
} | |
} |
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
#lang plai-typed | |
(require "python-micro-syntax.rkt" | |
"python-helpers.rkt") | |
(define (run-cps [e : UExp]) | |
(begin | |
(sym-reset) | |
(UApp (cps e) (UFn '^x (UId '^x))))) |
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
;; Control flow | |
;; basically, we provide a shadowed '^throw continuation, and then see what | |
;; we are handed. if it is an error (ie, an exception), we see if it matches | |
;; what we are catching, and if it doesn't, we re-throw. Since we are out of | |
;; scope of the current try/catch, we will now pick up whatever exception | |
;; continuation is outside. note that this obviously requires the entire program | |
;; to be wrapped in a try/catch that matches on everything (which it is). | |
[CTry | |
(bdy mat cat els) |
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
$(function () { | |
for(var i = 0; i < 10; i++) { | |
$("#active").append($("<div class='elem'>Block " + i + "</div>")); | |
} | |
$("#pointer").bind("mousedown", start); | |
}); | |
function start(event) { | |
window.startpos = parseInt($("#pointer").css("top")); | |
$(document).bind("mousemove", drag); |