## The cool stuff about Lisp for those of us with day jobs -- PART 1: Writing Your Own Addition Operator in Scheme

I have been having a great time watching the "Structure and Interpretation of Computer Programs" videos from MIT. The original ones from 1984. Something that I thought was really cool from video '1b' was the implementation of the + operator. They give 2 examples of different ways to pull it off in Lisp. To be honest, although they are both very simple, neither one is really obvious if you are coming from an imperative programming background. Both assume that all we have to use is the increment and decrement operators.

In case you are totally new to Lisp, basically the first symbol after an open paren is a function, and each expression after that is a param passed to it. This pattern is nested of course.

The first approach that the professor shows is to decrement the x and increment y until x is zero
So, in C we would write this logic as the function

`int add(int x, int y){ while(x > 0){ x--; y++; } return y;}`

And in Lisp it is

`(define (+ x y) (if (= x 0) y (+ (-1 x) (+1 y))))`

What's important about this aproach is that it shows how loops in imperative languages are replaced by recursion in functional ones. What we are doing here is defining a function named '+'. If the x value is 0 we just return y, else we decrement x, increment y and recursively call our function again. This obviously continues until x is 0 and y is our answer. An 'if' expresson in Lisp takes 3 parameters,

a predicate (in C we'd say conditional)
a consequent (in C this would be the code inside the if block)
an alternative (in C this would be the code in the else block)

The predicate in this is example "(= x 0)" which means "x equals 0"
The consequent in this exmple is "y"
The alternate is the function calling itself after incrementing y and decrementing x "(+ (-1 x) (+1 y))"

So, that one seemed pretty cool to me. It's a nice introduction to functional programming. The professor goes one step futher though and covers a slightly more mind bending, but still simple enough example. This one also terminates when x is zero but instead of incrementing y we will increment the expression that makes the recursive call.

In Lisp
`(define (+ x y) (if  (= x 0) y (+1 (+ (-1 x) y))))`
Thats pretty cool. Here is how it looks when you call this function to add the numbers 3 and 4. I will expand the function by substitution as the prof does in the video.
```(+ 3 4)(+1 (+ 2 4))(+1 (+1 (+ 1 4)))(+1 (+1 (+1 (0 4))))(+1 (+1 (+1 4)))(+1 (+1 5))(+1 6)7
```

[...] The cool stuff about Lisp for those of us with day jobs – PART 1: Writing Your Own Addition Op... [...]

[...] Here I define a procedure called “sicp1.3″ that takes 3 arguments. I then add the squares the those 3 args and subtract the square of the smallest. If you are not able to see how this code does what I described, then checkout my earlier post. [...]

Ugg bailey button triplet sale are amazing boots to have, safe to suit on plus they glimpse cool, too. What may be considered a terrific offer better than that?

Keeping your Ugg bailey button triplet looking amazing is easy. They refreshing up quite properly with some chilly consuming water collectively with a gentle cloth. you could need some authorized leather-based or suede cleaner on occasion. If they do take place to acquire wet (or appropriate after cleaning), be cautious to preserve them apart from any instant heat source. in no way suit them within of a washer or dryer. take into account that wool sweater you suit from the dryer once? Sheepskin can shrink, so letting your uggs on sale airdry is important. To pace factors along you can stuff some newspapers or cardstock towels within to soak up any additional moisture.

Winter, spring, summer, or fall, ugg boots outlet work. getting exceptionally warm, your ft stay cozy from the chilly weather. because of the fact they are produced from organically produced sheepskin materials, the fibers inhale as well as your ft won't get sweaty or smelly from the cozy weather, either. Just concerning the only time you can't suit on ugg bailey button triplet is through especially wet or muddy weather, the suede doesn't preserve up as well to all those conditions. Guys can glimpse just only a tiny much more rugged placing on ugg outlet , there's consistently a specific thing stunning about that look!

Get some ugg bailey button sale in ankle-high, mid-calf, and tall versions. You can locate ugg boots sale which have flat heels or much more chunky and textured soles. Generally, ugg bailey button sale are perceived as getting a casual footwear, meaning they go amazing collectively with your selected jeans. Pair them finding a short skirt and opaque tights or perhaps a extended skirt for some safe however stylish wardrobe choices.

Ugg bailey button chestnut arrive in so a broad range of reproductions and colors,ugg boots clearance it's hard to preserve keep track of of them all. Men's Uggs arrive in much more basic, traditional colours and styles, but for women, it's "anything goes" in conditions of colours and styles. appropriate after all, females need a pair of ugg boots clearance for just about every outfit, and, with Ugg Boots, you can almost do that.

Now, back again in the direction of the name, "Ugg." Rumor has it that "ugg" is definitely an Australian slang term for "ugly." whether or not or not this could be in fact how the name arrived about, "Ugg classic tall sale" now is synonymous with comfortable, casual, and stylish Australian sheepskin ugg classic short sale, the kinds that everyone wants.

Whatever you call up them, ugg classic short sale are pretty a strike now, everywhere. Trendsetters are tripping much more than on their own to acquire a pair ugg for cheap . From shepherds to farmers to celebrities to teens to cheap ugg bootsstandard people nowadays everywhere, you can't turn near to without finding seeing a pair of ugg classic short grey. It arrived getting a surprise, but now Ugg Boots are right here to stay.

A edition of ugg boots sale, the "Fug" (Flying Ugg) original made an bodily appearance outside inside the shepherd online community through earth War I. Pilots wore the cozy boots through chilly days. Later, from the 1960s, intelligent surfers figured that ugg classic tall sale can be amazing for sustaining their ft cozy in among the catching the waves or cheap ugg boots appropriate after coming out inside the chilly ocean water.

The name "Ugg boots sale" refers to some particular design of boot that is produced from genuine sheepskin. The boots have been initially made in Australia. Today, an American organization owns the ugg boots sale trademark ("Ugg Australia"),ugg boots sale uk but they are nevertheless made through precisely the same exact Australian Merino sheepskin, only in Australia they are marketed as "Australian Sheepskin Boots."

It just doesn't obtain a terrific offer much better than Ugg boots outlet. Style, warmth, and comfort all wrapped into just one pair of uggs!

November 18, 2011 | the north face outlet

In summary, when you are looking for a coach purses, it does not necessary to get the brand name to get good quality ones. There are a lot of discount and outlet store that sell brand name coach purse at the same quality as sell in brand name shop but a lot cheaper.louis vuitton outlet You ca find the name of these discount stores from the internet.

Once you have a list of discount stores that you are going to visit now you are ready to go.louis vuitton outlet Once to visit a shop, you will surprise that the north face outletthese outlet or discount store also have many discounted brand name items. These brand name items are normally the same as they are displayed in brand name shops,louis vuitton outlet but the price of the item that displayed in outlet store are a lot cheaper and they are still in good condition. So you can rest assure that you will get as same quality as brand name coach purse in brand name shops.

However, the best way to find discount stores in your area is from the internet. Many of search engines today has developed very advanced technique to provide information so you can have information you want by enter jest few keywords. For example, you may enter keywords like “coach outlet store online” or “coach purse discount store” with the name of your area and you will be amazed that once millions of places where you can visit appear. From the reason described above you will find that finding discount store in your area is very easy. You just need to know how to look for them and they will come your way.

Talking about discounted coach purse outlet, many people think about going to brand name shop and look for discounted item or go to department stores. However, sometimes it is quite difficult for people who live in remote area to come to big city and find brand name discounted items or go to department stores. In fact, there are so many discount locations to acquire cheap coach purses, many of them with vast varieties that will fit your lifestyle and personality. And you also are able to find affordable coach purses outlet with good quality by going to discount stores or at a bargain outlet stores.

As we all know that coach purse is another kind of purse that is very popular among women. Especially for the woman who wants to have great purse that will have everyone green with envy, you need to find a coach purse for your collection. However, even though coach purse seem to be the best type that many people want to have, but louis vuitton is also expensive. Moreover, many people seem not to spend such a high amount of money for a purse. Therefore, looking for cheap price or discounted cheap coach purses is probably a good way to save money, but also good for your image at sometimes a tenth of the price.

The best course of action to take sometimes isn't clear until you've listed and considered your alternatives. The following paragraphs should help clue you in to what the experienced person think is important. Those of you not familiar with the latest on how to find discount store for coach purse now have at least a basic understanding. But there's more to come. This article's coverage of the information is as complete as it can be today. But you should always leave open the possibility that future research could uncover new facts.

November 18, 2011 | the north face outlet

Can was called frost rose au of three war force, Christopher Association na they of battle consciousness natural is does not low of, zhiqian is just body in north face outlet store in the, see does not Qing global only. now after the north face so a reminded, Lima on reaction has came. almost on in the north face said finished of while three people of battle rhythm immediately for one meal, opposite of two sisters seems to note to has they of changes Windows, immediately Rob Shang came to intends to accounted for points cheap,

January 4, 2012 | north face outlet store