正在加载图片...
6.001, Spring Semester, 2005-Quiz I- Sample Solutions Part 3:(20 points) Now suppose that we want to retrieve entries from the database that satisfy certain constraints For example, we might want to get all the entries of people with the position of hacker", or we might want to get the entries of people whose first name is"Jane, or all the entries of people with alaries between 25000 and 50000. Remember our procedure (define (filter pred lst) (cond ((nulls lst) nil) ((pred (car lst))(cons (car lst)(filter pred (cdr lst)))) Else (filter Question 9: We want a way of getting entries from the database with a particular first name (where by first name, we mean the first of the "given"names, not the family name). You may assume that every entry in the database has at least one given name. You may also find the procedure stringrt, which compares two strings, to be usefu Complete the following code so that, for example, filter (called-by jane") sampledata Value:(((doe"jane"elizabetH) 3T000 "assistant") (define (called-by nam solution (lambda (x)(string=s name (car (given-names (names x)))) Question 10: Suppose we want to find all the people who have salaries at least as large as a specified amount, and who hold a particular position (filter (salary-and-position 60000"Cacker") sampledat 1ue:((("j nne""marie""Cbatcer")60000 "Hacker ") Complete the following code fragment (define(salary-and-position minimum posn) solution (lambda (entry) (and (>=(salary entry minimum (string=s (position entry) position)))￾✁✂✂✄☎ ✆✝✞✟✠✡ ✆☛☞☛ ✌✍☛✞ ☎ ✎ ✂✂✏✑✒✓✟✔ ✕ ✖ ✆✗☞✝✘☛ ✆✙✘✓✍✟✙✠✌ ✥ ✚✵✛✻ ❏✢ ✣✤✥ ✷✺✰✼✻✽✦ ✡✘❇ ✪✤✒✒✘✪✑ ✕❄✓✕ ❇✑ ❇✓✗✕ ✕✘ ✔✑✕✔✜✑❈✑ ✑✗✕✔✜✑✪ ✙✔✘✖ ✕❄✑ ✣✓✕✓❋✓✪✑ ✕❄✓✕ ✪✓✕✜✪✙❉ ✛✑✔✕✓✜✗ ✛✘✗✪✕✔✓✜✗✕✪✦ ☞✘✔ ✑✧✓✖✒✚✑✫ ❇✑ ✖✜✢❄✕ ❇✓✗✕ ✕✘ ✢✑✕ ✓✚✚ ✕❄✑ ✑✗✕✔✜✑✪ ✘✙ ✒✑✘✒✚✑ ❇✜✕❄ ✕❄✑ ✒✘✪✜✕✜✘✗ ✘✙ ✫❄✓✛❊✑✔✫✫ ✘✔ ❇✑ ✖✜✢❄✕ ❇✓✗✕ ✕✘ ✢✑✕ ✕❄✑ ✑✗✕✔✜✑✪ ✘✙ ✒✑✘✒✚✑ ❇❄✘✪✑ ★✔✪✕ ✗✓✖✑ ✜✪ ✫￾✓✗✑✫✫ ✘✔ ✓✚✚ ✕❄✑ ✑✗✕✔✜✑✪ ✘✙ ✒✑✘✒✚✑ ❇✜✕❄ ✪✓✚✓✔✜✑✪ ❋✑✕❇✑✑✗ ✬✭✧✧✧ ✓✗✣ ✭✧✧✧✧✦ ❏✑✖✑✖❋✑✔ ✘✤✔ ✒✔✘✛✑✣✤✔✑❍ ❁❂❃❄❅❆❃ ❁❄❅❑☎❃✄ ☛✄❃❂ ❑✁☎❉ ❁ ✠✟❆❂ ❁❁❆✆❑❑✁ ❑✁☎❉ ❆❅❑❉ ❁❁☛✄❃❂ ❁ ✠▲✄ ❑✁☎❉❉ ❁ ✠✟❆✁ ❁ ✠▲✄ ❑✁☎❉ ❁❄❅❑☎❃✄ ☛✄❃❂ ❁ ✠❂✄ ❑✁☎❉❉❉❉ ❁❃❑✁❃ ❁❄❅❑☎❃✄ ☛✄❃❂ ❁✠❂✄ ❑✁☎❉❉❉❉❉ ✮✯✹✽✻✰✺✼ ✂✢ ◗✑ ❇✓✗✕ ✓ ❇✓❉ ✘✙ ✢✑✕✕✜✗✢ ✑✗✕✔✜✑✪ ✙✔✘✖ ✕❄✑ ✣✓✕✓❋✓✪✑ ❇✜✕❄ ✓ ✒✓✔✕✜✛✤✚✓✔ ★✔✪✕ ✗✓✖✑ ✩❇❄✑✔✑ ❋❉ ★✔✪✕ ✗✓✖✑✫ ❇✑ ✖✑✓✗ ✕❄✑ ★✔✪✕ ✘✙ ✕❄✑ ✫✢✜❈✑✗✫ ✗✓✖✑✪✫ ✗✘✕ ✕❄✑ ✙✓✖✜✚❉ ✗✓✖✑✬✦ ✎✘✤ ✖✓❉ ✓✪✪✤✖✑ ✕❄✓✕ ✑❈✑✔❉ ✑✗✕✔❉ ✜✗ ✕❄✑ ✣✓✕✓❋✓✪✑ ❄✓✪ ✓✕ ✚✑✓✪✕ ✘✗✑ ✢✜❈✑✗ ✗✓✖✑✦ ✎✘✤ ✖✓❉ ✓✚✪✘ ★✗✣ ✕❄✑ ✒✔✘✛✑✣✤✔✑ ✂✱✮✯✸✡✄☎✫ ❇❄✜✛❄ ✛✘✖✒✓✔✑✪ ✕❇✘ ✪✕✔✜✗✢✪✫ ✕✘ ❋✑ ✤✪✑✙✤✚✦ ☎✘✖✒✚✑✕✑ ✕❄✑ ✙✘✚✚✘❇✜✗✢ ✛✘✣✑ ✪✘ ✕❄✓✕ ✫ ✙✘✔ ✑✧✓✖✒✚✑✫ ❁❄❅❑☎❃✄ ❁✠▲❑❑❃❂❋◆✁ ✄✆▲❆❃✄❉ ✁▲▼☛❑❃❂▲☎▲❉ ✄☎▲❑✆❃ ✝ ❁❁❁✄❂✟❃✄ ✄✆▲❆❃✄ ✄❃❑❅✞▲◆❃☎☎ ✄❉ ✡✟✝✝✝ ✄▲✁✁❅✁☎▲❆☎✄❉❉ ❁❂❃❄❅❆❃ ❁ ✠▲❑❑❃❂❋◆✁ ❆▲▼❃❉ ✽✺✸✯✻✰✺✼✢ ❁❑▲▼◆❂▲ ❁ ✆❉ ❁ ✁☎✄❅❆✞✝✁ ❆▲▼❃ ❁ ✠▲✄ ❁ ✞❅✡❃❆❋❆▲▼❃✁ ❁ ❆▲▼❃✁ ✆❉❉❉❉❉ ✮✯✹✽✻✰✺✼ ✜✥✢ ✄✤✒✒✘✪✑ ❇✑ ❇✓✗✕ ✕✘ ★✗✣ ✓✚✚ ✕❄✑ ✒✑✘✒✚✑ ❇❄✘ ❄✓❈✑ ✪✓✚✓✔✜✑✪ ✓✕ ✚✑✓✪✕ ✓✪ ✚✓✔✢✑ ✓✪ ✓ ✪✒✑✛✜★✑✣ ✓✖✘✤✗✕ ✫ ✓✗✣ ❇❄✘ ❄✘✚✣ ✓ ✒✓✔✕✜✛✤✚✓✔ ✒✘✪✜✕✜✘✗✦ ❁❄❅❑☎❃✄ ❁ ✁▲❑▲✄✁❋▲❆❂❋☛✟✁❅☎❅✟❆ ■✝✝✝✝ ✄☎▲✠￾❃✄✄❉ ✁▲▼☛❑❃❂▲☎▲❉ ✄☎▲❑✆❃ ✝ ❁❁❁✄✆✟❆❃✁✄ ✄▲❆❆❃✄ ✄▼▲✄❅❃✄ ✄☎❃▲☎☎❃✄✄❉ ■✝✝✝✝ ✄☎▲✠￾❃✄✄❉❉ ☎✘✖✒✚✑✕✑ ✕❄✑ ✙✘✚✚✘❇✜✗✢ ✛✘✣✑ ✙✔✓✢✖✑✗✕❍ ❁❂❃❄❅❆❃ ❁ ✁▲❑▲✄✁❋▲❆❂❋☛✟✁❅☎❅✟❆ ▼ ❅❆❅▼✆▼ ☛✟✁❆❉ ✽✺✸✯✻✰✺✼✢ ❁❑▲▼◆❂▲ ❁❃❆☎✄✁❉ ❁▲❆❂ ❁✺✝ ❁✁▲❑▲✄✁ ❃❆☎✄✁❉ ▼ ❅❆❅▼✆▼ ❉ ❁ ✁☎✄❅❆✞✝✁ ❁ ☛✟✁❅☎❅✟❆ ❃❆☎✄✁❉ ☛✟✁❅☎❅✟❆❉❉❉
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有