Lisp

January 21, 2010 on 11:45 am | In Programming | No Comments

While driving to work this morning, I finally separated out what has been bothering me about Lisp. Functional programming proponents tend to make a big deal about avoiding side effects because it avoids long range coupling between functions and it makes list iteration trivially parallelizable. This is good for program maintenance and effective utilization of all the cores in a CPU.

Side effects are eliminated by avoiding (1) global variables and (2) functions that modify their arguments.

Point #1 is relatively easy in any language (except assembly), but it does require discipline, since global resources like files and databases are in principle always directly accessible, even if an encapsulating interface exists.

Point #2 is very difficult/painful in strongly typed languages like C++ and Java but very easy in untyped languages like Lisp, Perl, and JavaScript, mainly because untyped languages make it very easy to return a heterogeneous list of values/objects.

This is what has been bothering me about Lisp in the back of my mind: a list is the most natural return value, both because the syntax is simple and because most standard functions operate on lists. A homogeneous list is fine, of course, but a list of heterogenous values is terrible because (1) it is hard to remember what is returned in each slot and (2) without compile time checks, modifying a function to insert a new value into the returned list creates a maintenance nightmare. You have to manually find and update every use of the modified function, and if you miss one, you have a subtle bug.

How can we avoid all this trouble? Using a map instead of a list alleviates the problems because (1) well chosen key names are easier to remember and (2) most of the existing uses of the function probably will not need to be updated because they do not care about the new value and the original values will still be accessible via the same keys.

Unfortunately, working with maps (or hash tables) in Lisp is a lot messier than working with lists. In Perl and JavaScript maps are part of the language syntax.

The Future of UI is not boring

January 15, 2010 on 11:27 pm | In Computers, Deep Thoughts | No Comments

Scott Berkun’s tangent off John Gruber’s wistful piece about the Apple Newton is flat out wrong. The future of UI is here already, and it is anything but boring. 10/GUI was announced several months ago, and SixthSense has been under development for a while. Both have the potential to revolutionize how we use computing power. The former replaces the ubiquitous desktop mouse, while the latter makes the iPhone seem antiquated and clunky. While neither will be available by Christmas 2010, gestures are invading our computing experience. Apple continues to execute on its long-term plan by introducing more and more gesture recognition in every new model of laptop and mouse. Designers who are not already thinking about how to effectively use the expressive power of systems like 10/GUI and SixthSense will probably find themselves out of work by 2020.

Avatar

January 13, 2010 on 11:17 am | In Miscellaneous | No Comments

The game has changed.

I was very skeptical when I read that James Cameron was out to out-Lucas George Lucas. I don’t believe it’s possible, but only because every game changing quantum leap up has the same general effect of blowing the public’s collective mind. But there is no question that Avatar has now changed the game in exactly the same way that Star Wars did thirty years ago. Audiences will not put up with 2D summer blockbusters much longer.

The story is certainly not as sweeping in scope as Star Wars, but Cameron deserves credit for at least thinking up an entire continent instead of only a few square miles of jungle. The characters were all stereotypes, and they died in the standard order, but they were still well done and served the purpose of making as deep an emotional impact as possible. As far as I can tell, that was what Cameron wanted: amplify the impact of watching full 3D by giving the audience characters to whom they can readily respond.

Humility

December 25, 2009 on 12:31 pm | In Deep Thoughts, Faith | No Comments

I recently read The Language of God: A Scientist Presents Evidence for Belief because it was recommended to me by a retired pastor who is a friend of my wife. Now I recommend it, too. The science is clearly presented, and the arguments for the existence of God are worth considering.

When I went to find the book on Amazon, I discovered that there is a whole cottage industry based on writing books like this. I was a bit surprised, but I really shouldn’t be. People on both sides of the debate never cease to propound their opposing views. Why shouldn’t there be a group who tries to bridge the chasm?

The sad part is that all three groups mostly get it wrong. Regardless of the point of view — be it bible only, bible+science, or science only — they almost always fall into the trap of thinking that they actually know how the universe really works.

The fact is, we don’t.

We cannot prove that God exists. If He does not exist, we are left wondering how the universe came to exist and what our purpose is, if any. If He does exist, we are left wondering how He came to exist and, if you accept the Bible, why He behaves the way He does.

It is quite humbling to admit that we just don’t know what is really going on. It is also scary, however, which is probably why most people cling desperately to one viewpoint or another. (This applies to all religions, not just Christianity.)

