title: Smalltalk: using a block as a block argument?
body: <p>Is it possible to pass a block statement as a block argument for a given depth k? For example, if k = 1, I have f(x) defined as <code>[x + 3]</code>, but if k=2, I want f(f(x)), which is <code>[[x + 3] + 3]</code>. This is for an assignment, so I am required to use a block statement. <code>#value:</code> seems to only take integers, is there a more general version of <code>#value:</code>? </p>
  
  <p>EDIT: Let me be a little clearer. My function takes a range from a to b, and a depth k. The function will evaluate on a block statement. So, for <code>[x + 3] method: 1 to: 3 for: 2</code> will evaluate <code>[[x+3] + 3]</code> from 1 to 3. I can evaluate from 1 to 3 just fine whenever k = 1. I'm trying to modify the block statement <code>[x+3]</code> into <code>[[x+3]+3]</code>, and that's where I'm running into trouble. I've tried</p>
  
  <pre><code>tempvariable := self "where self is the block statement [x+3]"
  tempvariable := tempvariable value: self
  </code></pre>
  
  <p>but I'm getting a 
  <code>BlockClosure(Object)&gt;&gt;doesNotUnderstand: #adaptToNumber:andSend:</code> error (which is why I thought it was integer only)</p>