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
fun main(args: Array<String>) { | |
MyFirstClass("Hello, My First Class").out() | |
} | |
class MyFirstClass(val message: String) { | |
fun out() { | |
println(message) | |
} | |
} |
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
from scipy.spatial.distance import pdist, squareform | |
import numpy as np | |
from numbapro import jit, float32 | |
def distcorr(X, Y): | |
""" Compute the distance correlation function | |
>>> a = [1,2,3,4,5] | |
>>> b = np.array([1,2,9,4,4]) |
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
use std::collections::HashMap; | |
// escaping the borrow checker | |
fn test(h:&mut HashMap<String, i64>) -> &mut i64 { | |
{ | |
let matched:Option<&mut i64> = h.get_mut("B"); | |
if matched.is_some() { | |
// assignment to raw pointer side steps the borrow checker | |
let v:*mut i64 = matched.unwrap(); |
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
#![feature(unique)] | |
use std::thread::spawn; | |
// operating on a vector in parallel | |
fn main() { | |
let mut data:Vec<u32> = vec![1u32, 2, 3]; | |
println!("{:?}", data); | |
let head = data.as_mut_ptr(); | |
let mut guards = (0..3).map(|i| |