use duck-typing to distinguish strings from lists