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
-module(ring). | |
-export([bench/2, ring/2]). | |
bench(N, M) -> | |
timer:tc(?MODULE, ring, [N, M]). | |
ring(N, M) -> | |
SPID = spawn(fun() -> createstartnode() end), | |
LPID = create_ring(N-1, SPID), | |
SPID ! LPID, |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
var wg sync.WaitGroup |
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
alleq :: Eq a => [a] -> Maybe a -> Bool | |
alleq [] _ = True | |
alleq (h:t) Nothing = alleq t (Just h) | |
alleq (h:t) (Just e) | |
| h == e = alleq t (Just e) | |
| True = False |
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
"Get rid of most of the bumpf in the file | |
:g/solid/d | |
:g/loop/d | |
:g/endfacet/d | |
"Get rid of leading and trailing spaces | |
:%s/^ *//g | |
:%s/ *$//g | |
"Unify spaces | |
:%s/ \+/ /g | |
"Rewrite each facet normal into a glNormal3f |
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 example from http://en.wikipedia.org/wiki/Powerset_construction | |
Comment: In the NDFA Extension to the VFSM syntax (VFSMv2N), lambda: and epsilon: are equivalent | |
Comment: In VFSMv2N, lambda: and epsilon: are special transitions indicating transition on no input | |
Start: 1 | |
Accept: 3 4 | |
Edges: | |
1 0 2 | |
1 lambda: 3 | |
2 1 2 |
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
include "globals.mzn"; | |
% Given an integer n and a real e | |
par int: n = 566*708; | |
par float: e = 16/9; | |
% Find two integers r <= c | |
var int: r; var int: c; | |
constraint c >= r; | |
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
#!/usr/bin/env ruby | |
require 'json' | |
Products = JSON.parse(DATA.read) | |
Productindex = Products.keys | |
ingredientsstack = [] | |
buildstack = {} | |
build = ARGV.shift |
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 deepExtend(target, source) { | |
Object.keys(source).forEach(function(key) { | |
var value = source[key]; | |
var dest = target[key]; | |
var sourceType = typeof value; | |
var destType = typeof target[key]; | |
if (Array.isArray(value) && Array.isArray(dest)) | |
target[key] = dest.concat(value); | |
else if (sourceType === destType && sourceType === 'object') |
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
s is need "stdio". | |
f is nonary { | |
add is binary { | |
PRE + POST | |
}, | |
s:println 4 add 5, | |
s:println add | |
}. |
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
> isCorner(3); | |
undefined | |
> rows | |
5 | |
> cols | |
5 | |
> isCorner | |
function isCorner(i) { | |
return | |
i == 0 || |
OlderNewer