Optimize Prime

To content | To menu | To search

Thursday, August 31 2006

Terse, to say the least

I've been thinking and talking a lot about programming language design recently. I find when discussing the relative merits of languages, I often get hung up on the question of what is and isn't possible in a decent way in any given language. So I've decided to compile a set of the ways to solve a particular problem in several different languages. Hopefully this is the first of a series.

Problem: define a function "adder" of one variable (x) which returns another function of one variable (y) that sums x + y

My answers for every programming language I've thought about or used recently, in order of decreasing length:

Javascript:

function adder(x){ return function(y){ return x + y; } }

Scheme:

(define adder (lambda (x) (lambda (y) (+ x y))))

Ruby (a Proc is not exactly like a function because Ruby is dirty):

def adder(x) Proc.new {|y| x + y }; end

Erlang:

adder(X) -> fun(Y) -> X + Y end.

Forth:

: adder quote [+ ] append ;

Arc:

(def adder (x) [+ _ x ])

Haskell (currying is cheating):

adder = (+)

C and Java got skipped because the question isn't really meaningful for them, since they don't have anonymous functions.

Tuesday, August 29 2006

Yogurt: The Unknown Danger

I recently took a plane flight. On the first segment, the TSA confiscated my shaving cream. On the second, my toothpaste. Is the government fighting a war on hygiene? If my toothpaste is so dangerous, why did you let me take it on the first flight? This seems to imply the TSA is either enforcing useless rules without purpose, or failing to enforce useful rules, or both. The loud speaker barks out more orders as I sit in the airport. The warning level is currently orange and I should be alert! Vague, passive fear - my favorite kind. Boarding with yogurt purchased from airport shops is Strictly Forbidden!

I am in shock. For once, I am in complete agreement with the TSA. Yogurt is dangerous and needs to be kept off of our planes at all costs. But I am disturbed by a glaring weakness in the system: we are still selling the very tools required to secret yogurt onto our planes.

While surely the extremely thorough security check given by the flight attendants as you board would catch a simple ruse like hiding the yogurt by placing it in a bag, I am worried they will miss other more devious possibilities. For example, they sell good, honest, plane-legal muffins in the airport. But I happen to know they do not check your muffin when you board, and it would be only too easy for a criminal to hollow out the muffin and fill it with yogurt. I expect the TSA to follow up on this glaring security hole. Muffin inspection kits should be present at every gate.

Worse yet, you could easily smuggle yogurt in your mouth. Does anyone demand to look in your mouth before you board yet? If they don't, it's critical they start. I don't believe they sell plastic bags suitable for secreting yogurt elsewhere on your person yet, but you could bring them in in your luggage. Either we need to remove all plastic bags from luggage in the security checkpoint, or we need cavity searches at the plane door. Realistically, given that the TSA missed my toothpaste so easily, we probably need both.

Sunday, August 27 2006

The Kiko Asset Sale: Finished

The auction was a success! I can't reveal the identity of the buyer quite yet, but it's a very respectable organization that I think will be a great home for Kiko Calendar. I think this venture has proven that auctioning off intellectual property assets is a legitimate revenue route for a company to take. Hopefully others will follow us in this, because so many valuable pieces of software wind up simply abandoned instead.

Tuesday, August 22 2006

The $100k Plan

Teachers are paid like mid-level administrators and given a job for skilled professionals. They raise our children every weekday. For other equivalently important jobs, we offer high salaries to attract the most qualified. Salaries are important both for the money and for the status that comes along with it.

It is difficult to recruit the best to a difficult job with low pay and status. In many places we simply can't find enough qualified teachers, let alone enough good ones. The solution to this problem is obvious, and has been proposed by many other than myself: pay our teachers more. So let's imagine a new kind of school where teachers were paid as professionals on par with doctors, lawyers, or engineers.

Starting salary at these new schools will be $100,000, compared to a current national average of $30,719. Public schools spent an average of $8,287 per child in 2004. That means each teacher must teach about 12 students to cover their salary. It's a general rule of thumb that overhead (work space, shared support staff, basic supplies, benefits) is at least 1/3 of salary; let's say it's 1/2, giving 18 students/teacher. Allowing for pay raises similar to the current system (teacher salaries reach an average of $46,597) brings that number to 27. We will ruthlessly cut anything else from our budget, because there simply won't be sufficient funds. A much lower teacher/student ratio requires structural changes to the way schools are organized.

The main consequence of this lower teacher/student ratio is a large reduction in the number of class hours available per week to each student. It simply won't be possible to fill schedules with 6 classes every day of the week. Instead, the school would therefore have to be structured much more like a college than a traditional high school. Students would take fewer classes concurrently, and classes would commonly meet only 2-3 times per week instead of every day. It also means more serious work required out of class, both by the students and the teachers responsible for them.

The low ratio also requires us to keep the schools as small as possible, so that natural social effects can help control disciplinary problems. Smaller schools require fewer support staff and less specialized equipment as well, which is good because we're not going to have a lot of extra money.

The smaller number of teachers means that each teacher is much more individually important. All other highly paid professionals have an apprenticeship style training program, and teachers would benefit from the same. Luckily, the smaller number of teachers also means that we don't have to hire as many new teachers per year, which should make it easier to provide quality training.

An incomplete list of other consequences which require thought:

  • Small schools have limited facilities and social opportunities by nature, so perhaps a coalition would be required
  • Vouchers? Charter schools? Reform of current public schools?
  • What does the distribution of teachers of subjects look like?
  • Who decides when and with what staff to create one of these schools? How is money allocated?

(Thanks to Steve for the conversation that sparked this idea and feedback)

Monday, August 21 2006

The Kiko Asset Sale

Seconded

First Post

A new blog; almost certain to be abandoned again.

page 2 of 2 -