Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language Scheme R5RS 2. Familiarize yourself with the following Scheme procedures 1. (string-length abc) produces 3 2. (string-length ) produces 0 3. (substring hello world

Language Scheme R5RS

image text in transcribedimage text in transcribed

2. Familiarize yourself with the following Scheme procedures 1. (string-length "abc") produces 3 2. (string-length ") produces 0 3. (substring "hello world" 0 5) produces "hello" 4. (string"? "hello" "good bye") produces #f 5. (string-ci.? "hello" "HELLO") produces #t (a) Define a recursive procedure my-str-len taking one string argument You must use the following procedure, (define (my-substr s) (cond ( (strings? (else s , ,) , , ) (b) Define a recursive procedure substring? taking two arguments sstr and main-str that if sstr is a substring of main-str Use only the string functions: string-length, substring and string-? (c) Write a recursive procedure string-reverse that takes a single argument in-string. The procedure string-reverse takes its argument in-string and returns its reverse For example, (string-reverse 'dad n mom,,) produces '"mom n dad" The next helper function may be useful (define (substr-ref str n) (substring str n (+ n 1))) 2. Familiarize yourself with the following Scheme procedures 1. (string-length "abc") produces 3 2. (string-length ") produces 0 3. (substring "hello world" 0 5) produces "hello" 4. (string"? "hello" "good bye") produces #f 5. (string-ci.? "hello" "HELLO") produces #t (a) Define a recursive procedure my-str-len taking one string argument You must use the following procedure, (define (my-substr s) (cond ( (strings? (else s , ,) , , ) (b) Define a recursive procedure substring? taking two arguments sstr and main-str that if sstr is a substring of main-str Use only the string functions: string-length, substring and string-? (c) Write a recursive procedure string-reverse that takes a single argument in-string. The procedure string-reverse takes its argument in-string and returns its reverse For example, (string-reverse 'dad n mom,,) produces '"mom n dad" The next helper function may be useful (define (substr-ref str n) (substring str n (+ n 1)))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions