Re: Transmit free variables via socket

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Tue, 04 Mar 2008 17:13:43 +0100

Hello Steffen!

> Hello again,
>
> I have successfully set up socket communication
> between a curry program (using MCC) and a
> java program. However, in the result computed
> by the curry server may be free variables. In this
> case I get a deadlock error in MCC. It would be
> possible in my scenario to supply a number to
> uniquely numerate the free variables starting
> from this particular number. How can this be
> realized?
>
> For instance, I might get the following result
> from my curry program:
>
> [(1,_a),(_a,2),(_b,_c)]
>
> This is a graph (as an edge list) where some
> nodes are not instantiated. Given a number
> n=5 as the next free node number I would
> like to submit something like the following
> as a result:
>
> [(1,5),(5,2),(6,7)]
>
> At the moment, I only submit the head of
> the findall result list. Is it possible to filter
> the results of findall such that only
> completely instantiated terms remain?


As Michael already already answered, you could use Unsafe.isVar
for that purpose.

MCC's Unsafe module currently lacks showAnyQTerm and friends, but
you can define showAnyQTerm yourself as follows:

   showAnyQTerm:: a -> String
   showAnyQTerm x = (dvals $!! x) ""
     where foreign import primitive dvals :: a -> ShowS

This definition makes use of one of MCC's internal primitives. Don't
worry that this primitive is undocumented. It is used by MCC's
declarative
debugger and therefore supposed to stay.

Regards
Wolfgang

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mi Mär 05 2008 - 08:47:19 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:09 CEST