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
@Specialization(guards = "isLong(vframe)") | |
public long readLong(VirtualFrame vframe) { | |
try { | |
return vframe.getLong(getSlot()); | |
} catch (FrameSlotTypeException e) { } | |
MaterializedFrame frame = getLexicalScope(vframe); | |
while (true) { | |
try { | |
return frame.getLong(getSlot()); | |
} catch (FrameSlotTypeException e) { |
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 add(a, b) { | |
c = new(); | |
c.x = a.x + b.x; | |
c.y = a.y + b.y; | |
return c; | |
} | |
function main() { | |
a = new(); | |
a.x = 1; |
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
➜ simplelanguage git:(master) ✗ ./sl -dump language/tests/SumPrint.sl | |
+ VERSION=0.33 | |
+ LANGUAGE_PATH=./language/target/simplelanguage-0.33-SNAPSHOT.jar | |
+ LAUNCHER_PATH=./launcher/target/launcher-0.33-SNAPSHOT.jar | |
+ MAIN_CLASS=com.oracle.truffle.sl.launcher.SLMain | |
+ [[ ! -f ./language/target/simplelanguage-0.33-SNAPSHOT.jar ]] | |
+ [[ ! -f ./launcher/target/launcher-0.33-SNAPSHOT.jar ]] | |
+ [[ /Users/john.schmidt/.jenv/versions/other64-1.8.0.161 != '' ]] | |
++ grep GRAALVM_VERSION /Users/john.schmidt/.jenv/versions/other64-1.8.0.161/release | |
+ GRAALVM_VERSION='GRAALVM_VERSION="0.33"' |
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
(ns spec-test.core | |
(:require [clojure.spec :as s])) | |
(defprotocol Game | |
(move [game])) | |
(s/def ::game1 #(satisfies? Game %)) | |
(s/def ::game2 (partial satisfies? Game)) |
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 {:dependencies [[im.chit/vinyasa "0.2.2"]] | |
:injections | |
[(require '[vinyasa.inject :as inject]) | |
(inject/in | |
clojure.core | |
[clojure.pprint [pprint pp]])]}} | |
REPL output: |
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 {:dependencies [[im.chit/vinyasa "0.2.2"]] | |
:injections | |
[(require 'clojure.pprint) | |
(ns-unmap *ns* 'pp) | |
(def pp clojure.pprint/pprint) | |
(def p println)]}} | |
REPL output: |
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
// Version 1: | |
let mut n_most_common = Vec::with_capacity(n); | |
for _ in range(0u, n) { | |
let Counted { k, v } = pq.pop().unwrap(); | |
n_most_common.push((k, v)); | |
} | |
n_most_common |
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
pub fn most_common(&self, n: uint) -> Vec<(K, uint)> { | |
let data = self.data.clone(); | |
let mut counted: Vec<Counted<K>> = data.move_iter(). | |
map(|(k, v)| Counted {k: k, v: v}).collect(); | |
let mut n_most_common = vec!(); | |
let mut pq = PriorityQueue::from_vec(counted); | |
for _ in range(0u, n) { | |
let tmp = pq.pop().unwrap(); | |
// error: use of partially moved value: `tmp` |
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 crate debug; | |
use std::str::CharRange; | |
use std::str::Chars; | |
use std::str::raw::slice_unchecked; | |
fn main() { | |
let test = "¨återbesök på färöarna"; | |
let v: Vec<u16> = to_utf16(test).collect(); | |
println!("{}", v); | |
println!("{}", test.to_utf16()); |
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 crate collections; | |
use collections::HashMap; | |
fn main () { | |
} | |
static MISSING: uint = 0; | |
#[deriving(Clone)] |