No default value for array-reduce on empty arrays Bradley Lucier (13 Jun 2022 17:13 UTC)
Re: No default value for array-reduce on empty arrays Alex Shinn (13 Jun 2022 21:44 UTC)
Re: No default value for array-reduce on empty arrays Per Bothner (13 Jun 2022 22:49 UTC)
Re: No default value for array-reduce on empty arrays John Cowan (14 Jun 2022 11:28 UTC)
Re: No default value for array-reduce on empty arrays Marc Nieper-Wißkirchen (14 Jun 2022 11:41 UTC)
Re: No default value for array-reduce on empty arrays John Cowan (14 Jun 2022 11:53 UTC)

Re: No default value for array-reduce on empty arrays Per Bothner 13 Jun 2022 22:48 UTC

On 6/13/22 14:44, Alex Shinn wrote:
> I think it's fine to raise an error in this case.  We can't predefine an alist of
> all possible identities, and if you add an identity argument there's no useful
> difference between reduce and fold.

If you had "procedure properties", it would be reasonable to check for an 'identity property.

Barring that, you could call op with zero arguments.
Works for many procedures you would pass to reduce.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/