[Jprogramming] Deal
Dan Bron
j at bron.us
Tue Mar 15 23:26:58 HKT 2011
Depends on which argument is "data" (calculated, changes frequently) and which is control (fixed, or changes infrequently wrt the data).
In other words, if you wanted to make a reusable verb, which is more likely in your context:
deal =: 3&?
or
deal =: ?&10
?
If the former (which is more common), I'd be inclined to write 3?10 10 10. If the latter, I'd be inclined to write 10 ?~ 3 3 3.
My inclinations stem from the facts that it is easier for me to scan code if I know I can expect controls on the left and data on the right, and it's easier for me to write code if I can incrementally build up data right-to-left, rather than using nested parens.
But I also have to be wary of the hobgoblins of consistency.
-Dan
Please excuse typos; composed on a handheld device.
-----Original Message-----
From: Raul Miller <rauldmiller at gmail.com>
Sender: programming-bounces at jsoftware.com
Date: Tue, 15 Mar 2011 11:12:10
To: Programming forum<programming at jsoftware.com>
Reply-To: Programming forum <programming at jsoftware.com>
Subject: Re: [Jprogramming] Deal
On Tue, Mar 15, 2011 at 11:03 AM, Bo Jacoby <bojacoby at yahoo.dk> wrote:
> 3 3 3?10 is two characters shorter than 3?10 10 10 and so it should be preferred.
And 3?3#10 is shorter than both, though is closer to 3?10 10 10 than 3 3 3?10.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list