Skip to content

Instantly share code, notes, and snippets.

View Camsbury's full-sized avatar

Cameron Kingsbury Camsbury

View GitHub Profile
@Camsbury
Camsbury / tractManager.md
Last active April 27, 2020 16:26
TractManager take home

Code Review

Original

(let
  [check (fn [& sets] 
    (first (filter #(not (nil? %))
      (map
        (fn [ss]
 (let [r (first (filter #(or (= % #{:x}) (= % #{:o})) ss))]
(ns pentabonacci)
(defn count-odd-pentaFib [n]
(case n
0 0
1 1
2 1
3 1
4 1
(loop [n (- n 1) odds 1 a 1 b 1 c 2 d 4 e 8]
@Camsbury
Camsbury / anagram-difference.clj
Created September 15, 2019 02:41
Calculate the number of chars to remove to make two strings anagrams of each other.
(ns anagram-difference)
(defn add-to-bag [bag item]
(update bag item (fnil inc 0)))
(defn sub-from-bag [bag item]
(update bag item (fnil dec 0)))
(defn anagram-difference [w1 w2]
"Example
let
inherit (import <nixpkgs> {}) fetchFromGitHub;
nixpkgs = import (fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "9ebc6ad944c9e53f58536ef50c64b6f057e5fa4c";
sha256 = "1hv53kw8nwg9k3kim19ykbmn3yksgmlw1gjbd6d5midhmjjc6mhv";
});
overlays = [(self: super: {
python36 = super.python36.override {
print ("Hello")
#Set the frogs variable
frogs = 2
print ("Here are {} frogs".format(frogs)
suggestion = "Let's breed them"
respect = ", don't watch it's rude"
initialization = (suggestion + respect)
def double_frogs(frogs):
"""Doubles your frogs!"""
def double_frogs(frogs):
"""Doubles your frogs!"""
return frogs * 2