"abind" <-
function(x, y, ..., ALONG=length(dx))
{
  if (missing(y))
    return(x)

  x <- as.array(x)
  dx <- dim(x)
  nx <- dimnames(x)
  got.nx <- !is.null(nx)

  if (!is.numeric(ALONG) || length(ALONG)>1)
    stop("Inappropriate \"ALONG\"")

  y <- as.array(y)
  dy <- dim(y)
  ny <- dimnames(y)
  got.ny <- !is.null(ny)

  ii <- seq(along=dx)
  if (length(dx) != length(dy) || !(ALONG %in% ii))
    stop("Dimension mismatch")
  pi <- c(ii[-ALONG], ALONG)
  opi <- order(pi)

  if (!all(dx[-ALONG] == dy[-ALONG]))
    stop("Cannot bind along \"ALONG\"")

  x <- matrix(aperm(x, pi), nc=dx[ALONG])
  if (got.nx)
    dimnames(x) <- list(NULL, nx[[ALONG]])
  y <- matrix(aperm(y, pi), nc=dy[ALONG])
  if (got.ny)
    dimnames(y) <- list(NULL, ny[[ALONG]])
  robj <- cbind(x, y)
  nxy <- dimnames(robj)[2]
  if (is.null(nxy))
    nxy <- list(NULL)

  dim(robj) <- c(dx[-ALONG], dx[ALONG]+dy[ALONG])
  robj <- aperm(robj, opi)
  if (got.nx)
    dimnames(robj) <- c(nx[-ALONG], nxy)[opi]
  else if (got.ny)
    dimnames(robj) <- c(ny[-ALONG], nxy)[opi]

  Recall(robj, ..., ALONG=ALONG)
}

  
