Re: How to roll up multiple Line calls into a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg118385] Re: How to roll up multiple Line calls into a loop
- From: "Christopher O. Young" <cy56 at comcast.net>
- Date: Mon, 25 Apr 2011 07:29:26 -0400 (EDT)
- References: <iorih5$o6t$1@smc.vnet.net> <iouedm$6h6$1@smc.vnet.net>
On 4/23/11 7:50 AM, in article iouedm$6h6$1 at smc.vnet.net, "Dan"
<dflatin at rcn.com> wrote:
> Graphics[(Line[{{0,11-#},{#,0}}]&)/@Range[10]]
If we want to avoid typing out "Range", we can just define "R" as Range.
Then we can do this with:
Graphics[
Line[{{0, 10 - #}, {#, 0}}] & /@ 0~R~10
]
It looks like the ampersand will apply to the whole Line[ ] expression
without having to parenthesize it.
What I'd really like to do is have a more intuitive expression such as the
ellipsis character, =8A, for Range, and to be able to use it the way "+" and
"-" are used, without having to type the tildes on either side to show it's
an infix symbol.
At any rate, here it is with the ellipsis defined as Range:
\[Ellipsis] = Range
Graphics[
Line[{{0, 10 - #}, {#, 0}}] & /@ 0~\[Ellipsis]~10
]