Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: How to work with In?

  • To: mathgroup at
  • Subject: [mg113996] Re: How to work with In?
  • From: kj < at>
  • Date: Sat, 20 Nov 2010 06:12:49 -0500 (EST)
  • References: <ic5opg$70l$>

In <ic5opg$70l$1 at> Oliver Ruebenkoenig <ruebenko at> writes:

>On Fri, 19 Nov 2010, kj wrote:

>> I want to create a list consisting of the (unevaluated) expressions
>> that were entered in a particular subrange of the In array.  I.e.,
>> what I want is (almost) something like this:
>> Table[In[i], {i, 300, 375}]
>> except that this won't work, because each In[i] will be evaluated.
>> This also fails
>> Table[Hold[In[i]], {i, 300, 375}]
>> because now the i is not evaluated, so the result is a list of
>> multiple copies of the expression Hold[In[i]].
>> How can I do what I'm trying to do?

>I think this is your friend

>Table[With[{i = i}, Hold[In[i]]], {i, 300, 375}]

That's one cool trick!  Thanks!

Unfortunately, it doesn't solve this problem:

In[31]:= Table[With[{i = i}, Hold[In[i]]], {i, 20, 30}]

Out[31]= {Hold[In[20]], Hold[In[21]], Hold[In[22]], Hold[In[23]], 
 Hold[In[24]], Hold[In[25]], Hold[In[26]], Hold[In[27]], Hold[In[28]],
  Hold[In[29]], Hold[In[30]]}

I need each of In[20], In[21], ..., In[30] to be processed by the
kernel exactly once before clamping the result with Hold.

By the way, being able to limit the level of evaluation to a precise
number of "passes", greater than zero, but not all the way to full
evaluation, is something I find myself needing very often.


  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Re: Replacement Rule with Sqrt in denominator
  • Previous by thread: Re: How to work with In?
  • Next by thread: Re: How to work with In?