MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Short-cut for reiteration, via postfix usage of Table as pure

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118394] Re: Short-cut for reiteration, via postfix usage of Table as pure
  • From: Peter Pein <petsie at dordos.net>
  • Date: Tue, 26 Apr 2011 06:50:59 -0400 (EDT)
  • References: <iorih5$o6t$1@smc.vnet.net> <ip14qm$ged$1@smc.vnet.net> <ip3lrr$r76$1@smc.vnet.net>

I do not want to offend you.

Is this a contest laziness vs. readability?

There are options for some functions as strings like "AlternatingSigns", 
"ExtrapolatingOscillatory" and others where Ctrl-K does not help and 
"Table" is too complicated????

shaking the head,
Peter


Am 25.04.2011 13:27, schrieb Christopher O. Young:
> Infix notation saves another keystroke and seems a little more intuitive to
> me:
> Graphics[
>   Line[{{0, 10 - k}, {k, 0}}] // #~Table~{k, 0, 9}&
> ]
>
> Or, using the definition (to be put in the initialization file)
>
> T = Table;
>
> we have:
>
> Graphics[
>   Line[{{0, 10 - k}, {k, 0}}] // #~T~{k, 0, 9}&
> ]
>
> We can read this as "lines going from {0, 10 - k} to {k, 0} where k goes
> from 0 to 9".
>
> In the case of Line[ ], which accepts a list of points, we can shorten
> things even more, to,
>
> Graphics[
>   Line[{{0, 10 - k}, {k, 0}}~Table~{k, 0, 9}]
> ]
>
> This is with the standard infix notation involving the tilde, "~".
>
> With "T" defined as Table, we've got things down to a reasonable number of
> keystrokes:
>
> Graphics[
>   Line[{{0, 10 - k}, {k, 0}}~T~{k, 0, 9}]
>   ]
>
>>> I have the following bit of graphics:
>>>
>>>     Graphics[{
>>>    Line[{{0, 10}, {1, 0}}],
>>>    Line[{{0, 9}, {2, 0}}],
>>>    Line[{{0, 8}, {3, 0}}],
>>>    Line[{{0, 7}, {4, 0}}],
>>>    Line[{{0, 6}, {5, 0}}],
>>>    Line[{{0, 5}, {6, 0}}],
>>>    Line[{{0, 4}, {7, 0}}],
>>>    Line[{{0, 3}, {8, 0}}],
>>>    Line[{{0, 2}, {9, 0}}],
>>>    Line[{{0, 1}, {10, 0}}],
>>>    }]
>>>
>>>
>>> I want to simplify it to do some sort of iteration to compute the end points
>>> of the lines. I can do this easily in a variety of procedural languages but
>>> I haven't yet grokked how Mathematica would do this.
>
>



  • Prev by Date: Re: Limit[f[x], x->a] vs. f[a]. When are they equal?
  • Next by Date: Re: Limit[f[x], x->a] vs. f[a]. When are they equal?
  • Previous by thread: Re: Short-cut for reiteration, via postfix usage of Table as pure
  • Next by thread: Re: Short-cut for reiteration, via postfix usage of Table as pure