I hereby claim:
- I am isaacsu on github.
- I am isaacsu (https://keybase.io/isaacsu) on keybase.
- I have a public key whose fingerprint is 6A25 F38F 2BBF 1A98 98D5 D118 13E4 CCE5 4648 52C6
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
/** | |
* Gatling gun takes an array of valid params and returns every | |
* combination of invalid data caused by blanking out individual params. | |
* | |
* Example: | |
* | |
* $validData = array('firstName' => 'Gatling', 'lastName' => 'Gun', 'age' => 12); | |
* $ggData = gatlingGun($validData); | |
* |
(defn sim-distance [critic1 critic2] | |
; work out movies that both critics have rated | |
(let [shared-movies | |
((fn [c1 c2] | |
(map #(first %) (filter #(c2 (first %)) c1))) critic1 critic2)] | |
; return 0 if they have no ratings in common | |
(if (= (count shared-movies) 0) | |
0 | |
; compute distance | |
(/ 1 (+ 1 (reduce + (map #(expt (- (critic1 %) (critic2 %)) 2) shared-movies))))))) |
# Returns a distance-based similarity score for person1 and person2 | |
def sim_distance(prefs,person1,person2): | |
# Get the list of shared_items | |
si={} | |
for item in prefs[person1]: | |
if item in prefs[person2]: | |
si[item]=1 | |
# if they have no ratings in common, return 0 | |
if len(si)==0: return 0 |
This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.
It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.