Closed infradig closed 2 days ago
$ cat samples/test_matrix_fifo_det.pl
:- initialization(main).
% Should print 34637561460.0
main :-
open('/tmp/treafo', read, S),
mat_read(S, _, [alias(foo1)]),
close(S),
mat_lup_det(foo1, Det),
write(Det), nl.
$
$ mkfifo /tmp/treafo
$ cat samples/test_matrix_det.mat > /tmp/treafo && tpl -g halt samples/test_matrix_fifo_det.pl
34637561460.0
$
I don't get this. 'cat' hangs until a reader (tpl) does open and read. The other way around also doesn't work: $ tpl samples/test_matrix_fifo_det.pl % waits for input
In another terminal: $ cat samples/test_matrix_det.mat > /tmp/treafo $ Now tpl prints 1.0
Ok, I must have had data in the fifo from fooling around. I now get 1.0
Now I get 34637561460.0 Cool format string. Great!
$ mkfifo /tmp/treafo
%%% test_matrix_det_fifo.pl example %%% : main :- open('/tmp/treafo', read, S), matread(S, , [alias(foo1)]), : %%%
$ cat test_matrix_det.mat > /tmp/treafo & $ tpl test_matrix_det_fifo.pl 1.0 % Should print 34637561460.0? ?-
Originally posted by @flexoron in https://github.com/trealla-prolog/trealla/issues/558#issuecomment-2198868681