protected static Object argToNetStream(Argument arg)
			throws ExtensionException, LogoException {
		Object value = arg.get();
		if (value instanceof Boolean || value instanceof Double
				|| value instanceof String)
			return value;

		LogoList list = arg.getList();
		if (list.isEmpty())
			throw new ExtensionException("The list must not be empty");
		Class<?> elementClass = list.get(0).getClass();
		for (Object o : list) {
			if (!(o instanceof Boolean) && !(o instanceof Double))
				throw new ExtensionException(
						"The list elements must be of type boolean or number");
			if (!o.getClass().equals(elementClass))
				throw new ExtensionException(
						"The list elements must be all of the same type");
		}
		return list.toArray();
	}