add bill of materials
authordaniel watson <ozzloy@gmail.com>
Thu, 5 Sep 2013 01:53:24 +0000 (18:53 -0700)
committerdaniel watson <ozzloy@gmail.com>
Sun, 8 Sep 2013 01:20:19 +0000 (18:20 -0700)
bill-of-materials.rkt [new file with mode: 0755]

diff --git a/bill-of-materials.rkt b/bill-of-materials.rkt
new file mode 100755 (executable)
index 0000000..a5af034
--- /dev/null
@@ -0,0 +1,46 @@
+#! /usr/bin/env racket
+#lang racket
+
+(module+ main
+  (displayln total-cost))
+
+(struct item (description quantity unit-cost max-lead-days where-to-get))
+
+(define bill-of-materials
+  (list
+   (item "Arduino(tm) board"
+         1 21 8 (string-append "http://store.mp3car.com/"
+                               "Genuine_Arduino_Uno_R3_SMD_p/OPN-013B.htm"
+                               "?gclid=CKizyYOKsrkCFap7Qgod9kgAOQ"))
+   (item "USB a to b" 1 4 7 "https://www.sparkfun.com/products/512")
+   (item "wheel" 2 3 7 "http://www.pololu.com/catalog/product/184")
+   (item "motor" 2 6 7 "http://www.pololu.com/catalog/product/181")
+   (item "half BreadBoard" 1 5 3 "http://www.adafruit.com/products/64")
+   (item "jumper wire male/male assorted lengths"
+         1 6 3 "http://www.adafruit.com/products/153")
+   (item "jumper wire female/male" 1/5 6 2
+         (string-append "http://www.nexuscyber.com/"
+                        "7-premium-40-pin-male-to-female-jumper-wires"))
+   (item "small squares of double sided tape"
+         1/30 12 1
+         (string-append
+          "http://www.officedepot.com/"
+          "a/products/495242/Scotch-Permanent-Double-Sided-Foam-Tape/"))
+   (item "#4-40 Phillips 1/2 inch flat-head screws"
+         3 .1 1 "home depot, lowes")
+   (item "#4-40 hex nuts"
+         6 .1 1 "home depot, lowes")
+   (item "#4 lock washers"
+         3 .1 1 "home depot, lowes")
+   (item "Red LEDs"
+         2 .1 1 "evil mad science?")
+   (item "Yellow LEDs"
+         2 .1 1 "evil mad science?")
+   (item "Green LEDs"
+         2 .1 1 "evil mad science?")
+   (item "330 Ohm Resistors"
+         6 .1 1 "evil mad science?")))
+
+(define total-cost
+  (apply + (for/list ([thing bill-of-materials])
+             (* (item-quantity thing) (item-unit-cost thing)))))