; Jason Dodd ; CS 326 ; Scheme Project ; 10/17/2001 ;######################################## ;## Part 1, find winners for a ## ;## particular year ## ;######################################## (define winnersFoundCount 0) ; Used to check if any matches were found (define (last mylist) ; Locates the last element in a list (if (null? (cdr mylist)) (car mylist) (last (cdr mylist)) ) ) (define(displayWinner blist) ; Outputs first, last, and field names (display(cadr blist)) ; separated by spaces to the screen (display" " ) (display(car blist)) (display" ") (display(cadddr blist)) (newline) (set! winnersFoundCount 1) ) (define (checkYear year alist) ; Finds if a winner exists for a specified year (if (= year (last alist) ) (displayWinner alist ) ) ) (define (findWinners year mylist) ; Recurses through list of winners to see (checkYear year (car mylist)) ; if one exists for a specified year (if(null? (cdr mylist)) ; ends when at end of list (newline) (findWinners year (cdr mylist)) ) ) (define (winners year) ; Main function, called by user to find all (newline) ; winners for a user specified year (findWinners year ilist) (if (= winnersFoundCount 0) (display "No Matches found for the specified year" ) ) (newline) (newline) (set! winnersFoundCount 0) ) ;################################################################################ ;######################################## ;## Part 2, find info about a ## ;## particular person ## ;######################################## (define whoFoundCount 0) ; Used to count if any matches were found (define (displayWho blist) ; Outputs first, last, project name and year (display (cadr blist)) ; to the screen (display " ") (display (car blist)) (display ", ") (display (cadddr blist)) (display ", ") (display (caddr blist)) (newline) (set! whoFoundCount 1) ) (define (checkName name alist) ; Finds if a name matches existing last name in a list (if (equal? name (car alist)) (displayWho alist) ) ) (define (findWho name mylist) ; Recurses through list, calls checkName to check if name exists (checkName name (car mylist)) (if(null? (cdr mylist)) (newline) (findWho name (cdr mylist)) ) ) (define (who name) ; User passes a name, who will find the name if it exists (newline) (findWho name ilist) (if (= whoFoundCount 0) (display "No Matches found for the specified name" ) ) (newline) (newline) (set! whoFoundCount 0) ) ;################################################################################## ;######################################## ;## Part 3, find info about a ## ;## particular person ## ;######################################## (define memberFoundCount 0) ; Used to count if any matches were found (define (displayFieldMembers blist ) ; Outputs first and last names as well as year (display (cadr blist)) ; to screen (display " ") (display (car blist)) (display " ") (display (last blist)) (newline) (set! memberFoundCount 1) ) (define (checkField fieldName alist) ; Finds if the field specified matches the field in a sublist (if (equal? fieldName (cadddr alist)) ; of ilist (displayFieldMembers alist) ) ) (define (findFieldMembers fieldName mylist) ; Recurses through list to find if specified field name exists (checkField fieldName (car mylist)) (if (null? (cdr mylist)) (newline) (findFieldMembers fieldName (cdr mylist)) ) ) (define (field fieldName) ; User passes a field name, field will check if that field has won an ig nobel prize (newline) (findFieldMembers fieldName ilist) (if (= memberFoundCount 0) (display "No Matches found for the specified field" ) ) (newline) (newline) (set! memberFoundCount 0) ) ;################################################################################### ;######################################## ;## List Definition ## ;## Ig Nobel Prize Winners ## ;######################################## (define ilist '(("Kreuger" "Justin" "How Difficulties in Recognizing One's Own Incompetence Lead to Inflated Self-Assessments" "Psychology" 2000) ("Wassersug" "Richard" "On the Comparative Palatability of Some Dry-Season Tadpoles from Costa Rica" "Biology" 2000) ("Geim" "Andre" "For Using Magnets To Levitate A Frog And A Sumo Wrestler" "Physics"2000) ("Marazziti" "Donatella" "Biochemically, Romantic Love May Be Indistinguishable From Having Severe Obsessive-Compulsive Disorder" "Chemistry" 2000) ("Niswander" "Chris" "Pawsense Software That Detects When A Cat Is Walking Across Your Computer Keyboard" "Computer Science" 2000) ("British Royal Navy" "The" "For Ordering Its Sailors To Stop Using Live Cannon Shells, And To Instead Just Shout Bang!" "Peace" 2000) ("Wyatt" "Jonathan" "The Collapse of Toilets in Glasgow" "Public Health" 2000) ("Penfold" "Steve" "On The Sociology Of Canadian Donut Shops" "Sociology" 1999) ("Fisher" "Len" "Calculating The Optimal Way To Dunk A Biscuit" "Physics" 1999) ("Vanden-Broeck" "Jean-Marc" "Calculating How To Make A Teapot Spout That Does Not Drip" "Physics" 1999) ("British Standards Institution" "The" "Specification BS-6008: The Proper Way To Make A Cup Of Tea" "Literature" 1999) ("Kansas State Board of Education" "The" "Debunking Evolution, Gravitation, Electromagnetism, And Germs Theory Of Disease" "Science Education" 1999) ("Vatle" "Arvid" "Collecting, Classifying, And Contemplating Which Kinds Of Containers Patients Choose When Submitting Urine Samples" "Medicine" 1999) ("Makino" "Takeshi" "S-Check, An Infidelity Detection Spray That Wives Can Apply To Their Husbands' Underwear" "Chemistry" 1999) ("Kwon" "Hyuk-ho" "The Self-Perfuming Business Suit" "Environmental Protection " 1999) ("Fourie" "Charl" "An Automobile Burglar Alarm Consisting Of A Detection Circuit And A Flamethrower" "Peace" 1999) ("Blonsky" "George" "Childbirth Aid:The Woman Is Strapped Onto A Circular Table Which Is Rotated At High Speed" "Managed Health Care" 1999) ("Hurtubise" "Troy" "Developing A Suit Of Armor That Is Impervious To Grizzly Bears" "Safety Engineering" 1998) ("Fong" "Peter" "Contributing To The Happiness Of Clams By Giving Them Prozac" "Biology" 1998) ("Benveniste" "Jacques" "Water Has Homeopathic Memory; Can Be Transmitted Over Telephone Lines" "Chemistry" 1998) ("Krieger" "Dolores" "Demonstrating The Merits Of Therapeutic Touch" "Science Education" 1998) ("Chopra" "Deepak " "Quantum Physics As It Applies To Life, Liberty, And The Pursuit Of Economic Happiness" "Physics"1998) ("Mills" "Caroline" "A Man Who Pricked His Finger and Smelled Putrid for 5 Years" "Medicine" 1998) ("Sidoli" "Mara" "Farting as a Defense Against Unspeakable Dread" "Literature" 1998) ("Yagyu" "T" "For Measuring People's Brainwave Patterns While They Chewed Different Flavors Of Gum" "Biology" 1997) ("Hostetler" "Mark" "That Gunk On Your Car: Identifying The Insect Splats That Appear On Automobile Windows" "Entomology" 1997) ("Hoagland" "Richard" "Identifying Faces And Giant Buildings On The Moon And Mars" "Astronomy " 1997) ("Witztum" "Doron" "Statistical Discovery That The Bible Contains A Secret, Hidden Code The Bible Code" "Literature" 1997) ("Charnetski" "Carl J." "Listening To Elevator Muzak Stimulates Immunoblobulin A Production, And Thus May Help Prevent The Common Cold" "Medicine" 1997) ("Vonnegut" "Bernard" "Chicken Plucking as Measure of Tornado Wind Speed" "Meteorology" 1997) ("Barheim" "Anders" "Effect of Ale, Garlic, and Soured Cream on the Appetite of Leeches" "Biology" 1996) ("Matthews" "Robert" "For Demonstrating That Toast Often Falls On The Buttered Side" "Physics" 1996) ("Chirac" "Jacques" "Commemorating The Fiftieth Anniversary Of Hiroshima With Atomic Bomb Tests In The Pacific" "Peace" 1996) ("Kleist" "Ellen" "Transmission of Gonorrhea Through an Inflatable Doll" "Public Health" 1996) ("Goble" "George" "Igniting A Barbeque Grill-Three Seconds, Using Charcoal And Liquid Oxygen" "Chemistry" 1996) ("Okamura" "Chonosuke" "Discovering Miniature Fossils Of Dinosaurs, Horses, Dragons, And Princesses" "Biodiversity" 1996) ("Genco" "Robert J" "Financial Strain Is A Risk Indicator For Destructive Periodontal Disease" "Economics" 1996) ("Georget " "D.M.R." "A Study Of The Effects Of Water Content On The Compaction Behaviour Of Breakfast Cereal Flakes" "Physics" 1995) ("Leeson " "Nick " "Using The Calculus Of Derivatives To Demonstrate That Every Financial Institution Has Its Limits" "Economics" 1995) ("Buebel" "Marcia E" "The Effects of Unilateral Forced Nostril Breathing on Cognition" "Medicine"1995) ("Watanabe " "Shigeru" "Training Pigeons To Discriminate Between The Paintings Of Picasso And Those Of Monet " "Psychology"1995) ("Bakkevig " "Martha Kold" "Impact of Wet Underwear on Thermoregulatory Responses and Thermal Comfort in the Cold" "Public Health" 1995) ("Beaumont " "Robert H. " "Patient Preference for Waxed or Unwaxed Dental Floss" "Dentistry"1995) ("Japanese Meterological Agency " "The"" Seven-Year Study Of Whether Earthquakes Are Caused By Catfish Wiggling Their Tails" "Physics" 1994) ("Schiffman " "Jay " "AutoVision, An Image Projection Device That Makes It Possible To Drive A Car And Watch Television At The Same Time " "Visionary Technology"1993) ("Faid " "Robert ""Calculating The Exact Odds (8,606,091,751,882:1) That Mikhail Gorbachev Is The Antichrist" "Mathematics"1993) ("Kervran" "Louis" "Calcium In Chickens' Eggshells Is Created By A Process Of Cold Fusion " "Physics"1993) ("Bassa" "Ivette" "Synthesis Of Bright Blue Jell-O" "Chemistry"1992) ))