This preview shows page 1. Sign up to view the full content.
Unformatted text preview: which produces the number of strings in a list of nonempty strings which begin with either “A” or “a”.
;; count-start-Aa: ( list of string ) → num
;; produces the number of strings, in los which begin with either “A” or “a”.
;; example: ( count-start-Aa ) ( list “aBc” “bdf” “Abaaa” ) ) → 2
( define ( count-start-Aa los ) b) [10 marks ] Create a function lengths which consumes a list of strings and produces a list of
numbers, of the same length, containing the lengths, in order, of each string in the original list.
;; lengths: ( list of string ) → ( list of num )
;; produces list of numbers which contains the lengths of all strings in los
;; example: ( lengths ( list “a” “” “ABC-123” ) ) → ( list 1 0 7 )
( define ( lengths los ) c) [ 10 marks ] Create a function same-start-end which consumes a list of strings and produces a list of
strings from it containing only those strings in which the f...
View Full Document
This note was uploaded on 10/24/2009 for the course CS 115 taught by Professor Graham during the Fall '08 term at Waterloo.
- Fall '08