Abbreviation | Definition | Reference | |
---|---|---|---|
Reducing function | rf | ||
Transducer | xf | https://clojure.org/reference/transducers | |
Reducer | https://clojure.org/reference/reducers | ||
Reducible | coll | An object which can be reduced by transduce and reduce. E.g a seq, clojure.lang.IReduceInit or clojure.lang.IReduce | |
Transducible process |
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
#?(:clj (defn cosine-similarity [vec1 vec2] | |
(let [dot-product (reduce + (map * vec1 vec2)) | |
magnitude-vec1 (Math/sqrt (reduce + (map #(Math/pow % 2) vec1))) | |
magnitude-vec2 (Math/sqrt (reduce + (map #(Math/pow % 2) vec2)))] | |
(if (or (zero? magnitude-vec1) (zero? magnitude-vec2)) | |
0 | |
(/ dot-product (* magnitude-vec1 magnitude-vec2)))))) | |
#?(:clj (defn double1:dot-product [^double/1 v1 ^double/1 v2] | |
(let [n (alength v1)] |
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
.intel_syntax noprefix | |
.global _start | |
# - [x] exit with 1337 | |
#- [ ] print 1-100 | |
.section .data | |
int_fmt: .string "%d\n" | |
.section .text | |
_start: | |
mov rcx, 100 |
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 logs | |
(:require [clojure.edn :as edn] | |
[clojure.string :as str]) | |
(:import java.nio.file.Path | |
java.nio.file.Paths | |
java.nio.file.Files | |
java.nio.file.OpenOption | |
java.io.PushbackReader | |
java.nio.file.LinkOption | |
java.io.InputStreamReader |
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
const removeFromArray = function (){ // Takes an array and an arbitrary amount of primitive values. Returns an array where all elements from the array which are equal to one of the primitive value are removed. | |
arguments = Array.prototype.slice.call(arguments); | |
let array = arguments[0]; | |
let valuesToRemove = arguments.slice(1); | |
let newArray = []; | |
array.forEach(element => { | |
if(!(valuesToRemove.includes(element))) { | |
newArray.push(element); | |
} | |
}); |