CSC104H1 Lecture Notes - Lecture 16: Substring

41 views1 pages

Document Summary

> ;we can use it to get nested lists of the webpage data (define html (read-xexpr/web "http://www. english. utoronto. ca/about. htm")) > ;working just with the data named html (check-expect (list? html) #true) > ;html has 4 elements, last one has most of the data in it (define (flatten anything) (cond [(list? anything) (apply append (map flatten anything))] > ;let us find the paragraphd in the webpage. ; paragraphs are long strings, > 200 characters. ; we could use cond (define (long-string thing) (and (string? thing) (> (string-length thing) 300))) > ; changed to 300 to get rid of map link to utsc (step (long-string 5)) steps (long-string 5) > ; to get at the paragraphs we need to get all the links on the page (define (link? thing) (and (string? thing) (<= 4 (string-length thing)) (equal? (substring thing 0 4) "http")))

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents