Hi -
Yes, indeed, the run-pipeline example works fine, composed
of strings of unix commands. My components are Factor callable
quotations and a launch descriptor:
SYMBOL: my-process
{
<my-process> ! ( -- desc )
[ run-detached ] ! ( -- process )
[ my-process set-global t ] ! ( -- t )
}
run-pipeline
Calling run-pipeline on the sequence fails with:
"Error in thread 341 (Future, [ ~slice~ ~quotation~ ~quotation~ dip
run-pipeline-element...):
Data stack underflow"
Note that the phrase "<my-process> run-detached my-process set-global t"
completes successfully in the listener. Also, the code compiles without
error in its
compilation unit.
I can step down through the code as far as the word map! successfully.
However,
trying to set a breakpoint on map! hangs the system, so I can't follow into
that word.
I added the boolean at the end to satisfy the requirement that each
component
must output a single value. I can't see how that alone would produce the
stack
underflow.
Since the vocabulary description for run-pipeline reads:
"Pipeline components must be one of the following:
• A quotation. The quotation is called with both input-stream and
output-stream rebound, except for the first and last pipeline components,
and it must output a single value.
• A process launch descriptor. See Launch descriptors." ,
I suspect my problem is in the binding of the input/output streams. I'll
experiment
with that, but do let me know if I'm missing something simple. I just want
to find
out how to properly use run-pipeline with ordinary callables, especially
quotations
composed of words with stack effect ( -- ).
Thanks for the replies.
~cw
On Mon, Apr 22, 2013 at 6:20 AM, John Benediktsson <mrj...@gmail.com> wrote:
> The example is simple and works fine:
>
> { "cat log.txt" "grep error" "sort" "uniq" } run-pipeline
>
> Can you explain the more complicated thing you're trying to do?
>
>
> On Mon, Apr 22, 2013 at 4:30 AM, CW Alston <cwalsto...@gmail.com> wrote:
>
>> Factor folks -
>>
>>
>> I'm missing something trying to properly set up the components
>>
>> of a sequence to be passed to run-pipeline. I intend the components
>>
>> to be:
>>
>> (1) a process launch descriptor, with stack effect ( -- desc ) ;
>>
>> (2) a quotation composed only of run-detached, stack effect ( desc --
>> process ) ;
>>
>> (3) a quotation to store the proc in a variable, stack effect ( process
>> -- );
>>
>> -these followed by quotations of words with stack effect ( -- ),
>>
>> all duly wrapped in a sequence { … }.
>>
>>
>> The word description for run-pipeline says that run-pipeline:
>>
>> "Creates a pipe between each pipeline component, with the output of each
>> component becoming the input of the next.
>>
>>
>> The first component reads input from input-stream and the last component
>> writes output to output-stream.
>>
>>
>> Each component runs in its own thread, and the word returns when all
>> components finish executing. Each component outputs a result value."
>>
>>
>> My sundry attempts to meet these requirements typically result in a
>>
>> data stack underflow on execution, or an aberrant stack effect during
>> compile.
>>
>>
>> Can anyone sketch a proper set-up for generic requirements like mine,
>>
>> to successfully pass a component sequence to run-pipeline?
>>
>>
>> Thanks for any suggestions,
>>
>> ~cw
>>
>>
>> --
>> *~ Memento Amori*
>>
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>
--
*~ Memento Amori*
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk