845aa5f9 |
1 | #! /usr/bin/env racket |
2 | #lang racket |
3 | |
4 | (module+ main |
5 | (displayln total-cost)) |
6 | |
7 | (struct item (description quantity unit-cost max-lead-days where-to-get)) |
8 | |
9 | (define bill-of-materials |
10 | (list |
11 | (item "Arduino(tm) board" |
12 | 1 21 8 (string-append "http://store.mp3car.com/" |
13 | "Genuine_Arduino_Uno_R3_SMD_p/OPN-013B.htm" |
14 | "?gclid=CKizyYOKsrkCFap7Qgod9kgAOQ")) |
15 | (item "USB a to b" 1 4 7 "https://www.sparkfun.com/products/512") |
16 | (item "wheel" 2 3 7 "http://www.pololu.com/catalog/product/184") |
17 | (item "motor" 2 6 7 "http://www.pololu.com/catalog/product/181") |
18 | (item "half BreadBoard" 1 5 3 "http://www.adafruit.com/products/64") |
19 | (item "jumper wire male/male assorted lengths" |
20 | 1 6 3 "http://www.adafruit.com/products/153") |
21 | (item "jumper wire female/male" 1/5 6 2 |
22 | (string-append "http://www.nexuscyber.com/" |
23 | "7-premium-40-pin-male-to-female-jumper-wires")) |
24 | (item "small squares of double sided tape" |
25 | 1/30 12 1 |
26 | (string-append |
27 | "http://www.officedepot.com/" |
28 | "a/products/495242/Scotch-Permanent-Double-Sided-Foam-Tape/")) |
29 | (item "#4-40 Phillips 1/2 inch flat-head screws" |
30 | 3 .1 1 "home depot, lowes") |
31 | (item "#4-40 hex nuts" |
32 | 6 .1 1 "home depot, lowes") |
33 | (item "#4 lock washers" |
34 | 3 .1 1 "home depot, lowes") |
35 | (item "Red LEDs" |
36 | 2 .1 1 "evil mad science?") |
37 | (item "Yellow LEDs" |
38 | 2 .1 1 "evil mad science?") |
39 | (item "Green LEDs" |
40 | 2 .1 1 "evil mad science?") |
41 | (item "330 Ohm Resistors" |
42 | 6 .1 1 "evil mad science?"))) |
43 | |
44 | (define total-cost |
45 | (apply + (for/list ([thing bill-of-materials]) |
46 | (* (item-quantity thing) (item-unit-cost thing))))) |