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
import std.typecons; | |
template MakeNumberedValue(alias tag, alias val) { | |
enum MakeNumberedValue = tuple(tag, val); | |
} | |
template NumberedValue(alias tv) { | |
enum NumberedValue = tv[1]; | |
} |
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
;; Lokalizacja Markov'a | |
;; SKN Noesis 21.05.2012 | |
(defparameter *world-map* '((red green green) | |
(green green green) | |
(green green green))) | |
(defparameter *measurement-prob* 0.7) | |
(defparameter *movement-success-prob* 0.8) | |
(defparameter *movement-fail-prob* 0.1) |
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
;; Lokalizacja Markov'a | |
;; SKN Noesis 21.05.2012 | |
(defparameter *world-map* '(green red green green)) | |
(defparameter *measurement-prob* 0.7) | |
(defparameter *movement-success-prob* 0.8) | |
(defparameter *movement-fail-prob* 0.1) | |
(defun prior-prob () | |
"Funkcja zwraca początkowy rozkład prawdopodobieństwa dla podanego świata." |
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
;; SKN Noesis | |
;; 04.06.2012 | |
;; Parametry symulacji | |
; Rozmiar swiata | |
(defconstant +world-size+ 100.0) | |
; Punkty orientacyjne i poczatkowa pozycja robota | |
(defparameter *landmarks* '((20.0 . 20.0) (80.0 . 80.0) (20.0 . 80.0) (80.0 . 20.0))) |
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
# Params: | |
.equ x, 8 | |
.equ y, 12 | |
.equ n, 16 | |
# Data: | |
.data | |
xm: .double 0.0 | |
ym: .double 0.0 |
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
import std.algorithm; | |
import std.stdio; | |
import std.typecons; | |
import cl.loop; | |
void main(string[] args) { | |
args = args[1 .. $]; // Get rid of the process name. | |
int[] array = [1, 2, 3, 4, 5]; |
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
(let ((random (loop with max = 500 | |
for i from 0 to max | |
collect (random max)))) | |
(loop for i in random | |
counting (evenp i) into evens | |
counting (oddp i) into odds | |
summing i into total | |
maximizing i into max | |
minimizing i into min | |
finally (format t "Stats: ~A" |
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
auto random = mixin(Loope!q{ | |
with max = 500 | |
for i from 0 to max | |
collect $$ uniform(0, max) $$ | |
}); | |
mixin(Loop!q{ | |
for i in random | |
counting $$ (i&1) == 0 $$ into evens | |
counting $$ (i&1) == 1 $$ into odds |
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
auto random = (() { | |
auto max = 500; | |
auto __i_0 = max; | |
auto i = 0; | |
typeof(uniform(0, max))[] __accumulator; | |
for(;;) { | |
if(i >= __i_0) break; | |
__accumulator ~= uniform(0, max); |
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
auto random = randomStuff(); // Implemented elswhere. ;) | |
auto result = mixin(Loope!q{ | |
initially $$ writeln("Loop test:"); $$ | |
with isEven = $$ (uint x) => ((x&1) == 0) $$ | |
with updateAnalysis = $$ // A D function analysing our data. | |
(uint[] stats) { | |
static count = 0; | |
if(count++ % 10 == 0) |
OlderNewer