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
(defn splice-into [v n xs] | |
(into (subvec v 0 n) cat [xs (subvec v n)])) |
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
(ns cloze.traversal) | |
;; ============================================================ | |
;; traverser | |
(defprotocol ITraverser | |
(branch? [this x]) | |
(children [this x]) | |
(make-node [this x kids])) |
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
using UnityEngine; | |
[System.Serializable] | |
public class HelixMaterialSpec : UnityEngine.Object | |
{ | |
public Vector2 arcStartPoint = new Vector2(0, 1); | |
public Vector2 arcStopPoint = new Vector2(1, 0); | |
public float arcOuterRadius = 1F; | |
public Material material = null; |
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
public static float[] subdivArray(float n, float div){ | |
float flr = Mathf.Floor(n / div); | |
float rem = Mathf.Mod(n, div); | |
r = Enumerable.Range(0, flr).Select(i => i * div); | |
if(rem == 0){ | |
return r.ToArray; | |
}else{ | |
return r.Concat(new float[]{rem}).ToArray; | |
} | |
} |
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
;; works | |
(-> [[1 0] [1 0]] | |
(System.Linq.Enumerable/SelectMany identity) | |
vec) | |
;; doesn't | |
(-> [[1 0] [1 0]] | |
(System.Linq.Enumerable/SelectMany identity) | |
(System.Linq.Enumerable/Distinct (type-args System.Linq.Enumerable)) | |
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
using Cubiquity; | |
public class CubiquityHelper{ | |
public static void stupidTest(uint n){ | |
bool[] ar = new bool[1]; | |
for(int i = 0; i < n; i++){ | |
ar[0] = true; | |
} |
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
using clojure.lang; | |
using System; | |
[Serializable] | |
public class clojure_west/stupid_idea$volatile_fun_test$fn__499__503 : AFunction | |
{ | |
// | |
// Static Fields | |
// | |
protected internal static object const__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
(defmacro swiz [v spec] | |
(let [spec (name spec) | |
op (case (count spec) | |
2 'v2 | |
3 'v3 | |
4 'v4) | |
vsym (gensym "v_")] | |
`(let [~vsym ~v] | |
(~op ~@(map #(list '. vsym (symbol (str %))) spec))))) |
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
(defn over-color ^Color [^Color a | |
^Color b] | |
(let [^Vector4 a (v4 (.r a) (.g a) (.b a) (.a a)) | |
^Vector4 b (v4 (.r b) (.g b) (.b b) (.a b)) | |
c (Vector4/op_Addition | |
(Vector4/op_Multiply a (float (.w a))) | |
(Vector4/op_Multiply | |
(Vector4/op_Multiply b (float (.w b))) | |
(- 1 (.w a)))) | |
blend (+ (.w 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
(defmacro ^:private defn-meval [& preamble-and-meval-to-forms] | |
(let [preamble (butlast preamble-and-meval-to-forms) | |
meval-to-forms (last preamble-and-meval-to-forms) | |
mevaluated (eval meval-to-forms)] | |
`(defn ~@preamble | |
~@mevaluated))) | |
(defn-meval comp-pro | |
(let [fargs (repeatedly gensym) | |
xarg (gensym "xarg")] |