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
| > {-# LANGUAGE OverloadedStrings #-} | |
| This is the main driver of the program. | |
| > module Main where | |
| We need System.Environment for access command line arguments: | |
| > import System.Environment (getArgs) |
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
| #[link_name = ""] | |
| #[link_args = "BAD LINKING"] | |
| native mod c { | |
| fn random() -> int; | |
| } |
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
| #[cfg(target_os = "macos")] | |
| native mod c { | |
| fn mach_absolute_time() -> u64; | |
| } | |
| #[cfg(target_os = "macos")] | |
| #[link_name=""] | |
| #[link_args = "-framework CoreServices"] | |
| native mod CoreServices { |
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 merge_sort<copy a>(&&d: [mutable a]) { | |
| fn merge<copy a>(&&data: [mutable a], &&temp: [mutable a], low: uint, middle: uint, high: uint) { | |
| let resultI = low; | |
| let tempI = low; | |
| let destI = middle; | |
| while tempI < middle && destI <= high { | |
| if data[destI] < temp[tempI] { | |
| data[resultI] = data[destI]; | |
| resultI += 1u; | |
| destI += 1u; |
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; | |
| fn poke(value: uint, index: uint, data: @mutable [mutable uint]) { | |
| (*data)[index] = value; | |
| } | |
| fn main(_args: [str]) { | |
| let vec = [mutable 4u]; | |
| std::io::println(#fmt["%u", vec[0]]); | |
| poke(3u, 0u, @mutable vec); |
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
| module Main where | |
| import Graphics.Sketch | |
| import Data.Array.Repa | |
| import Data.Word | |
| import Control.Monad | |
| import System.Random | |
| randomWord8 :: IO Word8 |
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
| //===- llvm/ADT/SmallVector.h - 'Normally small' vectors --------*- C++ -*-===// | |
| // | |
| // The LLVM Compiler Infrastructure | |
| // | |
| // This file is distributed under the University of Illinois Open Source | |
| // License. See LICENSE.TXT for details. | |
| // | |
| //===----------------------------------------------------------------------===// | |
| // | |
| // This file defines the SmallVector class. |
NewerOlder