Questions
Contents
How do I make relative urls in Scheme?
Q: The project folks know how to make a url from a string using (string->url <string>). But what do you do when you just get a relative link from a chunk of html, and not the full http:-qualified url?
Took <a href="/cgi-bin/moin.cgi/StudentFrontPage">StudentFrontPage</a> from the page at http://focs.olin.edu/cgi-bin/moin.cgi/FrontPage
Want "http://focs.olin.edu/cgi-bin/moin.cgi/StudentFrontPage"
A: Keep a handle to the url of the page where you found the relative url, and use (combine-url/relative ...).
Pasted from DrScheme Help Desk: {{{> (combine-url/relative url string) -> url
- Given a base URL and a relative path, combines the two and returns a new URL as per the URL combination specification. Call the arguments base and relative. They are combined according to the following rules (applied in order until one matches): - If either argument is an empty URL, the result is the other
- argument.
- specified below.
- params and query, and the result is relative.
- specification of merging and normalization.}}}
What is `atom?`
Some definitions of scheme seem to have a primitive called atom? Apparently, DrScheme (PLTScheme) doesn't. Here it is:
(define (atom? x) (not (pair? x))
What is a continuation?
You do not need to know about continuations at this point, but they're pretty cool. A continuation is the where-the-program's-going-next context. Here are some resources if you want to learn more:
Paul Graham on continuations in web programming (Search for "Continuations simulate subroutines"
What about formalizing shell sort?
You do not need to know these details, but for the interested here is some more information about shell sort:
- Analyses:
- Also description, algorithm:
- Anecdote: