This file contains hidden or 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 compact<T>(x: &mut ~[T], | |
| keep: |&T| -> bool) { | |
| if x.len() == 0 { | |
| return; | |
| } | |
| let mut kept = 0; | |
| let mut finger = 0; | |
| let mut last = x.len() - 1; | |
| while finger <= last { |
This file contains hidden or 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
| Bulbasaur | |
| 9 RBY | |
| 11 GSCRSECoXDFRLG | |
| 14 DPPtHGSSBWB2W2 | |
| 1386 | |
| Ivysaur | |
| 10 RBY | |
| 13 GSCRSECoXDFRLG | |
| 16 DPPtHGSSBWB2W2 |
This file contains hidden or 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
| use std::hashmap::HashMap; | |
| fn main() { | |
| // create a hashmap | |
| let mut hm = HashMap::new(); | |
| hm.insert(~"foo", 10); | |
| hm.insert(~"bar", 23); | |
| hm.insert(~"baz", 99); | |
| hm.insert(~"meh", 2); | |
| hm.insert(~"muh", -13); |
This file contains hidden or 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 r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s() { | |
| println("ĭ̒̚tͧ̂͆ͫ̄ ̃ͬ͗̍̂c̈͒̊õ͑̓ͩͦ͒m̊͗̐̒esͩ͛!ͨ̀ͩ̀͆̄̚ ĭ̿̈̍̀ͮ͑tͦ͂̉̒̔̇ ̓co͛́̾ͤ̄̉͌m͂͆̀ͫe͛ͨ͌̇͆ͣͥs͂!̇̌̎̆"); | |
| } | |
| fn main() { | |
| r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s(); | |
| } |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <lua.h> | |
| #include <lauxlib.h> | |
| #include <lualib.h> | |
| int main() | |
| { | |
| lua_State *L = luaL_newstate(); |
This file contains hidden or 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
| type Name = { | |
| first: ~str, | |
| last: ~str | |
| } | |
| type Shape = Circle(int) | Rect(int, int) // Variants with constructors | |
| type Direction = North | South | East | West // without constructors | |
This file contains hidden or 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
| macro bf { | |
| case ($body ...) => { | |
| eval('var p = 0, b = [], buf = new Buffer(1);'); | |
| _bf($body ...); | |
| } | |
| } | |
| macro _bf { | |
| case (>) => { | |
| eval('p++;'); | |
| } |
This file contains hidden or 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
| Go Rust | |
| ----------- ------ | |
| break break | |
| case (syntax) | |
| chan (library) | |
| const const | |
| continue loop | |
| default (syntax) | |
| defer | |
| else else |
This file contains hidden or 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() { | |
| run_command("ls"); | |
| run_command("ls -l"); | |
| run_command("ls -l -a"); | |
| run_command("lua LoadGen.lua style=pointer_rust -spec=gl -version=3.3 \ | |
| -profile=core core_3_3"); | |
| } | |
| fn run_command(command: &str) -> int { | |
| let split = command.split_char(' '); |
This file contains hidden or 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
| #!/bin/bash | |
| DIR="$PWD" | |
| while [[ "$DIR" != "/" && "$DIR" != "$HOME" ]]; do | |
| if [[ -r "$DIR/src/libsyntax/syntax.rc" ]]; then | |
| echo "$DIR" | |
| exit 0 | |
| fi | |
| DIR=$(dirname "$DIR") | |
| done |