text:
fightmagazine.com |
North Philly native Anthony Morrison, 26, is one of the best 145-pound Mixed Martial Arts (MMA) fighters in the world. He fights for World Extreme Cagefighting (WEC), a 10-year-old company that, in the past 18 months, has surged in front of a sea of competing MMA promotions. This Saturday is WEC 48, the brand's inaugural Pay-Per-View event the first (and possibly only) chance to galvanize its emergence. Morrison is on the undercard, meaning he will only be televised if 1) he fights his ass off and 2) some quick knockouts on the main card free up time in the broadcast.
So I why is Morrison important?
This event should succeed, as WEC is pulling out everything in its arsenal. The real question is if the company can maintain its momentum. That is where Morrison comes in. He's one of many young contenders trying to distinguish himself of course, they need to win, to do that but they also need to become a draw. Basically, a fighter needs to have aggression and style that makes the fans call for more. Those who draw attention keep fighting and keep the promotion going.
Morrison still lives and trains in North Philly, save for excursions out of state to work with other camps. We caught up to Cheesesteak while wrapping up a training session in Georgia earlier this week.
Charles Cieri: Before we go through your rise to prominence, can you talk about "dojo crashing" back in the day?
Anthony Morrison: Funds was low. I used to go to a gym and see the free week pass [promotional trial offer]. I knew if I beat people up straight of the gate, they would be like "sign the contact" and I knew I didnt have anything to pay them with. After a while, people seen my passion and some gyms would let me train and say, "pay us when you can."
CC: Now that everyone knows not to get lippy with that new white belt at their gym. How did you get started on the path?
AM: Because of my stature I was a real small kid I was automatically a target for bullies and I used to tear them apart. After awhile, I started proclaiming myself the bully of bulliers. I had a little mean streak in me. Maybe its my Napoleon complex. If you came up picking for me, I didnt turn down no fights.
CC: When did the fighting start getting structured?
AM: I was 14, 15 ... I saw boxing and thought I could do it. I wrestled in high school and that was a good passion for me. I had three older brothers and, not thinking we were training by roughing each other up, [but] it was being bred into me. I started putting it all together in 2002. One day I was watching UFC 39, and I thought, "I can do that it's wrestling and boxing." I started training at my friend's house. We would move everything out of the living room and me and him would just go over what I already knew and put together what I saw on TV. Within two months of [competing], I beat two guys in one night that had way more MMA training. I was [training] out my friends living room and ran up my record to 5-0 until I ran up against a guy with more experience. As far as wrestling and boxing, no one could take me, but it was a guy with the jiu-jitsu. Thats when I realized jiu-jitsu is a big factor.
CC: Let's skip ahead a bit. Did things keep rolling, or were there bumps?
AM: Hell yeah, man. I messed up my back real bad and got pressured into a fight where I ended up losing because of the injury. I said, Im sick of this. If I had a job with benefits, they wouldve fixed me up with time off and I would have went back to work. It sucked. I stopped fighting for a while and worked two full-time jobs in Plymouth Meeting, 16 hours a day. I would go to Target and work 8 hours, and cross the street and work overnight at Lowe's. I wasnt training at all, but every lunch break I would go over to the Barnes and Nobles and look at fight magazines and see friends I used to train with, and it was motivation. One day, I got tired of it. I ran 6 miles and my lungs were burning. There was a burning desire telling me it was time to compete again to put all my chips in, And that's what I did.
CC: How do you end up on WEC's radar?
AM: I knew they where eyeing me because I was fighting prospects that were looking to get in there. I fought Jeff Lentz, and he is a tough guy out of New Jersey who trains with [UFC 155-pound contender] Kurt Pellegrino. I knew [Lentz] was on the tear, undefeated with wins in a variety of different ways. Then a month before, he knocked someone out in 16 seconds. I was like, "Damn, this guys a fucking beast! Then I went in and demolished him. Then, two weeks latter, for me to go out to Colorado, unacclimated and destroy a guy out there ... I was like, two prospects back to back, plus a lot of people I defeated in a long run they got to have me in their eyes.
CC: Your first fight in the WEC was a tough assignment: Mike Brown, in his first fight after losing his belt. How did you change your game after your debut loss?
AM: The biggest thing I wanted to work on was my life outside the cage. [A] lot of things werent right. Any fighter will tell you if things arent right outside the ring, they wont go right inside. You got to be 100 percent. I focused and dedicated a lot of time to my family and catching up. I got all that together.
CC: I have talked to fighters in the past, specifically BJ Penn and Kurt Pellegrino, who both like you have young kids. They described a need to separate themselves from their kids for a period of time before they fight, because the kids make them too happy and take away their anger. Do you find that to be the case?
AM: I isolate from the distractions, but my family isnt one of them. I train in Philly, and the two fights that got me here, I trained for them in Philly. I just isolate myself from my friends, playing around and the streets.
CC: Lastly, in the Brown fight you were introduced as fighting out of Virginia. You were yelling North Philly into the camera, but still, youre going to sort that announcer out for this fight, right?
AM: When I go back home, it's Philadelphia, and I got a lot of shit from my friends for that. I take pride in where Im from and this time he will most definitely be saying "from Philadelphia." [Morrison gives love to his coaches, Fred Jenkins at ABC Gym in North Philly and Brad Daddis at Daddis Fight Camps in South Philly.]
WEC 48 will be broadcast live on Pay-Per-View this Saturday, April 24, at 10 p.m. ($45 charge). Spike TV will be showing two undercards at 9 p.m.: Alex Karalexis v. Anthony Pettis in the 155-pound division and Leonard Garcia v. Chan Sung Jung in the 145-pound division. The Par-Per-View will also be shown at The Fox and Hound at 15th and Spruce. As of press time, they were not sure if they would charge a $5 cover or show the fights for free.
Social comments and analytics for this post... This post was mentioned on Twitter by citypaper: From @joeblo: Q&A with North Philly MMA contender Anthony "Cheesesteak" Morrison, who fights in WEC 48 tomorrow night. http://bit.ly/9S0Hl2...
[...] Interview: North Philly MMA fighter Anthony Morrison :: Thе Clog :: Blog Archive :: Staff Blog ... [...]
[...] Interview: North Philly MMA fighter Anthony Morrison :: The Clog … Posted in mma fighter | Tags: anthony morrison, contenders, stature, target [...]
Locked in the Cage 2, a Mixed Martial Arts fight featuring pro and amateur cage fights, goes down this Saturday night at the John Perzel Community Center in Northeast Philly.
Locked in the Cage 1 was, by my count, a big success. It was Philly's first major top-to-bottom local MMA show. (Not all fighters were locals but all local MMA gyms were represented and the promoters honored local interests.) The major selling point of that show was pulling off the co-main events featuring genuine Philly standouts Wilson Reis, the former Elite XC champ, and Tara LaRosa, the No. 1-ranked 135-pound female in the world.
This event doesn't have the star power, but it does have citywide representation, as it'll feature Team Balance, Daddis Fight Camps, Fight Firm, Fight Factory, BJJ United and other local institutions. According to co-promoter Fran Evans, LITC2 is designed to address the most pressing task in establishing Philly's local scene building up and refining new pros. Evans believes that this is the key to making homegrown MMA sustainable. If Philly does get a flow going, it can maintain its rep as a fighter's town in a sports world that's seeing MMA grow in relevance at an impressive clip. Otherwise, the local MMA scene will be vulnerable to rickety conditions and exploitation by slash-and-burn promoters.
The event goes down at The John Perzel Community Center (2990 St. Vincent St.) this Saturday night. (The full fight card is here, although some unpublished substitutions have been made.) Doors open at 6 p.m. and the fights start at 7 p.m. Wilson Reis, Fight Factory's Eddie Alvarez and others will be on hand to sign autographs.
Tickets ($40-$90) are available at lockedinthecage.com.
[...] This post was mentioned on Twitter by Philly City Paper, Yancey @YanceyG. Yancey @YanceyG said: Locked in the Cage 2: Local MMA scrambles for a toehold in Northeast Philly: Locked in the Cage 2, a Mixed Martial... http://bit.ly/53kMmW [...]
Two of Philadelphiaâs best mixed martial artists will be on display tonight at Alexandra Hall. Locked in the Cage is headlined by Wilson Reis (check the CP e-trail on Reis) squaring off with Dwayne Sheldon, as well as the top-ranked 135-pound female fighter Tara LaRosa fighting Valerie Coolbraugh. Though they're both based in the area (the Brazilian Reis fights out of Jenkintown's BJJ United, while LaRosa fights out of nearby Woodstown, N.J.), neither athlete has appeared in the ring within city limits until now.
The card features three other pro fights and 12 amateur fights.
LaRosa and Reis are both top-level contenders, known for showing up; the duo alone could make the night. (Check out my Oct. '08 feature for more on Reis.)
Tickets are still available here for $45, or $65 with four 16-ounce beers. Quick math: That's 64 ounces of muscle to help you properly root on our homegrown bloodletters.
The show starts at 7:30 p.m. at at Alexandra Hall in Sherman Mills, 3510 Scotts Lane in East Falls.
- ActiVman
- adventures
- Arts
- Ask A Man-About-Town
- Award Tour
- Awards
- Bad Idea Factory
- Beer
- Below the Curve
- Bikes
- Booze
- Brian Hickey
- Budget
- Budget Fuss
- Business
- Casinos
- City Council
- City Hall
- CouncilMANIC
- CP Abroad
- CP in the Community
- Criminal Justice System
- Day Tripper
- Death and Taxes
- Delaware River
- Design
- Drugs
- Dubious Distinction
- Elections
- End of Days
- Environment
- Fashion
- Film Fest
- Financial Meltdown
- FrackTrack
- Free Library
- Gambling
- Gay Stuff
- Get Lit
- Greenstorming
- guns
- Hall Monitor
- Health
- Health Care
- Hello, Kitty
- Holidays
- Ice Cubes
- Iggles
- Immigration
- In Memoriam
- Labor
- Lawsuits
- Letters
- Maps
- Marcellus Shale
- Media
- Mummers
- Music
- Mysterious Mysteries
- Nation
- News
- Non Sequitur
- Opinion
- PA politics 2010
- Parking Wars
- Parks and Recreation
- People Send Us This Stuff
- Philadelphia Police
- Philadelphia Union
- Philaphemera
- Philly From Scratch
- philly madness
- Photos
- Poverty
- President Obama
- Print Edition
- Prisons
- Protest
- Readers Write
- Real Estate
- Rock Bottom
- Schools
- Science
- Screwing Philly
- snow
- So Lush
- Soccer
- Sporting Life
- Sports Complex
- State Politicians
- State Politics
- Street Art
- Strike
- Stuff We Like
- Taxes
- Taxi Drivers
- Tech Fetish
- television
- The Budget Crisis
- The City Paper
- The CLOG
- The Human Condition
- The Mayor
- The Phightin Phils
- The World
- Things that make you go hm
- Tinfoil Hats Off
- Under the Table
- Under the Tables
- Urban Development
- Urban Planning
- urban wildlife
- Video Poker
- We Call Shenanigans
- Weather
- Web Junk
- Weekend Omnibus
- White House
- What We've Found
- Women's Issues
- Flyered Up!
- How 'Bout That Weather?
- it's always sunny in philadelphia
- Stu!
- Shopping
- get out
- 10-track mind
- ArtsFlash
- Bloggity
- Bruce Being Bruce
- Colleges
- Comedy
- Gigantic Surprises
- Hello Canary
- Hello Puppy
- errata
- get lost
- Inside The Fishbowl
- Library Closings
- Local Support
- Movies
- Murder
- Night Moves
- Recycling
- radio
- Scientology
- Sex
- Sixers
- Skeeze Police
- State Politicians Screwing Philly
- That's a cool stencil!
- Theater
- Things We See
- This Week
- This Week in Oates
- University City
- What we don't heart
- trailer!
- what we heart
- Feeling Guilty
- Askadelphia.
- Broke in Philly
- Contest
- Dance
- Dear Paper Doll
- Do A Good Thing
- Education
- Film Fest Schism
- G20-20 Vision
- Goodbye
- Gossip
- Great American Heroes
- Pearl Jam Week
- Puppy
- Stars of the Photostream
- sustainability
- Lower Merion Webcam-Gate
- The Cycle
- Equality Forum
- Bureaucrat of the Week
- Animals
- ElectionEar
- Photostream


text:
Scorps fall to Outlaws
Chris Thompson entered Tuesday's game against Chico with a 1-0 record and 1.42 ERA in six games as the Scorpions closer.
He left Tuesday's game 1-1 with a 5.63 ERA.
Thompson blew a three-run lead in the ninth and gave up a walkoff home run to Brian McFall with two outs in the 10th in a 5-4 loss to the Outlaws.
The loss was the third in a row for Yuma (30-41) and evened the 12-game series at 5-5.
Before the comeback for Chico (34-38), the Scorpions scored four in the fifth, capped on a two-run home run by Jose Canseco, his eighth of the season.
Yuma outhit the Outlaws 11-8. The teams continue their series at 7:05 tonight.

subset: commoncrawl


text:
IV Intertwined Data
The data definitions for lists and natural numbers stand out due to their self-references. As it turns out, though, many interesting classes of data require even more complex data definitions than these two. Indeed, there is no end to the variations, and it therefore becomes a critical skill for a programmer to take any data definition as the starting point for a program. And that's what the design recipe is all about.
In this part, we first work out a slightly generalized version of the design recipe that works for all forms of structural data definitions. Then we introduce the concept of iterative refinement, which is one of the reasons why all programmers are little scientists. Two more chapters are basically practice on refining data and functions: one on interpreters and one on XML processing. The last chapter expands the design recipe one more time, applying it to function that process two complex arguments at the same time.
22 The Poetry Of S-expressions
Programming resembles poetry in many ways. For example, programmers—
Nevertheless, this chapter shows the full power of the design recipe and introduces you to the kinds of data that real-world programs cope with. To connect this material with what you will encounter in your life as a programmer, we label each section with appropriate names: trees, forests, XML. The last one is a bit misleading, because it is really about S-expressions; the connection between S-expressions and XML is clarified in The Commerce Of XML, which in contrast to this chapter, comes much closer to real-world uses of complex forms of data.
22.1 Trees
All of us have a family tree. One way to draw a family tree is to add a node every time a child is born. From the node, we can draw connections to the father and mother of the child. For those people in the tree whose parents are unknown, there is no connection to draw. The result is a so-called ancestor family tree because, given any person in the tree, we can find all of the person's known ancestors.
Figure 54 displays a three-tier family tree. Gustav is the child of Eva and Fred, while Eva is the child of Carl and Bettina. In addition to people's names and family relationships, the tree also records years of birth and eye colors. Based on this sketch, you can easily imagine a family tree reaching back many generations and one that records other kinds of information.
(define-struct child (father mother name date eyes))
(define Adam (make-child Carl Bettina "Adam" 1950 "hazel"))
(define-struct no-parent ())
(make-child (make-no-parent) (make-no-parent) "Bettina" 1926 "green")
(define-struct no-parent ()) (define-struct child (father mother name date eyes)) ; A FT (family tree) is one of: ; – (make-no-parent) ; – (make-child FT FT String N String)
(define MTFT (make-no-parent)) ; A FT (family tree) is one of: ; – MTFT ; – (make-child FT FT String N String)
(make-child MTFT MTFT "Carl" 1926 "green")
(make-child (make-child MTFT MTFT "Carl" 1926 "green") (make-child MTFT MTFT "Bettina" 1926 "green") "Adam" 1950 "hazel")
; Oldest Generation: (define Carl (make-child MTFT MTFT "Carl" 1926 "green")) (define Bettina (make-child MTFT MTFT "Bettina" 1926 "green")) ; Middle Generation: (define Adam (make-child Carl Bettina "Adam" 1950 "hazel")) (define Dave (make-child Carl Bettina "Dave" 1955 "black")) (define Eva (make-child Carl Bettina "Eva" 1965 "blue")) (define Fred (make-child MTFT MTFT "Fred" 1966 "pink")) ; Youngest Generation: (define Gustav (make-child Fred Eva "Gustav" 1988 "brown"))
; FT -> ??? (define (fun-for-FT a-ftree) (cond [(no-parent? a-ftree) ...] [else ; (child? a-ftree) ...]))
; FT -> ??? (define (fun-for-FT a-ftree) (cond [(no-parent? a-ftree) ...] [else (... (child-father a-ftree) ... ... (child-mother a-ftree) ... ... (child-name a-ftree) ... ... (child-date a-ftree) ... ... (child-eyes a-ftree) ...)]))
; FT -> ??? (define (fun-for-FT a-ftree) (cond [(no-parent? a-ftree) ...] [else (... (fun-for-FT (child-father a-ftree)) ... ... (fun-for-FT (child-mother a-ftree)) ... ... (child-name a-ftree) ... ... (child-date a-ftree) ... ... (child-eyes a-ftree) ...)]))
; FT -> Boolean ; to determine whether a-ftree contains a child ; structure with "blue" in the eyes field (define (blue-eyed-child? a-ftree) (cond [(no-parent? a-ftree) ...] [else (... (child-name a-ftree) ... ... (child-date a-ftree) ... ... (child-eyes a-ftree) ... ... (blue-eyed-child? (child-father a-ftree)) ... ... (blue-eyed-child? (child-mother a-ftree)) ...)]))
(check-expect (blue-eyed-child? Carl) false)
(check-expect (blue-eyed-child? Gustav) true)
Now we are ready to define the actual function. The function distinguishes between two cases: a no-parent node and a child node. For the first case, the answer should be obvious even though we haven't made up any examples. Since the given family tree does not contain any child node whatsoever, it cannot contain one with "blue" as eye color. Hence the result in the first cond clause is false.
(child-name a-ftree) extracts the child's name;
(child-date a-ftree) extracts the child's date of birth
(child-eyes a-ftree), which extracts the child's eye color
according to the purpose statement for blue-eyed-child?, (blue-eyed-child? (child-father a-ftree)) determines whether some node in the father's FT has "blue" eyes; and
(blue-eyed-child? (child-mother a-ftree)) determines whether someone in the mother's FT has blue eyes;
Clearly, if the given child structure contains "blue" in
the eyes field, the function's answer must be true. Furthermore,
the expressions concerning names and birth dates
are useless, which leaves us with the two recursive calls. As stated,
(blue-eyed-child? (child-father a-ftree)) processes the
father's family tree and (blue-eyed-child? (child-mother a-ftree)) the mother's. If either of these expressions returns
true, a-ftree contains a child with
"blue" eyes—
(string=? (child-eyes a-ftree) "blue")
(blue-eyed-child? (child-father a-ftree))
(blue-eyed-child? (child-mother a-ftree))
(or (string=? (child-eyes a-ftree) "blue") (blue-eyed-child? (child-father a-ftree)) (blue-eyed-child? (child-mother a-ftree)))
; FT -> Boolean ; to determine whether a-ftree contains a child ; structure with "blue" in the eyes field (check-expect (blue-eyed-child? Carl) false) (check-expect (blue-eyed-child? Gustav) true) (define (blue-eyed-child? a-ftree) (cond [(no-parent? a-ftree) false] [else (or (string=? (child-eyes a-ftree) "blue") (blue-eyed-child? (child-father a-ftree)) (blue-eyed-child? (child-mother a-ftree)))]))
(blue-eyed-child? Carl) |
== (blue-eyed-child? (make-child MTFT MTFT "Carl" 1926 "green")) |
== |
(cond |
[(no-parent? (make-child MTFT MTFT "Carl" 1926 "green")) false] |
[else |
(or (string=? |
(child-eyes (make-child MTFT MTFT "Carl" 1926 "green")) |
"blue") |
(blue-eyed-child? |
(child-father (make-child MTFT MTFT "Carl" 1926 "green"))) |
(blue-eyed-child? |
(child-mother (make-child MTFT MTFT "Carl" 1926 "green"))))]) |
== |
(or (string=? |
(child-eyes (make-child MTFT MTFT "Carl" 1926 "green")) |
"blue") |
(blue-eyed-child? |
(child-father (make-child MTFT MTFT "Carl" 1926 "green"))) |
(blue-eyed-child? |
(child-mother (make-child MTFT MTFT "Carl" 1926 "green")))) |
== |
(or (string=? "green" "blue") |
(blue-eyed-child? |
(child-father (make-child MTFT MTFT "Carl" 1926 "green"))) |
(blue-eyed-child? |
(child-mother (make-child MTFT MTFT "Carl" 1926 "green")))) |
== |
(or false |
(blue-eyed-child? MTFT) |
(blue-eyed-child? MTFT)) |
== (or false false false) |
== false |
(blue-eyed-child? MTFT) |
== (blue-eyed-child? (make-no-parent)) |
== |
(cond |
[(no-parent? (make-no-parent)) false] |
[else |
(or (string=? (child-eyes (make-no-parent)) "blue") |
(blue-eyed-child? (child-father (make-no-parent))) |
(blue-eyed-child? (child-mother (make-no-parent))))]) |
== |
(cond |
[true false] |
[else |
(or (string=? (child-eyes (make-no-parent)) "blue") |
(blue-eyed-child? (child-father (make-no-parent))) |
(blue-eyed-child? (child-mother (make-no-parent))))]) |
== false |
Exercise 244: Develop count-persons. The function consumes a family tree node and counts the child structures in the tree.
Exercise 245: Develop the function average-age. It consumes a family tree node and the current year. It produces the average age of all child structures in the family tree.
Exercise 246: Develop the function eye-colors, which consumes a family tree node and produces a list of all eye colors in the tree. An eye color may occur more than once in the resulting list.
Hint: Use the append operation to concatenate lists:
(append (list 'a 'b 'c) (list 'd 'e))
== (list 'a 'b 'c 'd 'e)
We discuss the development of functions like append in section Simultaneous Processing.
Exercise 247: Suppose we need the function blue-eyed-ancestor?. It is like blue-eyed-child? but responds with true only when an ancestor, not the given child node, has blue eyes.
Even though the functions differ, their signatures are the same:
; FT -> Boolean ; to determine whether a-ftree contains a child node with blue eyes (define (blue-eyed-ancestor? a-ftree) ...) To appreciate the difference, we take a look at Eva:(check-expect (blue-eyed-child? Eva) true)
Eva is blue-eyed. Because she does not have a blue-eyed ancestor, however, we get(check-expect (blue-eyed-ancestor? Eva) false)
Now suppose a friend comes up with this solution:
(define (blue-eyed-ancestor? a-ftree) (cond [(no-parent? a-ftree) false] [else (or (blue-eyed-ancestor? (child-father a-ftree)) (blue-eyed-ancestor? (child-mother a-ftree)))])) Explain why this function fails the tests. What would be the result of (blue-eyed-ancestor? A) no matter which A you choose? Can you fix your friend's solution?
22.2 Forests
Sample Problem: Design the function blue-eyed-child-in-forest?, which determines whether a family forest contains a child with "blue" in the eyes field.
; FF -> Boolean ; does the forest contain any child node with "blue" eyes (check-expect (blue-eyed-child-in-forest? ff1) false) (check-expect (blue-eyed-child-in-forest? ff2) true) (check-expect (blue-eyed-child-in-forest? ff3) true) (define (blue-eyed-child-in-forest? a-forest) (cond [(empty? a-forest) false] [else (or (blue-eyed-child? (first a-forest)) (blue-eyed-child-in-forest? (rest a-forest)))]))
We leave it to you to figure out the signature, the purpose statement, and the examples for this solution. As for the template, the design can employ the list template because blue-eyed-child-in-forest? consumes lists. If each item on the list were a structure with an eyes field and nothing else, the function would iterate over those structures using the selector function for the eyes field and a string comparison. In this case, each item is a family tree but luckily, we already know how to process family trees.
Let us step back for a moment and inspect how we explained figure 57. The starting point is a pair of data definitions where the second refers to the first and both refer to themselves. The result is a pair of functions where the second refers to the first and both refer to themselves. In other words, the function definitions refer to each other the same way the data definitions refer to each other. To some extent, this relationship is a simple generalization of what we have seen so far. The difference is that two data definitions and two functions are involved, but not counting the self-references of both data definitions, we have encountered this situation before in some of our projects; we just happen to gloss over it. Instead of dwelling on the idea in the context of trees, we move on to S-expressions and articulate a generalized design recipe afterwards.
Exercise 248: Reformulate the data definition for FF with the List-of abstraction. Now do so for the signature of blue-eyed-child-in-forest?. Finally, define blue-eyed-child-in-forest? using one of the list abstractions introduced in the previous chapter.
Exercise 249: Design the function average-age. It consumes a family forest and a year, specified as a natural number. From this data, it produces the average age of all child nodes in the forest. Note: If the trees in this forest overlap, the result isn't a true average because some people may contribute more than others. For this exercise, act as if the trees don't overlap.
22.3 S-expressions
; An S-expr (S-expression) is one of: ; – Atom ; – SL ; An SL (S-list) is one of: ; – empty ; – (cons S-expr SL) ; An Atom is one of: ; – Number ; – String ; – Symbol
The idea of S-expressions is due to John McCarthy and his Lispers, who created S-expressions in 1958 so that they could process Lisp programs with other Lisp programs. This seemingly circular reasoning may sound esoteric but as mentioned in Intermezzo: Quote, Unquote, S-expressions are a versatile form of data that is often rediscovered, most recently with applications to the world wide web. Working with S-expressions thus prepares a discussion of how to design functions for highly intertwined data definitions.
Exercise 250: Define atom?. The function is not a function that comes with ISL+.
Sample Problem: Design the function count, which determines how many times some symbol sy occurs in some S-expression s.
'hello 20.12 "world"
empty (cons 'hello (cons 20.12 (cons "world" empty))) (cons (cons 'hello (cons 20.12 (cons "world" empty))) empty)
> '() empty
> '(hello 20.12 "world") (list 'hello #i20.12 "world")
> '((hello 20.12 "world")) (list (list 'hello #i20.12 "world"))
> '(define (f x) (+ (* 3 x x) (* -2 x) 55))
(list 'f 'x)
(list '+ (list '* 3 'x 'x) (list '* -2 'x) 55))
> '((6 f) (5 e) (4 d)) (list (list 6 'f) (list 5 'e) (list 4 'd))
> '(wing (wing (wing body wing) wing) wing) (list 'wing (list 'wing (list 'wing 'body 'wing) 'wing) 'wing)
(check-expect (count 'world 'hello) 0) (check-expect (count '(world hello) 'hello) 1) (check-expect (count '(((world) hello) hello) 'hello) 2)
For intertwined data definitions, create one template per data definition. Create them in parallel. Make sure they refer to each other in the same way the data definitions do.
(define (count sexp sy) (cond [(atom? sexp) ...] [else ...])) (define (count-sl sl sy) (cond [(empty? sl) ...] [else ...])) (define (count-atom at sy) (cond [(number? at) ...] [(string? at) ...] [(symbol? at) ...]))
(define (count sexp sy) (cond [(atom? sexp) ...] [else ...])) (define (count-sl sl sy) (cond [(empty? sl) ...] [else (... (first sl) ... (rest sl) ...)])) (define (count-atom at sy) (cond [(number? at) ...] [(string? at) ...] [(symbol? at) ...]))
The atom? line in count corresponds to the first line in the definition of S-expr, which points to Atom. To indicate this reference from one data definition to the other inside the template, we add (count-atom sexp sy), meaning we interpret sexp as an Atom and let the appropriate function deal with it.
Following the same line of thought, the second cond line in count calls for the addition of (count-sl sexp sy).
The empty? line in count-sl corresponds to a line in the data definition that makes no reference to another data definition.
In contrast, the else line contains two selector expressions, and each of them extracts a different kind of value. Specifically, (first sl) is an element of S-expr, which means that we should wrap it in (count ...). After all, count is responsible for counting inside of arbitrary S-exprs. In the same vein, (rest sl) corresponds to a self-reference, and we know that we need to deal with those via recursive function calls.
Finally, all three cases in Atom refer to atomic forms of data. Therefore the count-atom function does not need to change.
(define (count sexp sy) (cond [(atom? sexp) (count-atom sexp sy)] [else (count-sl sexp sy)])) (define (count-sl sl sy) (cond [(empty? sl) ...] [else (... (count (first sl) sy) ... (count-sl (rest sl) sy) ...)])) (define (count-atom at sy) (cond [(number? at) ...] [(string? at) ...] [(symbol? at) ...]))
; S-expr Symbol -> N ; count all occurrences of sy in sexp (define (count sexp sy) (cond [(atom? sexp) (count-atom sexp sy)] [else (count-sl sexp sy)])) ; SL Symbol -> N ; count all occurrences of sy in sl (define (count-sl sl sy) (cond [(empty? sl) 0] [else (+ (count (first sl) sy) (count-sl (rest sl) sy))])) ; Atom Symbol -> N ; count all occurrences of sy in at (define (count-atom at sy) (cond [(number? at) 0] [(string? at) 0] [(symbol? at) (if (symbol=? at sy) 1 0)]))
[(atom? sexp) (count-atom sexp sy)] checks that sexp is an atom. Hence, it interprets the S-expr as an Atom and calls count-atom on it. Doing so means the latter function counts how often sy occurs in sexp—
which is precisely what we want, but specialized to the appropriate kind of data. [else (+ (count (first sl) sy) (count-sl (rest sl) sy))] means the given list consists of two parts: an S-expr and an SL. By using count and count-sl, the corresponding functions are used to count how often sy appears in each part, and the two numbers are added up—
yielding the total number of sys in all of sexp. [(symbol? at) (if (symbol=? at sy) 1 0)] tells us that if an Atom is a Symbol, sy occurs once if it is equal to sexp and otherwise it does not occur at all. Since the two pieces of data are atomic, there is no other possibility.
Exercise 251: In a sense, we designed one program that consists of three connected functions. To express this fact, we should use local to organize the definitions:
; S-expr Symbol -> N ; count all occurrences of sy in sexp (define (count sexp sy) (local (; S-expr Symbol -> N ; the main function (define (count-sexp sexp sy) (cond [(atom? sexp) (count-atom sexp sy)] [else (count-sl sexp sy)])) ; SL Symbol -> N ; count all occurrences of sy in sl (define (count-sl sl sy) (cond [(empty? sl) 0] [else (+ (count-sexp (first sl) sy) (count-sl (rest sl) sy))])) ; Atom Symbol -> N ; count all occurrences of sy in at (define (count-atom at sy) (cond [(number? at) 0] [(string? at) 0] [(symbol? at) (if (symbol=? at sy) 1 0)]))) ; — IN — (count-sexp sexp sy))) Notice that we also renamed the first function to indicate that its primary argument is an S-expr.Copy the above definition into DrRacket and validate with the test suite for count that it works properly.
The second argument to the local functions, sy, never changes. It is always the same as the original symbol. Hence you can eliminate it from the local function definitions and function applications. Do so and re-test the revised definition. In Simplifying Functions, we show you how to simplify these kinds of definitions even more—
which is easy to do when you have designed functions systematically.
Exercise 252: Design depth. The function consumes an S-expression and determines its depth. An atom has a depth of 1. The depth of a list of S-expressions is the maximum depth of its items plus 1.
Exercise 253: Design the substitute function. It consumes an S-expression s and two symbols, old and new. The result is like s with all occurrences of old replaced by new.
Exercise 254: Reformulate the data definition for S-expr so that the first clause is expanded into the three clauses of Atom and the second clause uses the List-of abstraction.
Re-design the count function for this data definition. Note: This kind of simplification is not always possible though experienced programmers tend to recognize and use such opportunities.
Exercise 255: Abstract the data definitions for S-expr and SL so that they abstract over the kinds of atoms that may appear.
22.4 Designing With Intertwined Data
The need for "nests" of mutually related data definitions is similar to the one for the need for self-referential data definitions. The problem statement deals with many distinct kinds of information, and one form of information refers to other kinds.
Before you proceed in such situations, you should draw arrows on top of the data definitions that connect references to definitions. For example, the definition for S-expr contains references to SL and Atom, which you should connect with the two respective definitions. Similarly, the definition of SL contains one self-reference and one reference back to SL.
Like self-referential data definitions, these nests also call for validation. At a minimum, you must be able to construct some examples for every individual data definition. Before you even start, make sure some of the data definitions contain clauses that do not refer to any of the other data definitions that come with this nest.
You can, and should, also check the validity of self-referential data definitions with the creation of examples. Keep in mind that the definition may be invalid if it is impossible to generate examples from them.
The key change is that you must design as many functions in parallel as there are data definitions. Each function specializes for one of the data definitions; all remaining arguments remain the same. Based on that, you start with a signature, a purpose statement, and a dummy definition for each function.
Be sure to work through functional examples that use all self and mutual references in the nest of data definitions. For finding mistakes, it is best to derive the examples for the auxiliary functions from the examples for the primary function.
Take a look at the examples for count above. It comes with three examples. The first one can obviously serve as an example for count-atom:(check-expect (count-atom 'world 'hello) 0)
In contrast, the other two are good examples for count-sl:(check-expect (count '(world hello) 'hello) 1) (check-expect (count '(((world) hello) hello) 'hello) 2) For each function design the template according to its primary data definition. Use figure 33 to guide the template creation up to the last step.
The last template creation step now calls for a check for all self and cross references. Use the data definitions annotated with arrows to guide this step. For each arrow, include a self-call or a cross-call from one function to another. See figure-ref{fig:def-fun-mutual-arrows} for the arrow-annotated version of the templates for counting atoms in an S-expr.
Last but not least, replace the arrows with actual function calls.
Note: Once again, you should notice the symmetry between the arrow-enriched data definition in figure 59 and the arrow-enriched template in figure 60. This symmetry is evidence that the design recipe provides a natural way for going from problems to solutions.
For the design of the body we start with those cond lines that do not contain natural recursions or calls to other functions. They are called base cases. The corresponding answers are typically easy to formulate or are already given by the examples. After that, you deal with the self-referential cases and the cases of cross-function calls. Let the questions and answers of figure 35 guide you.
Run the test suite. If an auxiliary function is broken, you will get two error reports if you followed our advice concerning examples. A single fix should eliminate both. Do make sure that running the tests covers all the pieces of the function.
22.5 Simplifying Functions
Exercise 251 shows how to use local to organize a function that deals with an intertwined form of data. This organization also helps simplify functions once we have know that the data definition is final. To demonstrate this point, we explain how to simplify the solution of exercise 253.
; S-expr Symbol Atom -> S-expr ; replace all occurrences of old in sexp with new (check-expect (substitute 'world 'hello 0) 'world) (check-expect (substitute '(world hello) 'hello 'bye) '(world bye)) (check-expect (substitute '(((world) bye) bye) 'bye '42) '(((world) 42) 42)) (define (substitute sexp old new) (local (; S-expr -> S-expr (define (subst-sexp sexp) (cond [(atom? sexp) (subst-atom sexp)] [else (subst-sl sexp)])) ; SL -> S-expr (define (subst-sl sl) (cond [(empty? sl) empty] [else (cons (subst-sexp (first sl)) (subst-sl (rest sl)))])) ; Atom -> S-expr (define (subst-atom at) (cond [(number? at) at] [(string? at) at] [(symbol? at) (if (symbol=? at old) new at)]))) ; — IN — (subst-sexp sexp)))
Exercise 256: Copy and paste the above definition into DrRacket, including the test suite. Run and validate that the test suite passes. As you read along the remainder of this section, perform the edits and re-run the test suites to confirm the validity of our arguments.
(define (substitute.v1 sexp old new) (local (; S-expr -> S-expr (define (subst-sexp sexp) (cond [(atom? sexp) (subst-atom sexp)] [else (subst-sl sexp)])) ; SL -> S-expr (define (subst-sl sl) (map subst-sexp sl)) ; Atom -> S-expr (define (subst-atom at) (cond [(number? at) at] [(string? at) at] [(symbol? at) (if (symbol=? at old) new at)]))) ; — IN — (subst-sexp sexp)))
For the second simplification step, we need to introduce eq?, another built-in function of our programming language. All you need to know for now is that eq? determines whether two pieces of atomic data are equal. In other words, if s is a symbol and t is a number, (eq? s t) evaluates to false because a string and a number can never be equal; but (eq? s t) produces true, if t is also a symbol and spells exactly like s.
(define (substitute.v2 sexp old new) (local (; S-expr -> S-expr (define (subst-sexp sexp) (cond [(atom? sexp) (subst-atom sexp)] [else (subst-sl sexp)])) ; SL -> S-expr (define (subst-sl sl) (map subst-sexp sl)) ; Atom -> S-expr (define (subst-atom at) (if (eq? at old) new at))) ; — IN — (subst-sexp sexp)))
(define (substitute.v3 sexp old new) (local (; S-expr -> S-expr (define (subst-sexp sexp) (cond [(atom? sexp) (if (eq? sexp old) new sexp)] [else (map subst-sexp sexp)]))) ; — IN — (subst-sexp sexp)))
(define (substitute sexp old new) (cond [(atom? sexp) (if (eq? sexp old) new sexp)] [else (map (lambda (s) (substitute s old new)) sexp)]))
23 Incremental Refinement
When you develop real-world programs, you may confront complex forms of information and the problem of representing them with data. The best strategy to approach this task is to use iterative refinement, a well-known scientific process. A scientist's problem is to represent a part of the real world using some form of mathematics. The result of the effort is called a model. The scientist then tests the model in many ways, in particular by predicting the outcome of experiments. If the discrepancies between the predictions and the measurements are too large, the model is refined with the goal of improving the predictions. This iterative process continues until the predictions are sufficiently accurate.
Consider a physicist who wishes to predict a rocket's flight path. While a "rocket as a point" representation is simple, it is also quite inaccurate, failing to account for air friction. In response, the physicist may add the rocket's rough contour and introduce the necessary mathematics to represent friction. This second model is a refinement of the first model. In general, a scientist iterates this process until the model predicts the rocket's flight path with sufficient accuracy.
A programmer trained in a computer science department should proceed like this physicist. The key is to find an accurate data representation of the real-world information and functions that process them appropriately. Complicated situations call for a refinement process to get to a sufficient data representation combined with the proper functions. The process starts with the essential pieces of information and adds others as needed. Sometimes a programmer must refine a model after the program has been deployed because users request additional functionality.
So far we have used iterative refinement for you when it came to complex forms of data. This chapter illustrates iterative refinement as a principle of program development with an extended example, representing and processing (portions of) a computer's file system. We start with a brief discussion of the file system and then iteratively develop three data representations. Along the way, we propose some programming exercises so that you see how the design recipe also helps modify existing programs.
23.1 Data Analysis
Before you turn off DrRacket, you want to make sure that all your work—
On most computer systems, files are organized in directories or folders. Roughly speaking, a directory contains some files and some more directories. The latter are called subdirectories and may contain yet more subdirectories and files, and so on. The entire collection is also called a directory tree.
Figure 61 contains a graphical sketch of a small directory tree, and the picture explains why computer scientists call them trees. Contrary to computer scientists, the figure shows the tree growing upwards, with a root directory named TS. The root directory contains one file, called read!, and two subdirectories, called Text and Libs, respectively. The first subdirectory, Text, contains only three files; the latter, Libs, contains only two subdirectories, each of which contains at least one file. Finally each box has one of two annotations: a directory is annotated with DIR, and a file is annotated with a number, its size.
Exercise 257: How many times does a file name read! occur in the directory tree TS? Can you describe the path from the root directory to the two occurrences? What is the total size of all the files in the tree? What is the total size of the directory if each directory node has size 1? How many levels of directories does it contain?
23.2 Refining Data Definitions
Exercise 257 lists some of the questions that users routinely ask about directories. To answer such questions, the computer's operating system provides programs that can answer just such questions. If you want to design such programs, you need to develop a data representation for directory trees.
In this section, we use iterative refinement to develop three such data representations. For each stage, we need to decide which attributes to include and which to ignore. Consider the directory tree in figure 61 and imagine how it is created. When a user first creates a directory, it is empty. As time goes by, the user adds files and directories. In general, a user refers to files by names but mostly thinks of directories as containers of other things.
; A Dir.v1 (short for directory) is one of: ; – empty ; – (cons File.v1 Dir.v1) ; – (cons Dir.v1 Dir.v1) ; A File.v1 is a Symbol.
Exercise 258: Translate the directory tree in figure 61 into a data representation according to model 1.
Exercise 259: Design the function how-many, which determines how many files a given Dir.v1 contains. Remember to follow the design recipe; exercise 258 provides you with data examples.
(define-struct dir (name content))
; A Dir.v2 is a structure: ; (make-dir Symbol LOFD) ; A LOFD (short for list of files and directories) is one of: ; – empty ; – (cons File.v2 LOFD) ; – (cons Dir.v2 LOFD) ; A File.v2 is a Symbol.
Exercise 260: Translate the directory tree in figure 61 into a data representation according to model 2.
Exercise 261: Design the function how-many, which determines how many files a given Dir.v2 contains. Exercise 260 provides you with data examples. Compare your result with that of exercise 259.
Exercise 262: Show how to equip a directory with two more attributes: size and readability. The former measures how much space the directory itself (as opposed to its files and subdirectories) consumes; the latter specifies whether anyone else besides the user may browse the content of the directory.
(define-struct file (name size content))
(define-struct dir.v3 (name dirs files))
; A Dir.v3 is a structure: ; (make-dir.v3 Symbol Dir* File*) ; A Dir* is one of: ; – empty ; – (cons Dir.v3 Dir*) ; A File* is one of: ; – empty ; – (cons File.v3 File*)
Exercise 263: Translate the directory tree in figure 61 into a data representation according to model 3. Use "" for the content of files.
Exercise 264: Design the function how-many, which determines how many files a given Dir.v3 contains. Exercise 263 provides you with data examples. Compare your result with that of exercise 261.
Considering the complexity of the above data definition you should contemplate how anyone can systematically design correct functions. Why are you confident that how-many produces correct results?
Exercise 265: Use List-of to simplify the data definition Dir.v3. Then use ISL+'s list processing functions from figure 51 to simplify the function definition(s) for the solution of exercise 264.
Starting with a simple representation of the first model and refining it step by step, we have developed a reasonably accurate data representation for directory trees. Indeed, this third data representation captures the nature of a directory tree much more faithfully than the first two. Based on this model, we can create a number of other functions that users expect from a computer's operating system.
23.3 Refining Functions
; String -> Dir.v3 ; creates a data representation of the directory that a-path identifies (define (create-dir a-path) ...)
(require htdp/dir) (define d0 (create-dir "/Users/...")) ; on OS X (define d1 (create-dir "/var/log/")) ; on OS X (define d2 (create-dir "C:\\Users\\...")) ; on Windows
Although create-dir delivers only a representation of a directory tree, it is sufficiently realistic to give you a sense of what it is like to design programs at that level. The following exercises illustrate this point. They use Dir to refer to the generic idea of a data representation for directory trees. Use the simplest data definition of Dir that allow you to complete the respective exercise. Feel free to use the data definition from exercise 265 and the functions from figure 51.
Exercise 266: Use create-dir to create data representations of some sample directories on your computer. Then use how-many from exercise 264 to count how many files they contain. Why are you confident that how-many produces correct results for these directories?
Exercise 267: Design find?. The function consumes a Dir and a file name and determines whether or not a file with this name occurs in the directory tree.
Exercise 268: Design the function ls, which lists the names of all files and directories in a given Dir.
Exercise 269: Design du, a function that consumes a Dir and computes the total size of all the files in the entire directory tree. Assume that storing a directory in a Dir structure costs 1 file storage unit. In the real world, a directory is basically a special file and its size depends on how large its associated directory is.
Exercise 270: Design find. The function consumes a directory d and a file name f. If (find? d f) is true, find produces a path to a file with name f; otherwise it produces false.
Hint: While it is tempting to first check whether the file name occurs in the directory tree, you have to do so for every single subdirectory. Hence it is better to combine the functionality of find? and find.
Challenge: The find function discovers only one of the two files named read! file in figure 61. Design find-all, which is generalizes find and produces the list of all paths that lead to f in d. What should find-all produce when (find? f d) is false? Is this part of the problem really a challenge compared to the basic problem?
Exercise 271: Design the function ls-R, which lists the paths to all files in a given Dir. Challenge: Modify ls-R so that its result includes all paths to directories, too.
Exercise 272: Re-design find-all from exercise 270 using ls from exercise 271. This is design by composition, and if you solved the challenge part of exercise 271 your new function can find directories, too.—
One line functions are cool, and soon you will see how to discover them directly.
24 Refining Interpreters
DrRacket is a program. As you can imagine, it is a complex program, dealing with many different kinds of data. Like most complex programs, DrRacket also consists of many functions: one that allows programmers to edit text; another one that acts like the interactions area; a third one checks whether definitions and expressions are grammatical; and so on.
In this chapter, we show you how to design the function that implements the heart of the interactions area. Naturally, we use iterative refinement to design the evaluator. As a matter of fact, the very idea of focusing on the evaluator part of DrRacket is another instance of refinement, though the obvious one of implementing only one piece of functionality for a complex program.
Simply put, the interactions area performs the task of determining the values of expressions that you enter. After you click RUN, the interactions area knows about all the definitions. It is then ready to accept an expression that may refer to these definitions, to determine the value of this expression, and to repeat this cycle as often as you wish. For this reason, many people also refer to the interactions are as the read-eval-print loop, where eval is short for evaluator, a function is also called an interpreter.
Like this book, our refinement process starts with numeric BSL expressions. They are simple; they do not assume an understanding of definitions; and even your brother in fourth grade can determine their value. Once you understand this first step, you know the difference between a BSL expression and its representation. Next we move on to expressions with variables. The last step is to add definitions.
24.1 Interpreting Expressions
Our first task is to agree on a data representation for BSL programs, that is, we must figure out how to represent a BSL expression as a piece of BSL data. This sounds strange and unusual, but it is not difficult. Suppose we just want to represent numbers, additions, and multiplications for a start. Clearly, numbers can stand for numbers. Additions and multiplications, however, call for a class of compound data because they consist of an operator and two pieces.
(define-struct add (left right)) (define-struct mul (left right))
BSL expression | representation of BSL expression |
BSL expression | representation of BSL expression | ||||||
| |||||||
| ||||||
Let's look at some examples. These examples cover all cases: numbers, variables, simple expressions, and nested expressions.
Exercise 273: Formulate a data definition for the representation of BSL expressions based on the structure type definitions of add and mul. Let us use BSL-expr in analogy for S-expr for the new class of data.
Translate the following expressions into data:InterpretRemember that "interpret" here means "translate from data into information." In contrast, the word "interpreter" in the title of this chapter refers to a program that consumes the representation of a program and produces its value. While the two ideas are related, they are not the same. the following data as expressions:
(make-add -1 2)
(make-add (make-mul -2 -3) 33)
(make-mul (make-add 1 (make-mul 2 3)) (make-mul 3.14 12))
Now that you have a data representation for BSL programs, it is time to design an evaluator. This function consumes a representation of a BSL expression and produces its value. Again, this function is unlike any you have ever designed so it pays off to experiment with some examples. To this end, you can either use the rules of arithmetic to figure out what the value of an expression is or you can "play" in the interactions area of DrRacket. Take a look at the following table for our examples.
BSL expression | its representation | its value |
| |
Exercise 274: Formulate a data definition for the class of values to which a representation of a BSL expression can evaluate.
Exercise 275: Design eval-expression. The function consumes a representation of a BSL expression (according to exercise 273) and computes its value.
Exercise 276: Develop a data representation for boolean BSL expressions constructed from true, false, and, or, and not. Then design eval-bool-expression. The function consumes a representative of boolean BSL expression and computes its value. What is the value of a boolean expression?
> (+ 1 1) 2
> '(+ 1 1) (list '+ 1 1)
> (+ (* 3 3) (* 4 4)) 25
> '(+ (* 3 3) (* 4 4)) (list '+ (list '* 3 3) (list '* 4 4))
By simply putting a quote in front of an expression, we get a piece of ISL+ data. This representation is convenient only for the person who types the representation of a BSL expression on a keyboard. Interpreting an S-expression representation is clumsy, mostly because not all S-expressions represent BSL-exprs:
"hello world" '(+ x 1) '(* (- "hello" "world") 10) People invented parsers to check whether some piece of data conforms to a data definition. A parser consumes a "raw" piece of input and, if it does conform, it produces a parse tree, which in our specific case is the corresponding BSL-expr. If not, it signals an error, like the checked functions from Input Errors.
Figure 62 presents a BSL parser for S-expressions. Specifically, the parse function consumes an S-expr and produces an BSL-expr—
if and only if the given S-expression is the result of quoting a BSL expression that has a BSL-expr representative. Create test cases for the parse function until DrRacket tells you that all expressions in the definitions area are covered during the test run.
What is unusual about the definition of this program with respect to the design recipe? Note: One unusual aspect is that the function uses length on the list argument. Real parsers do not use length because it slows the functions down.
Discuss: should a programming language be designed for the convenience of the programmer who uses it or for the convenience of the programmer who implements it?
(define WRONG "wrong kind of S-expression") (define-struct add (left right)) (define-struct mul (left right)) ; S-expr -> BSL-expr ; create representation of a BSL expression for s (if possible) (define (parse s) (local (; S-expr -> BSL-expr (define (parse s) (cond [(atom? s) (parse-atom s)] [else (parse-sl s)])) ; SL -> BSL-expr (define (parse-sl s) (local ((define L (length s))) (cond [(< L 3) (error WRONG)] [(and (= L 3) (symbol? (first s))) (cond [(symbol=? (first s) '+) (make-add (parse (second s)) (parse (third s)))] [(symbol=? (first s) '*) (make-mul (parse (second s)) (parse (third s)))] [else (error WRONG)])] [else (error WRONG)]))) ; Atom -> BSL-expr (define (parse-atom s) (cond [(number? s) s] [(string? s) (error "strings not allowed")] [(symbol? s) (error "symbols not allowed")]))) (parse s)))
24.2 Interpreting Variables
(define x 5)
> 'x 'x
> '(* 1/2 (* x 3)) (list '* 0.5 (list '* 'x 3))
; A BSL-var-expr is one of: ; – Number ; – Symbol ; – (make-add BSL-var-expr BSL-var-expr) ; – (make-mul BSL-var-expr BSL-var-expr)
BSL expression | representation of BSL expression | ||||
| ||||
| ||||
| |||||
One way to determine the value of variable expressions is to replace all variables with the values that they represent. This is the way you know from mathematics classes in school, and it is perfectly fine way.
Exercise 278: Design subst. The function consumes a BSL-var-expr e, a Symbol x, and a Number v. It produces a BSL-var-expr like e with all occurrences of x replaced by v.
Exercise 279: Design the function numeric?, which determines whether a BSL-var-expr is also a BSL-expr. Here we assume that your solution to exercise 273 is the definition for BSL-var-expr without the line for Symbol.
Exercise 280: Design eval-variable. The function consumes a BSL-var-expr and determines its value if numeric? is true. Otherwise it signals an error, saying that it is impossible to evaluate an expression that contains a variable.
In general, a program defines many constants in the definitions area and expressions contain more than one variable. To evaluate such expressions, we need a representation of the definition area when it contains a series of constant definitions. For this exercise we use association lists:
; An AL (association list) is [List-of Association]. ; An Association is (cons Symbol (cons Number empty)). Make up elements of AL.Design eval-variable*. The function consumes a BSL-var-expr e and an association list da. Starting from e, it iteratively applies subst to all associations in da. If numeric? holds for the result, it determines its value; otherwise it signals the same error as eval-variable. Hint: Think of the given BSL-var-expr as an atomic value and traverse the given association list instead. Or use a loop from figure 51. Note: We provide this hint because the creation of this function requires a little design knowledge from Simultaneous Processing.
Exercise 281: Modify the parser in figure 62 so that it creates BSL-var-expr if it is an appropriate BSL expression.
Exercise 280 relies on the mathematical approach to constant definitions. If a name is defined to stand for some value, then all occurrences of the name can be replaced with the value. Substitution performs this replacement once and for all before the evaluation process even starts.
An alternative approach is to mingle substitution and replacement. That is, the evaluator starts processing the expression immediately but also carries along a the representation of the definitions area. Every time the evaluator encounters a variable, it looks in the definitions area for its value and uses it.
Exercise 282: Design lookup-con. The function consumes an AL da and a Symbol x. It produces the value of x in da—
if there is a matching Association; otherwise it signals an error.
It does not use substitution, however. Instead, the function traverses the expression in the manner that the design recipe for BSL-var-expr suggests and "carries along" da. When it encounters a symbol x, the function looks up the value of x in da.
24.3 Interpreting Functions
At this point, you understand how to evaluate BSL programs that consist of constant definitions and variable expressions. Naturally you should want to add function definitions so that you know at least in principle how to deal with the complete programming language. As you may remember from school and BSL: Meaning, people evaluate function applications of the shape (f a) by substituting a for x in e assuming (define (f x) e) is the definition for f. In short, substitution comes in handy again.
The goal of this section is to refine the evaluator of Interpreting Variables so that it can cope with function applications and function definitions. Put differently, we want to design an evaluator with you that simulates DrRacket when the definitions area contains a number of function definitions and a programmer enters an expression in the interactions area that contains applications of these functions.
For simplicity, let us assume that all functions in the definitions area consume one argument. Indeed, for the first two exercises we go further and assume that there is only one function definition.
Exercise 284: Extend the data representation of Interpreting Variables to include the application of a programmer-defined function. Recall that a function application consists of two pieces: a name and an expression. The former is the name of the function that is applied; the latter is the argument.
Use your data definition to represent the following expressions:
an BSL-fun-expr e'
a symbol f, which represents a function name;
a symbol x, which represents the functions's parameter; and
an BSL-fun-expr b, which represents the function's body.
If the terminology poses any difficulties, do re-read BSL: Grammar.The function determines the value of the expression e. It proceeds as follows. Subexpressions from BSL-expr are evaluated as in exercise 275. For a function application of f,
eval-definition1 evaluates the argument,
it then substitutes the value of the argument for x in b; and
evaluates the resulting expression with eval-definition1.
Here is how to express the steps as code, assuming arg is the argument of the function application:(eval-definition1 (subst b x (eval-definition1 arg f x b)))
Note: You may have noticed that evaluation of a function application uses a form of recursion that you have not encountered so far. It is dubbed generative recursion and we discuss it in Generative Recursion.If eval-definition1 encounters a variable, it signals the same error as eval-variable from exercise 280. Also, for function applications that do not refer to f, eval-definition1 signals an error as if it had encountered a variable.
Warning: The use of generative recursion introduces a new element into your computations: non-termination. That is, given some argument, a program may not deliver a result or signal an error but run forever. For fun, you may wish to construct an input for eval-definition1 that causes it to run forever. Use STOP to terminate the program.
For an evaluator that mimics the interaction area, we need a representation of the definitions area. Like in Interpreting Variables, we assume that it is a list of definitions.
Exercise 286: Provide a structure type definition and a data definition for function definitions. Recall that a function definition has three essential attributes:
the function's name,
the function's parameter, which is also a name, and
the function's body, which is a variable expression that usually contains the parameter.
Use your data definition to represent the following BSL function definitions:Next, define the class BSL-fun-def* to represent definitions area that consist of just one-argument function definitions. Translate the definitions area that defines f, g, and h into your data representation and name it da-fgh.
Finally, design the function lookup-def with the following header:
; BSL-fun-def* Symbol -> BSL-fun-def ; retrieve the definition of f in da ; or signal "undefined function" if da does not contain one (check-expect (lookup-def da-fgh 'g) g) (define (lookup-def da f) ...) Looking up a function definition is needed for the evaluation of expressions in BSL-fun-expr.
Exercise 287: Design eval-function*. The function consumes the BSL-fun-expr representation of some expression e and the BSL-fun-def* representation of a definitions area da. It produces the result that DrRacket shows if you evaluate e in the interactions area assuming the definitions area contains da.
evaluates the argument;
looks up the definition of f in the BSL-fun-def representation of da;
substitutes the value of the argument for the function parameter in the function's body; and
evaluates the new expression via recursion.
Remember that the representation of a function definition for f comes with a parameter and a body.Like DrRacket, eval-function* signals an error when it encounters a variable or an application whose function is not defined in the definitions area.
Exercise 288: Modify the parser in figure 62 so that it creates BSL-fun-expr if it is an appropriate BSL expression. Also see exercise 281.
Exercise 289: Figure 63 presents a BSL definitions parser for S-expressions. Specifically, the def-parse function consumes an S-expr and produces an BSL-fun-def—
if and only if the given S-expression is the result of quoting a BSL definition that has a BSL-fun-def representative. Create test cases for the def-parse function until DrRacket tells you that all expressions in the definitions area are covered during the test run.
Note: The exercises assumes that you have a solution for exercise 288. That is, you have a function parse that turns an S-expr into a BSL-fun-expr representation, if possible.
With def-parse you have the essential ingredient for a parser that consumes an S-expression representation of a definitions area and produces a BSL-fun-def*. Now design the function da-parse, which parses a SL as a BSL-fun-def* assuming the former is a list of quoted BSL definitions.
(define WRONG "wrong kind of S-expression") (define-struct def (name para body)) ; see exercise 286 {S-expr} -> (tech "BSL-fun-def") ; create representation of a BSL definition for s (if possible) (define (def-parse s) (local (; S-expr -> BSL-fun-def (define (def-parse s) (cond [(atom? s) (error WRONG)] [else (if (and (= (length s) 3) (eq? (first s) 'define)) (head-parse (second s) (parse (third s))) (error WRONG))])) ; S-expr BSL-expr -> BSL-fun-def (define (head-parse s body) (cond [(atom? s) (error WRONG)] [else (if (not (= (length s) 2)) (error WRONG) (local ((define name (first s)) (define para (second s))) (if (and (symbol? name) (symbol? para)) (make-def name para body) (error WRONG))))]))) (def-parse s)))
24.4 Interpreting Everything
(define close-to-pi 3.14) (define (area-of-circle r) (* close-to-pi (* r r))) (define (volume-of-cylinder r h) (* h (area-of-circle r)))
> (area-of-circle 1) #i3.14
> (volume-of-cylinder 1 2) #i6.28
> (* 3 close-to-pi) #i9.42
Exercise 290: Formulate a data definition for the representation of DrRacket's definition area. Concretely, the data representation should work for a sequence that freely mixes constant definitions and one-argument function definitions. Make sure you can represent the definitions area consisting of three definitions at the beginning of this section.—
We use BSL-da-all for this class of data. Design the function lookup-con-def, It consumes a BSL-da-all da and a symbol x. It produces the representation of a constant definition whose name is x, if such a piece of data exists in da; otherwise the function signals an error saying that no such constant definition can be found.
Design the function lookup-fun-def, It consumes a BSL-da-all da and a symbol f. It produces the representation of a function definition whose name is f, if such a piece of data exists in da; otherwise the function signals an error saying that no such function definition can be found.
Exercise 291: Design eval-all. Like eval-function* from exercise 287, this function consumes the representation of an expression and of a definitions area. It produces the same value that DrRacket shows if the expression is entered at the prompt in the interactions area and the definitions area contains the appropriate definitions. Hint: Your eval-all function should process variables in the given expression like eval-var-lookup in exercise 283.
Exercise 292: It is cumbersome to enter the structure-based data representation of a BSL expressions and a definitions area. It is much easier to quote an actual expression or a definitions area after surrounding it with parentheses.
Design a function eval-all-sexpr. It consumes an S-expr and an Sl. The former is supposed to represent an expression and the latter a list of definitions. The function parses both with the appropriate parsing functions and then uses eval-all from exercise 291 to evaluate the expression. Hint: You must slightly modify da-parse from exercise 289 so that it can parse constant definitions, too.
You should know that eval-all-sexpr makes it straightforward to check whether it really mimics DrRacket's evaluator.
At this point, you know a lot about interpreting BSL. Here are some of the missing pieces: Booleans with cond or if; Strings and such operations string-length or string-append; and lists with empty, empty?, cons, cons?, first, rest; and so on. Once your evaluator can cope with all these, it is basically complete, because your evaluators already know how to interpret recursive functions. Now when we say "trust us, you know how to design these refinements," we mean it.
25 The Commerce Of XML
XML is a widely used data language. Programmers often use XML data to send messages from a program running on one computer to another. For example, when you point your web browser at a particular web site, you are really connecting a program on your computer to a program on a different computer, and the latter may be sending a form of XML data to the former. Once the web browser receives XML data, it starts rendering it as an image on your computer's monitor.
XML data | rendered in a browser | ||||||||||
The above table illustrates this idea with a concrete example. On the left, you see a piece of XML data that a web site may send to your web browser. On the right, you see how one popular browser renders this snippet graphically.
This chapter explains the basics of XML and processing it data as another design exercise concerning intertwined data definitions and iterative refinement. XML As S-expressions starts with an informal comparison of S-expressions and XML data and uses it to formulate a full-fledged data definition. The remaining two sections explain with two distinct examples how to process this kind of data. Rendering XML Enumerations explains how to render enumerations like the above; Configuring State Machines illustrates how to use XML files to configure "large" programs, a common tool used for modern applications. If you think XML is too old-fashioned and a 2013 book should use JSON instead, remember that this chapter is mostly a design exercise and feel free to replicate the exercise for any modern data exchange format that you consider fit.
25.1 XML As S-expressions
<machine> </machine> |
<machine /> |
(define-struct element (name content))
<machine><action /></machine> |
<machine><action></action></machine> |
<machine><action /><action /><action /></machine> |
(make-element "machine" (list (make-element "action" '())))
'(machine (action))
<machine initial="red"></machine> |
<machine initial="red"> |
<action state="red" next="green" /> |
<action state="green" next="yellow" /> |
<action state="yellow" next="red" /> |
</machine> |
(define-struct element (name attributes content))
(define-struct attribute (name value))
(make-element 'machine '((initial "red")) '())
'(machine ((initial "red")))
'(machine ((initial "red")) (action ((state "red") (next "green"))) (action ((state "green") (next "yellow"))) (action ((state "yellow") (next "red"))))
A bit more general, you may also recall the idea from Intermezzo: Quote, Unquote, which
used S-expressions to represent XHTML, a special dialect of XML. In
particular, the intermezzo shows how easily a programmer can write down
non-trivial XML data and even templates of XML representations—
; An Xexpr.v2 is ; – (cons Symbol [List-of Xexpr.v2]) ; – (cons Symbol (cons [List-of Attribute] [List-of Xexpr.v2]))
Exercise 293: Eliminate the use of List-of from the data definition Xexpr.v2.
<transition from="seen-e" to="seen-f" />
<ul><li><word /><word /></li><li><word /></li></ul>
'(server ((name "example.org")))
'(carcassonne (board (grass)) (player ((name "sam"))))
Roughly speaking, X-expressions simulate structures via lists. The simulation is convenient for programmers; it asks for the least amount of keyboard typing. For example, if an X-expression does not come with an attribute list, it is simply omitted. This choice of data representation comes with a trade-off, namely, when it comes to processing these lists. The best way to deal with the problem is to provide functions that make X-expressions look like structures, especially functions that access the quasi-fields: xexpr-name, xexpr-attributes, and xexpr-content. Once we have such functions, we can use lists and act as if they were structures.
(define a0 '((initial "red"))) (define e0 '(machine)) (define e1 `(machine ,a0)) (define e2 '(machine (action))) (define e3 '(machine () (action))) (define e4 `(machine ,a0 (action) (action)))
; Xexpr.v2 -> [List-of Attribute] ; retrieve the list of attributes of xe (define (xexpr-attribute xe) '())
(check-expect (xexpr-attributes e0) '()) (check-expect (xexpr-attributes e1) '((initial "red"))) (check-expect (xexpr-attributes e2) '()) (check-expect (xexpr-attributes e3) '()) (check-expect (xexpr-attributes e4) '((initial "red")))
(define (xexpr-attributes xe) (local ((define optional-loa+content (rest xe))) (cond [(empty? optional-loa+content) ...] [else ...])))
(define (xexpr-attributes xe) (local ((define optional-loa+content (rest xe))) (cond [(empty? optional-loa+content) ...] [else (... (first optional-loa+content) ... (rest optional-loa+content) ...)])))
; design list-of-attributes? ; given: [List-of Attribute] or [List-of Xexpr.v2] ; wanted: true if it is the first one, false otherwise
(define (xexpr-attributes xe) (local ((define optional-loa+content (rest xe))) (cond [(empty? optional-loa+content) '()] [else (local ((define possible-loa (first optional-loa+content))) (if (list-of-attributes? possible-loa) possible-loa '()))])))
; [List-of Attribute] or [List-of Xexpr.v2] -> Boolean ; is the given value a list of attributes? (define (list-of-attributes? x) (cond [(empty? x) true] [else (local ((define possible-attribute (first x))) (cons? possible-attribute))]))
Exercise 296: Design the functions xexpr-name and xexpr-content.
Exercise 297: Add the "natural" self-reference to the xexpr-attributes template.
Exercise 298: Formulate a data definition that replaces the informal "or" signature for the definition of the list-of-attributes? function.
Exercise 299: Design attribute-value. The function consumes a list of attributes and a symbol. If the attributes list associates the symbol with a string, the function retrieves this string; otherwise it signals an error. Hint: Consider using assq, a function that comes with ISL+.
For the remainder of this chapter, we assume that xexpr-name, xexpr-attributes, and xexpr-content exist. Additionally, we also use the attribute-value function from exercise 299. To keep the prose simple, we use Xexpr to refer to Xexpr.v2.
25.2 Rendering XML Enumerations
XML is really a family of languages, similar to, yet also distinct from, the teaching languages in DrRacket. For example, XHTML is the language for sending web in XML format, while MathML specifies how to render mathematical expressions. In this section, we illustrate how to design a rendering function for a small snippet of XHTML, specifically the enumerations from the beginning of this section.
The ul tag surrounds a so-called unordered HTML list. Each item of this list is tagged with li, which tends to contain words but also other elements possibly including enumerations. With "unordered" the authors of HTML do not mean that the order does not matter; rather the intention is that each item is labeled with a bullet during rendering not a number.
Exercise 300: Make up three examples of XWords. Design the functions word?, which checks whether any ISL+ value is in XWord, and word-text, which extracts the value of the only attribute of a XWord.
Exercise 301: Refine the definition of Xexpr.v2 so that an you can represent XML elements that are plain strings. Use this refinement to represent the enumerations in this section.
Exercise 302: Argue that every element of XEnum.v1 is also an XExpr.
(define e0 '(UL (LI (word ((text "one")))) (LI (word ((text "two"))))))
Remember we do not create these expressions in the definitions area; we experiment in the interactions area, just like you should.
(define e0-rendered (above/align 'left (beside/align 'center BULLET (text "one" 12 'black)) (beside/align 'center BULLET (text "two" 12 'black))))
; XItem.v1 -> Image ; render a single item as a "word" prefixed by a bullet (define (render-item1 i) (beside/align 'top BULLET (text (word-text (second i)) 12 'black)))
Exercise 303: Before you read on, equip the definition of render-item1 with at least one test; make sure that the tests are formulated so that they don't truly depend on the nature of BULLET. Then explain how the function works; keep in mind that the purpose statement explains only what it does.
; XEnum.v1 -> Image ; render a simple enumeration as an image (check-expect (render e0) e0-rendered) (define (render-enum1 xe) empty-image)
The design recipe tells you that you should design a separate function whenever you encounter a complex form of data, such as this list of items. Abstraction tells you that you might be able to reuse an existing abstraction, say a list-processing function from figure 51. Let us try this approach here.
(define (render-enum1 xe) (local (; XItem.v1 Image -> Image (define (deal-with-one-item fst-itm image-so-far) ...)) (foldr deal-with-one-item empty-image (rest xe))))
the first argument to foldr must be a two-argument function, which consumes one item at a time and the image built up so far;
the second argument must be an image;
the last argument is the list.
(define (render-enum1 xe) (local (; XItem.v1 Image -> Image (define (deal-with-one-item fst-itm image-so-far) (above/align 'left (render-item fst-itm) image-so-far))) (foldr add-image-for-item empty-image (rest xe))))
Flatt enumerations are common but they are also just a simple approximation of the full-fledged case. In the real world, web browsers must be able to display nested enumerations that are sent over the web, and at least in principle, the nesting can be arbitrarily deep.In case you are wondering whether arbitrary nesting is really the right way to think about this problem, we recommend that you develop an alternative data definition that allows only three levels of enumeration. Then use the design recipe to create functions that render such enumerations.
; An XEnum.v2 is (cons 'OL [List-of XItem.v2]) ; An XItem.v2 is one of: ; – (cons 'LI (cons XWord empty)) ; – (cons 'LI (cons XEnum.v2 empty))
The next question is how this change to the data definition affects the rendering functions. Put differently, how do render-enum1 and render-item1 have to change so that they can cope with elements of XEnum.v2 and XItem.v2, respectively. Software engineers faces these kinds of questions all the time, and it is in this situation where the design recipe shines.
(define SIZE 12) (define COLOR 'black) (define BULLET (beside (circle 1 'solid 'black) (text " " SIZE COLOR))) ; Image -> Image ; mark item with bullet (define (bulletize item) (beside/align 'top BULLET item)) (define e0 ...) (define e0-rendered ...) ; XEnum.v2 -> Image ; render an XEnum.v2 as an image (check-expect (render-enum e0) e0-rendered) (define (render-enum an-enum) (local ((define (process-one-image item image-so-far) (above/align 'left (render-item item) image-so-far))) (foldr process-one-image empty-image (rest an-enum)))) ; XItem.v2 -> Image ; render one XItem.v2 as an image (check-expect (render-item '(li (word ((text "one"))))) (bulletize (text "one" SIZE COLOR))) (check-expect (render-item `(li ,e0)) (bulletize e0-rendered)) (define (render-item an-item) (local ((define d (second an-item))) (cond [(word? d) (bulletize (text (word-text d) SIZE COLOR))] [else (bulletize (render-enum d))]))) Figure 64: Refining functions in response to refinements of data definitions
Figure 64 shows the complete answer. Since the real change is
confined to the data definitions for XItem.v2, it should not come
as a surprise that the real change to the renderer shows up in the
function for rendering items. While the rendering function for
XItem.v1 does not need to distinguish between different forms of
input, the one for XItem.v2 is forced to use a cond
because the corresponding data definition lists two different kinds of
items. Given that this data definition is close to one from the real
world, the distinguishing characteristic is not something simple—
Exercise 304: Use the recipe to design the rendering functions for XEnum.v2 and XItem.v2 from scratch. You should come up with the same functions.
Exercise 305: The repetition of (beside/align 'top BULLET ...) should disturb you. Edit the function definition so that this juxtaposition operation shows up only once. Why are you confident that your change works?
The tests are one other noteworthy point in figure 64. When you work on intertwined data, it is a good idea to derive one test from the other. If they go wrong, the failure message tends to tell you in which function the mistake is.
Exercise 306: Change the data representation of words so that they are plain strings. Then re-define the functions word? and word-text from exercise 300. Do you need to redefine anything else to get the functions from figure 64 to work?
With this change, the data definition no longer specifies a subset of Xexpr from the preceding section.
Exercise 307: Design a program that counts all occurrences of "hello" in an enumeration.
Exercise 308: Design a program that replaces all occurrences of "hello" with "bye" in an enumeration.
25.3 Configuring State Machines
A Bit More About Worlds explains the basics of finite stat machines. Exercise 95
25.3.1 Configurations
using x-expression to design 'real-world' programs for money
25.3.2 Interpreting Configurations
26 Simultaneous Processing
processing two (or more) forms of complex data simultaneously
26.1 Designing Functions For Two Complex Arguments
solve exercise 279 here
27 Summary
This fourth part of the book is about the design of


text:
About Me
Meg's Latest Reads
All My Reads
The Chosen One This book is so sad but so good! The Chosen One by is about a girl named Kira who lives in an isolated community of polygamist -people who have more than one wives. Kira is old she must marry her elder, cruel uncle who already had 7 wives and leave her large, loving family of 20. Kira has not been following the rules, she has been reading books from a mobile library (forbidden) and has had secret visits (forbidden)with a boy Joshua, who she wants to desperately marry. Kira must make a difficult choice to stay of to go! How dramatic! I enjoyed this tale because it was very different than books I have read before; it was placed in an interesting environment. I knew some what about that life style from watching the TV show on TLC Sister Wives! but this story had more of an impact and seemed so real. The book is sad, suspenseful, and adventurous. I would recommend this book to everyone but I think girls with open minds will enjoy this unforgettable novel the most!
My Reads Login
My Reads
Your place to connect with other readers, see who's reading what, and share your book recommendations.


text:
8 Meetup Groups match "Night Life" near Cork, Ireland
Meetup details are available only to members.
Hi all the Galway Social Group was set up for people in their 30's and 40's to meet like minded individuals in Galway and the surrounding areas but age is only a number all are welcome as long as your there to have fun. It started because I returned to Galway after being away for almost 20 years and all my friends had settled down or moved away, Colm Hayes on 2fm had a show that was dedicated to people making new friends and there it was launched. Its just three months old but we have dined out, …
This is a group for anyone who wants to meet new people in Galway. This group will meet for coffee, walks, nights out, cinema and many other social activities! These meetups are for everyone and all ages (unless specified otherwise). Looking forward to meeting you all:) Note that this is not a singles/dating group. While friendship is more than welcome in the group, hassling girls is not and will result in you being banned from the group.
Are you frustrated that life seems more difficult than it should be? Do you wish that life would be more fun? Do you sometimes wonder what it would take to just be happy? BE HAPPY NOW is a meet up group that uses Access Consciousness tools and processes to clear away limiting beliefs, old programming and unconsciousness that is preventing you from living your best life. We have clearing nights on different topics like love, money, abundance, relationships, consciousness, health, healing and more …
Meetup details are available only to members.
Cork70/80 is a club for people living in Cork who were born in the 1970s or 1980s. Our social events are mainly indoors, but there are a few outdoors outings in the Summer.
Meetup details are available only to members.
Do you often find yourself looking for a social outlet!!. Do you find it hard to organise evenings out when it suits you. Family and friends can be great but its so easy to find yourself at a loose end at weekends and holiday times !!The purpose of the club would be to. make new friends, meet new people ,organise outings, activites , and social events, weekends away or holidays. All are welcome. Let this club develop and see where it goes. Remember three is crowd with meetup.
We have decided to start a group for people in and around Kilkenny who would like to get out and meet new people. The purpose of the group is to get all age groups together, get active, make new friends and meet up for chat and social fun. It's ideal for people new to Kilkenny, or back here after a period away or just some one who wants to socalise in a relaxed environment. Your participation will be greatly appreciated and makes our Social Club a stronger, more diverse and more interesting one. …
Meetup details are available only to members.
New to the city or recently returned? Or just want to make new friends? Come to a Meetup gathering to meet other new and not-so-new locals. Find fun things to do, cool places to go and a bunch of friends to go with you! All members are welcome to suggest future events.
There are no upcoming Meetups.
Are you single, unattached, widowed? Do you want to meet people for love, romance or just friendship? If so, you've come to the right place. Anam Cara is a Galway-based Singles Social Group which runs a variety of social events and activities for single people throughout the year. These include dinner party nights, cinema and theatre outings, table quizzes, country walks and weekends away. While we can't guarantee the "Love of your Life", we can promise you'll meet others who are also on their o …
Get an alert email when new Meetup Groups like this start near you.
You'll get advice, help finding members, and tools to make running a Meetup Group easier.


text:
Ulum al Qur'an
The 'Imam' Manuscript
This is the name used for the copy which 'Uthman kept himself, and it is said he was killed while reading it. [Ibn Said: al-Tabaqatal-kubra, Cairo, n.d., Vol. 111, (1). pp. 51-2.]
According to some the Umayyads took it to Andalusia, from where it came to Fas (Morocco) and according to Ibn Batuta it was there in the eighth century after the Hijra, and there were traces of blood on it. From Morocco, it might have found its way to Samarkand.


text:
Apr 27 2009
Trim the fat on your Mac's Hard Drive
(from Episode #46 of The Lab with Leo Laporte)
What is it about data that makes it always seem to expand to fill the space it's given? There is never enough hard drive space. Just when drives get to a size where you say to yourself "Woah! I'll never be able to fill that!�, the next edition of Apple's OS X, or the latest Photoshop version or even the very files they produce greedily gobble up every gigabyte. We used to get by transferring files on low capacity floppy disks and now we frequently deal with individual files that require a CD-ROM to effectively transfer them.
Think about it: say you have a high end MacBook Pro with a 160GB hard drive, once you synchronize all the music and video from your 80GB iPod and partition 10+ gigabytes to run Windows and a few of its applications, you quickly start to see the ceiling on that spacious new drive. And remember, the fragmentation preventing benefits of Mac OS X on HFS+ are only effective if there is enough free space on the drive to allow the file system to do its job.
The three programs I'm going to introduce to you will show you where all your drive space is going and help you to keep the Finder's most common "dumping grounds� free of excess weight.
WhatSize is a freeware utility that scans your drive and shows you which files and folders are the major offenders when it comes to drive usage.
You simply launch the application and let it scan your drive. When it's done, it color codes the largest files and folders to show you just how far yu have gone astray with your organization. Do you really need all those Garage Band loops? Do you actually use iDVD?
WhatSize offers pretty crude file deletion functionality (ie: you could use it to delete the oversized files and folders, but you might be better off to properly uninstall them or maybe use a utility like AppZapper to remove them more efficiently). WhatSize's main strength is in being a bit easier to use than the Finder's own "calculate all sizes� function.
Common places for your hard drive to put on pounds include the Applications, Library, Music, Pictures and Documents folders (be careful deleting anything from the Library folders). Often the best places to trim the fat on your drive is to sort out your dump zones. Namely, your Desktop, Trash, and Downloads folders. For this we're going to use automation….
Named after the title character of the 60s TV series played by Shirley Booth, Hazel (USD$16) is a maid for your Mac. You open up your System Preferences and you program it to make sure your Trash gets deleted if anything sits in there for too long or if it gets above a certain size limit.
It's not limited to Trash though. You can get Hazel to check any folder on your drive. I use it to move applications, music, etc. out of my Downloads folder and into the folders they were intended to occupy. I then tell Hazel to set the Label color on the remaining files once they have lingered in Downloads for more that a few weeks.
I have a similar set of chores for Hazel on my Desktop. Since all the screenshots I take for tutorials and blog posts automatically get saved to the Desktop, it quickly gets cluttered. I get Hazel to sweep them away after they've sat there for 24 hours.
If you're an Intel Mac user, you might want to set Hazel to scan your Applications folder and label any applications in there that contain the keyword "Universalâ€? or "Intelâ€? –then you'll be able to avoid launching slower PowerPC optimized apps in favor of the ones built for your processor.
iTunes and AutoRate
Your iTunes Library is another place where your hard drive puts on weight. If you've got one of the current 5G iPods, you have the potential to duplicate up to 80GB of music on you Mac and iPod. In fact, the way iTunes is set up, you can hold more music on your Mac than you sync to your iPod, so your Mac can really pack on the pounds.
The best advice I can give someone with an out-of-control music catalog is "archive.� Sure you pride yourself on your extensive music collection but, c'mon, how much of it do you actually listen to? Don't know? iTunes does! Try something like this Smart Playlist on for size:
If you have music that you don't think much of, haven't played more than 10 times that has been hanging around on your drive for over 6 months, I've gotta ask: why did you buy it? And secondly: why are you hanging on to it?
Set up this Playlist and then burn a data disc of the songs it finds. Then delete those songs off your drive. (Highlight the contents of the Smart Playlist and hit Option-Delete, Click "Remove� when iTunes asks you if you are sure and the click "Move to Trash� when you are asked how you would like them removed. Don't worry you backed them up, right?
Maybe you're like most people and you haven't gone through each and every song in you collection and entered in your Star Rating. Go get a copy of AutoRate and run it on your entire music library. AutoRate sets the Star Rating for your music based on how often each track has been played and how often it has been skipped.
I hope these tips will help you shed your Mac's unwanted pounds and keep the weight off.


text:
Sparkling Hill introduces its new cleanse detoxification program for guests looking to take the next step in good health and wellness.
Led by the hotel's Naturopathic Physician, this program consists of 7 nights of guided treatment and nutrition with option to extend to a 2 or 3 week program.
The Cleanse Program includes:
- 7 nights accommodation in a Deluxe Room
- 7 day detoxification program to decrease the body's toxic burden
- Private dining room for program participants
- Access to KurSpa (40,000 sq.ft.) and to the 7 uniquely themed steam and sauna rooms, indoor pool complete with underwater music, starry Swarovski crystal sky, hot pool and outdoor infinity pool, Kneipp water therapy, Keiser – equipped fitness studio, Tea and Serenity Relaxation Rooms
- 3 appointments with Naturopathic Physician
- Personalized program designed by KurSpa's Manager and Naturopathic Physician. Your program includes 12 KurSpa treatments - ten health oriented treatments (six 60-minutes and four 30-minutes) and two beauty treatments
- Unlimited movement classes
- Underground Valet Parking
- Complimentary Wireless Internet
Please note this program starts on Saturdays only
Jan 1, 2013 - Dec 26, 2013
$3,900* CDN sgl. occ., $3,500* CDN pp, db. occ.
Call reservations now on 1.877.275.1556
*sgl. occ. means prices based on single occupancy. pp, db. occ. means prices per person based on double occupancy. Subject to availability. Applicable taxes will apply and are not included in the rate. Gratuities are not included and are recommended. Prices subject to change without notice. Does not apply to group bookings of 3 rooms or more. Offer cannot be combined with any other offer. Black-out dates apply. Rates in Canadian dollars. NEW steams and saunas hours and accesss policy>


text:
Driving from England to Ukraine
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
I am planing to drive a right hand drive car from england to Ukraine.Can anyone tell me what the procedure is and how long I can keep the car in Ukraine for.Also what probllems can I expect driving a right hand drive car.
Driving to Ukraine
I will also be driving from England to Ukraine withint he next few weeks. The Ukraine embassy informed me that all I need is the following: 1. Proof of ownership (normal log sheet) NOT a photocopy 2. Insurance certificate + Green card for insurance They tell me thats all I need. However, I am not sure how long you can keep it in Ukraine, some people on here say 3 months. Hope this helps. It would appear there are NO forms to complete before you go. GB |
Driving to Ukaine
I spent half of last year living in Kiev and came back this december and am now breaking my neck to get back i have a place to live but i want to drive there just want to have some wheels you know you can take the boy out the west but not the west out the boy its how long i can keep it there that i dont know i will be on a 12 month visa i saw a lot of german and french plated cars there and even a Jag on a UK F registration and i noticed the same ones more than once over the time i was there plus i have read somewhere else that it stupid to try and import it just come in with it and run it to death and dont worry about it plus i want to take my tools with me I am data cable installer and Electrician with a lot of site managment experience in the construction industry so i am gonna try to find some work is this a good idea I really would appreceate any advice anyone can give me on this
Driving licence
I also have a right had driving car. I think you drove left hand side driving cars only, I told you one thing there is no problem in right hand driving car if you know how to drive. You can keep it very long in Ukrain if you have a international driving licence(IDP) and green card.. You can drive freely in Ukrain if you have IDP. Because the rules and regulations of Ukrain are very hard. So be carefull my friend. Best of Luck!
Last edited by Kathy; 9th September 2009 at 20:08. |
I have thought about the same thing. Have a lot of bags and things to move so I thought about packing everything in to my car, drive over see a few things on the way instead of throwing my money at the airlines for excess luggage. I am not too concerned about the regulations or police in terms of having a foreign car over there because either way you probably get away with it. What would concern me more is the way Ukrainians drive. I don't think i could see myself safely driving a left hand drive car over there nevermind a right hand car.......
Previous Thread
Next Thread
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
All times are GMT +1. The time now is 14:02.


text:
Images from around the world chosen by the photo desk at the Winnipeg Free Press.
40 Total Pictures
December 23, 2012
Walk of Life
Photojournalist Phil Hossack follows a medical team from a single Winnipeg operation to four days, 39 patients, and 49 knee replacement surgeries in Managua, Nicaragua for Operation Walk, a Los Angeles-based organization providing orthopedic surgery to underprivileged populations around the world. Visit wfp.to/operationwalk for the full story and videos.
You can comment on most stories on winnipegfreepress.com. You can also agree or disagree with other comments. All you need to do is register and/or login and you can join the conversation and give your feedback.
Have Your Say
New to commenting? Check out our Frequently Asked Questions.
The Winnipeg Free Press does not necessarily endorse any of the views posted. By submitting your comment, you agree to our Terms and Conditions. These terms were revised effective April 16, 2010.
Ads by Google


text: Adjunct Professor Thomas Von Essen, Fire Commissioner, City of New York (Ret.) In his 30+ years with FDNY, Thomas Von Essen served; as a Firefighter in the South Bronx Ladder Co. 42, Union President 1993 - 1996, and ultimately Commissioner from 1996 – 2001. Prof. Von Essen received his bachelor's degree in 1972 in economics from St. Francis College and received his Master's degree in secondary education in 1982 from C.W. Post College. He served in the U.S. Navy prior to joining FDNY. Prof. Von Essen has received many awards and honors throughout his career including; three Honorary Doctorial degrees, two Medals of Honor, and a Humanitarian Award. Prof. Von Essen is presently a Risk/Safety Consultant partnering with such manufactures, industries and associations as Honeywell, Underwriters Labs and RJA Fire Protection Engineering.


text:
We'll send your gift parcel directly to your address of choice.
Personalize your gift parcel and choose one of our great cards to go with it.
click here
For orders of € 10 or more:
free delivery within Germany
with great offers and promotions
for private clients
for corporate clients
More than 100 outlets across Germany
Click here for the addresses
Click here