Skip to content

Instantly share code, notes, and snippets.

View hauntedhost's full-sized avatar
💭
👻

Jules Omlor hauntedhost

💭
👻
View GitHub Profile
@hauntedhost
hauntedhost / ElmUpdateField.elm
Created August 2, 2015 22:58
elm-lang set record by field functon
records = { a = 1, b = 2, c = 3 }
fieldSet r v = { r | a <- v }
updateField r f = f r
updateField fieldSet 5
@hauntedhost
hauntedhost / guess.clj
Last active December 9, 2022 19:15
guess the number game in clojure, elixir, haskell
(defn play [answer lo hi]
(let [guess (quot (+ lo hi) 2)]
(println (str "Hmm, is it " guess "?"))
(cond
(< guess answer) (recur answer (inc guess) hi)
(> guess answer) (recur answer lo (dec guess))
:else (println (str "Yep! It's " guess "!")))))
; guess.core=> (play 3 1 100000)
; Hmm, is it 50000?
@hauntedhost
hauntedhost / hacker-book-club-3.md
Last active August 29, 2015 14:21
hacker book club v3
  • Functional Programming for the Object-Oriented Programmer - We need something to bridge the gap between the huge population of OO programmers, and the growing need for functional programmers. I’ve seen nothing else that fills this need so well -- @unclebobmartin
  • The Joy of Clojure (2nd Edition) - I've read a couple dozen programming books in my day, but Joy of Clojure stands out as one of my all-time favorites. [...] I've read all of the Clojure books to date and I whole-heartedly recommend Joy of Clojure as the best of the bunch. -- @devn
  • Understanding Computation - If you haven’t read "SICP", don't feel guilty. Instead, read "Understanding Computation" by @tomstuart. Quick. Easy. And very good. -- @raganwald
  • Introduction to Haskell - Brent Yorgey's course is the best I've found so far. This course is valuable as it wil
@hauntedhost
hauntedhost / learn-clojure.md
Last active August 29, 2015 14:20
clojure learning resources

free:

paid:

@hauntedhost
hauntedhost / learn-haskell.md
Last active January 30, 2022 12:58
haskell learning resources

free:

@hauntedhost
hauntedhost / mixed_map.rb
Last active February 19, 2016 15:47
mixed map in ruby
items = { item_name_1: "Great Deal",
item_options_2: "blah: 2",
item_name_2: "Awesome Deal",
item_options_1: "foo: 3",
item_quantity_1: "1",
item_price_2: "9.99",
item_price_1: "9.99",
itemCount: "2" }
def item_key_index(key)
@hauntedhost
hauntedhost / mixed-map.clj
Last active February 19, 2016 15:47
mixed map in clojure hack (wip)
(def items {:item_name_1 "Great Deal",
:item_options_2 "blah: 2",
:item_name_2 "Awesome Deal",
:item_options_1 "foo: 3",
:item_quantity_1 "1",
:item_price_2 "9.99",
:item_price_1 "9.99",
:itemCount "2"})
(def item-keys