Implementing vector-for-each in PLT

François asked how one might implement vector-for-each. Here are two solutions that were provided:
Matthias

#lang scheme
(define-syntax for-each-vector
  (syntax-rules ()
    ((for-each-vector proc vec ...)
     (let ((len (min (vector-length vec) ...)))
       (do ((index 0 (+ index 1)))
         ((= index len))
         (proc (vector-ref vec index) ...))))))
(for-each-vector
 (lambda (a b) (display (+ a b)))
 #( 1 2 3)  #( 1 2 3))
(newline)
;; functional, preferred
;; for-each-vector2
;; (All (A C ...) ((C ... -> A) (Vectorof C) ... -> A))
(define (for-each-vector2 p . vec)
  (for ((i (in-range (apply min (map vector-length vec)))))
    (apply p (map (lambda (v) (vector-ref v i)) vec))))
(for-each-vector2
 (lambda (a b) (display (+ a b)))
 #( 1 2 3)  #( 1 2 3))
(newline)

Sam TH

#lang scheme
(require srfi/43)
(for ([a #(1 2 3)] [b #(1 2 3)])
  (display (+ a b)))
(newline)
(vector-for-each
 (lambda (i a b) (display (+ a b)))
 #(1 2 3) #(1 2 3))

Why Scheme has tail call optimization

Actors was Hewitt’s attempt to model Smalltalk. Scheme was Steele and Sussman’s attempt to understand Actors. TCO was inherited from Actors. It is an OOP concept.

I confirmed this with Guy when I prepared for my ECOOP talk and I have the relevant email somewhere.

– Matthias

(via PLT [1])

[1]: “guido on tail recursion” Dimitris Vyzovitis vyzo at media.mit.edu Thu Apr 23 00:01:01 EDT 2009

A Maven build number plugin

Here is a plugin to:

get a unique build number for each time you build your project. So while your version may remain constant at 1.0-SNAPSHOT for many iterations until release, you will have a build number that can uniquely identify each build during that time. The build number is obtained from scm, and in particular, at this time, from svn. You can then place that build number in metadata, which can be accessed from your app, if desired.
The mojo also has a couple of extra functions to ensure you get the proper build number. First, your local repository is checked to make sure it is up to date. Second, your local repository is automatically updated, so that you get the latest build number. Both these functions can be suppressed, if desired.
Optionally, you can configure this mojo to produce a revision based on a timestamp, or on a sequence, without requiring any interaction with an SCM system. Note that currently, the only supported SCM is subversion.

(via Maven)