This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: why (apply + (int[] 1 2 3)) won't work ?
- From: Morven Sun <sunixm at gmail dot com>
- To: Jamison Hope <jrh at theptrgroup dot com>, Per Bothner <per at bothner dot com>, kawa at sourceware dot org
- Date: Sun, 9 Jun 2013 16:49:11 +0800
- Subject: Re: why (apply + (int[] 1 2 3)) won't work ?
- References: <CAKZUWfi_eL+x==736dpU6QdBLpHXHk8TaXYzWDmPheYXb0DzAw at mail dot gmail dot com> <51B42C0E dot 8080502 at bothner dot com> <90D06C3D-E227-4E22-9C8D-FEFA4612A9C9 at theptrgroup dot com>
2013/6/9 Jamison Hope <jrh@theptrgroup.com>:
> On Jun 9, 2013, at 3:17 AM, Per Bothner <per@bothner.com> wrote:
> It seems like that should be "if (count == 1)", since it otherwise
> is completely dropping the first argument to apply (i.e. the actual
> procedure).
>
> (apply + 0 (object[] 1 2 3)) does work, as does
> (apply + 0 (integer[] 1 2 3)).
What a wonderful trick. Great Works.
>
> Primitive arrays are not supported at all, though, since they are
> disjoint from Object[]. I'm sure a patch would be welcome to allow
> for them, but it'll be a hassle since you have to handle each
> primitive type separately (and there are 8 of them).
>
If all these arrays works the same way, the program would be much
easier to write. :)
I've seen this in Mathmatica, It's like Scheme but much more consistent.
Yes, some runtime penalty would be suffered. But it's not the
performance that all matters, isn't?
--
::::Do what you like
::::Like what you do