RU beehive logo ITEC dept promo banner
ITEC 380
2015fall
ibarland

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)

hw02b
defining functions
hw02b

Due:
Section 01: Sep.14 (Mon) 15:00, on D2L and hardcopy
Section 11: Sep.17 (WedThu) 19:00, D2L.
Your submitted file should be named “hw02b.rkt” as plain-text (which is what DrRacket saves as).

Standard instructions for all homeworks:

It's intended that you complete hw02 (on D2L) before working on this problem.

Follow the design recipe, steps 4,5,7,8. (You don't need to label each step; just turn in the final result.)

  1. (15pts) Write the function has-suffix?, which takes in two strings and returns whether or not the first string ends with (the letters of) the second.1.
    hint:You can certainly use cond (or if) if you like, but they're not actually needed; you can instead use a min or max in a clever (but standard) way.

1 If in doubt about exactly what constitutes a suffix, here's a definition: We say that string a has b as a suffix, iff: there exists a string x such that (string=? a (string-append x b)).

We'll see later how, in a declarative language (Prolog), this definition is runnable code.

     

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)


©2015, Ian Barland, Radford University
Last modified 2015.Sep.16 (Wed)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.