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 Control.Applicative | |
import System.Environment | |
import Data.List.Split | |
import Data.List | |
-- the ":: [Float]" prevents the type inferencer from going haywire | |
addTo [] v = v :: [Float] | |
addTo t v | |
| length t == length v = zipWith (+) t v | |
| otherwise = error "Inconsistent-length rows" |
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 add_to(totals: list[float])(values: list[float]) => | |
if values.len != 1.size then let n = totals.len in match n with | |
| 0uz => values | |
| $(values.len) => (add of (float^2)).map $ totals.zip2 values | |
// this ugliness is because of a bug in Felix that generates invalid C++ code | |
// see https://github.com/felix-lang/felix/issues/71 | |
| _ => #(fun () = { raise "Inconsistent-length rows"; return #list[float]; }) | |
endmatch else totals; | |
fun add_line_to(totals: list[float])(line: string) => |
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
#!/bin/sh | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "usage: $0 <file> <line>" | |
exit 1 | |
fi | |
line=`expr $2 - \( $2 / 256 \* 256 \) + \( $(wc -l < $1) / 256 \* 256 \)` | |
echo "$line: `sed ${line}q\;d $1 | sed 's/^[ \t]*//;s/[ \t]*$//'`" |
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
/* | |
This is a simple benchmark of the C++ string implode algorithms as stated at | |
http://stackoverflow.com/questions/5689003/ | |
how-to-implode-a-vector-of-strings-into-a-string-the-elegant-way. | |
This uses Celero. | |
Results on my machine, compiling with Clang SVN and -O3: | |
[==========] | |
[ CELERO ] |
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 option ; | |
import package ; | |
import regex ; | |
local embed = [ option.get embed : 0 ] ; | |
local xprops = ; | |
if embed in 1 true yes { | |
xprops = "<link>static" ; |
NewerOlder