However, if people would accept this dose of humility, then I think we would all find it much easier to get along.

Chuck E. Cheese

December 6, 2009 on 2:45 pm | In Miscellaneous | No Comments

We just escaped from the ear-splitting, crass, insult that is Chuck E. Cheese. No offense to the parents who scheduled the birthday party there, but the place is intolerable. While I carried my daughter to the car, she listed out everything she doesn’t want for her next birthday party: no loud music, no screaming children, no Chuck E. Cheese. Wise kid. From now on, I’m referring to the place as Yuck E. Cheese.

Time Trap

December 5, 2009 on 6:01 pm | In Books, Movies | No Comments

I just finished Keith Laumer’s Time Trap, published by Baen Books. I found it interesting that Laumer’s time trap worked exactly the same way as in Groundhog Day: It reset every 24 hours, but you remembered everything from the previous cycles. If you were hurt or killed, you woke up whole again at the reset.

New Furniture

December 3, 2009 on 11:07 am | In Family, House | No Comments

My daughter’s new furniture arrived yesterday. She has outgrown her toddler bed, and we found the perfect bedroom collection at easylife. It was discontinued, so we got the floor model at 40% off. Of course, that meant scratches, and after it was delivered, we discovered that the bottom of one of the drawers was broken loose, but nothing that a few nails couldn’t fix!

Since we want her bed to be against the wall, away from the window, one of the two under-the-bed drawer sets wouldn’t make any sense under the bed, so we put it in the closet. It fits so perfectly that I’m tempted to start believing in Intelligent Design ;)

The Long Road to Hell

November 29, 2009 on 8:15 pm | In Programming | No Comments

A friend just introduced me to Variadic Templates in C++0x. When will they admit that they just plain started from the wrong place? Their example of how to print a comma-separated list of arbitrary values, which is impossible in C++ without variadic templates, is so trivial in an untyped language that nobody would bother to discuss it.

Has it really never occurred to the C++ crowd that they should start with a loosely typed language and then add in an option for compile-time type checking? Objective C actually does this. A function parameter can be id, which means it accepts anything, or it can be a type, which means that it accepts that class or any subclass, or it can be a Protocol, which means that it accepts any class which implements the required methods. (Protocols also feature prominently in the new language, Go.)

The only flaws I can see in Objective C are (1) id only accepts objects, not primitives, and (2) constructors return id, so there is no type checking when an object is created. Java fixes the former this via autoboxing, but Java doesn’t have the concept of a Protocol and reflection is very painful.

One could argue that another flaw in Objective C is the lack of private functions. However, this can be solved the same was as in JavaScript: static functions, which are accessible only to other functions declared in the same source file.

Eee PC Back Online

November 12, 2009 on 9:16 pm | In Computers | No Comments

I recently made the grave mistake of upgrading my Eeebuntu installation to the latest Ubuntu, after which support for my external monitor vanished. Ouch! I finally have it working again, after starting from a clean install off the Eeebuntu CD. This time around, it went a bit faster, since I knew that networking would not work without a kernel upgrade, so I downloaded it before the re-install. Thank goodness I put /home on a separate partition!

Vacation in Buffalo

October 28, 2009 on 3:53 pm | In Travel | No Comments

The US Airways planes seem old, but their pilots really know how to land. On our flight from LAX to Charlotte, the landing was so smooth that I didn’t even realize we were on the ground until they reversed the engines to slow down. Later, when we landed in Buffalo, there was turbulence at ground level, but the pilot still set us down smoothly. The service on both flights was also great. Just remember to bring your own food :)

In Buffalo, we visited SUNY Buffalo, my wife’s alma mater. We also ate Buffalo wings at Duffs, a local place that knows how to do it right. The fall colors were beautiful.

Next, we drove to Niagara Falls. I wasn’t impressed by the Behind the Falls tour, but the view from our room in the Marriott was fantastic. The dinner at the Mandarin, a chinese buffet a few miles off the strip, was even better. If you want a good breakfast, eat at Falls Manor. They also have a motel, if you don’t want to pay for a hotel on the strip. In fact, the service at the Marriott in Niagara was terrible. This was quite surprising since the service at the Marriott in Buffalo was terrific.

Our final destination was a visit to a couple in Ontario (CA) whom my wife knew from long before she met me. It was great to finally meet them! The husband is a retired pastor. He encouraged me to continue digging into Evolutionary Theism.

We drove back to Buffalo through a persistent drizzle. It was a nice reminder that I only want to visit :)

Next Page »

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^