Frank,<div><br></div><div> is this close enough?</div><div><br></div><div>[:a :block :with :args|] decompile arguments collect: [:ea| ea key] #('a' 'block' 'with' 'args')</div><div><br></div>
<div>Not symbols, but strings.<br><br><div class="gmail_quote">On Mon, May 21, 2012 at 2:27 PM, Frank Shearar <span dir="ltr"><<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 21 May 2012 22:00, Bert Freudenberg <<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>> wrote:<br>
> On 21.05.2012, at 22:47, Frank Shearar wrote:<br>
><br>
>> Without having to decompile a block, how may I find the names of a<br>
>> block's arguments?<br>
>><br>
>> In other words, given<br>
>><br>
>> [:a :b :c | "stuff"]<br>
>><br>
>> I'd like to extract #(a b c).<br>
>><br>
>> (Failing that, I'll have to live with myBlock decompile arguments<br>
>> collect: [:a | a name asSymbol]).<br>
>><br>
>> frank<br>
><br>
> I don't know (I'm even surprise the decompiler knows) - but can you say a little bit more for what you would need that?<br>
<br>
</div></div>Sure! I'm working on a miniKanren-like logic programming<br>
language/framework. Typically in a miniKanren clone there's a macro<br>
called "fresh" that introduces logic variables. For instance,<br>
<br>
(fresh [x y]<br>
(== [x y] [1 5]))<br>
<br>
introduces two logic variables called x and y, and then unifies [x y]<br>
with [1 5] to give the substitution/most general unifier x -> 1, y -><br>
5.<br>
<br>
So I thought I could do something like<br>
<br>
[:x :y | {x. y} unifyWith: #(1 5)] fresh<br>
<br>
where BlockClosure >> #fresh currently looks like this:<br>
<br>
fresh<br>
^ self valueWithArguments: (self decompile arguments collect: [:a | a<br>
name asSymbol]).<br>
<br>
frank<br>
<br>
> - Bert -<br>
><br>
><br>
><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
</div>