Re: [q-lang-users] Polynomial module.
Brought to you by:
agraef
From: Keith T. <kaz...@ea...> - 2006-11-03 03:04:03
|
If I may offer my two cents ... --- Albert Graef <Dr....@t-...> wrote: --- var Y in --- sieve {X|Xs} = {X|sieve {Y:Y in Xs,Y mod X<>0}}; [1] one advantage wrt. writing "var Y in" : definitions remain free of clutter; [2] one disadvantage wrt. writing "var Y in" : it takes two (2) lines of code to do the work of one. Paul Graham once declared that "succinctness is power" [ http://www.paulgraham.com/power.html ]; and personally, I prefer writing one slightly longer line of code over writing two lines of code. --- Albert Graef <Dr....@t-...> wrote: - sieve {X|Xs} = {X|var Y : sieve {Y:Y in Xs,Y mod X<>0}}; [1] one advantage wrt. in-ining "var Y : " : only one (1) line of code is required (see above); [2] one (possible) disadvantage wrt. in-ining "var Y : " : are we overloading the colon <:> in an ambiguous way? Obviously, I do not know; what about it, Albert? Other than this question, it looks nice and fairly "Q-ish". Alternatives : [a] sieve {X|Xs} = {X|local Y : sieve {Y:Y in Xs,Y mod X<>0}}; [b] sieve {X|Xs} = {X|var Y in sieve {Y:Y in Xs,Y mod X<>0}}; [c] sieve {X|Xs} = {X|local Y in sieve {Y:Y in Xs,Y mod X<>0}}; [d] sieve {X|Xs} = {X|Y| sieve {Y:Y in Xs,Y mod X<>0}}; Wait a minute... I think [d] is a "ringer". It looks like Smalltalk to me! =) Cheers, Keith |