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
public static A reduce<T, A>(Func<A, T, A> fn, A accum, T[] iterable) { | |
int idx = 0; | |
int len = iterable.Length; | |
while(idx < len) { | |
accum = fn(accum, iterable[idx]); | |
idx += 1; | |
} | |
return accum; |
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
--- | |
definitions: | |
effect: | |
type: object | |
properties: | |
id: | |
oneOf: | |
- type: integer | |
- type: string | |
name: |
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
(ns playground.bitmasking.blob | |
(:require [playground.bitmasking.utils | |
:refer [index->coord coord->index reshape2d->1d]])) | |
(defn ^:private calc-offsets | |
[x y] | |
(let [north [x (dec y)] | |
north-east [(inc x) (dec y)] | |
east [(inc x) y] | |
south-east [(inc x) (inc y)] |
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
;; EFFECTS | |
{:type :constant | |
:target "%.aim" | |
:operator :add | |
:value 5} | |
{:type :expression | |
:target "%.mobility" | |
:operator :add | |
:expression "%.mobility * 0.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
;; EFFECTS | |
;; effects are the fundamentall building block of the engine. they provide a means of interacting with entities and changing their state. they should be as mini.al as possible, leaving the method of their application to higher order elements. | |
{:type :constant | |
:target "%.aim" | |
:operator :add | |
:value 5} | |
{:type :expression | |
:target "%.mobility" |
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 [pyparsing :as pp]) | |
(with [f (open "config.cpp")] | |
(setv config (.readlines f))) | |
(setv colon ":" | |
open-curly "{" | |
klass (pp.CaselessKeyword "class") | |
klass-name ((pp.Word (+ pp.alphanums "_")) "class_name") | |
base-klass ((pp.Word (+ pp.alphanums "_")) "base_class") |
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
( hint "hello world" ); | |
private _is_odd = | |
{ | |
params ["_x"]; | |
((_x % 2) != 0) | |
}; | |
private _is_even = | |
{ | |
params ["_x"]; | |
((_x % 2) == 0) |
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
( hint "hello world" ); | |
private _is_odd = | |
{ | |
params ["_x"]; | |
((_x % 2) != 0) | |
}; | |
private _is_even = | |
{ | |
params ["_x"]; | |
((_x % 2) == 0) |
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
;; stdlib | |
(defglobal odd? [x] (!= (% x 2) 0)) | |
(defglobal even? [x] (= (% x 2) 0)) | |
(defglobal list? [x] (= (typeName x) "ARRAY")) | |
(defglobal string? [x] (= (typeName x) "STRING")) | |
(defglobal number? [x] (= (typeName x) "SCALAR")) | |
(defglobal bool? [x] (= (typeName x) "BOOL")) | |
(defglobal int? [x] (= (floor x) x)) | |
(defglobal pos? [x] (> x 0)) | |
(defglobal neg? [x] (< x 0)) |
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
(defn sqisp-repr [obj] | |
(cond | |
(set? obj) (format ["#{%1}" (joinString (map sqisp-repr (iter-items obj)) ", ")]) | |
(map? obj) (format ["{%1}" | |
(joinString | |
(map (fn [x] | |
(joinString [(sqisp-repr (first x)) | |
(sqisp-repr (second x))] | |
" ")) | |
(iter-items obj)) ", ")]) |
OlderNewer