(archive 'newLISPer)

June 27, 2008

The making of … Scene 78

Filed under: newLISP — newlisper @ 17:32
Tags:

INT. OFFICE. NIGHT. GEORGE sits at a big desk. A computer screen casts a dull light over a pile of papers.

The phone rings. GEORGE answers.

STEVE: (VOICEOVER) Hey, George, it’s Steve. Any progress on the title? Gonna have to move forward on this real quick now.

GEORGE: Nothing yet, Steve. Still working through some suggestions. I got the final draft of the titlemaker code, just running it now.

STEVE: Uh huh, OK. What did you feed into it this time?

GEORGE: Those key words we talked about last week. Changed a few.

STEVE: Right. So, did we get any promising ideas?

GEORGE: Um … let me see. Bit of problem with memory allocation. Ah yes. How about: “Indiana Jones and the Lost Kingdom of the Crystal Grail.”

STEVE: I dunno. Sounds a bit … er … country and western.

GEORGE: Know what you mean. So what about “Indiana Jones and the Holy Crystal of the Doom Raiders”. OK, don’t answer… Try “Indiana Jones and the Doom Skull of the Lost Kingdom”? No? “Indiana Jones and the Lost Legend of the Holy Kingdom”?

STEVE: Yeah, yeah, it’s not … these are just not working for me. Although I like the first four words. They’re, you know, strong. Are you sure that code’s good, George?

GEORGE: Yup, got it from Hanson, out East. He’s usually our number one guy for this kind of thing. Looks OK to me, I think we got the latest version…

Cut to computer screen, which shows the following programming code.

(define (mappend) (apply append (apply map (args))))

(define (remove1 elt lst)
  (let ((elt-pos (find elt lst)))
    (if elt-pos (pop lst elt-pos))
    lst))

(define (k-permutations k multiset)
  (let ((pivots (unique multiset)))
    (if (= k 1)
        (map list pivots)
        (mappend (lambda (p)
                 (map (lambda (k-1-perm) (cons p k-1-perm))
                      (k-permutations (- k 1) (remove1 p multiset))))
               pivots))))

(set 'keywords
  '("Lost" "Skull" "Kingdom" "Raiders" "Ark" "Grail" "Doom" "Legend" "Holy" "Crystal" "Kingdom"))

(map (fn (title)
   (println  "Indiana Jones and the "
     (title 0) " "
     (title 1) " of the "
     (title 2) " "
     (title 3)))
   (k-permutations (length keywords) keywords))

STEVE: Hmm, well it sure isn’t doing the business for us yet. Run it some more – we’ll just have to keep at it until something good turns up.

GEORGE: OK, Steve. What about “Indiana Jones and the Lost Skull of the Legend Kingdom”?

STEVE: Nah.

GEORGE: Uh, “Indiana Jones and the Grail Ark of the Holy Skull”?

STEVE: Holy skull? Christ, George, I think even Crystal Gayle’s better than that.

FADE.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: