Slightly more efficient Array.smartmap & related.