Yes, it's possible but you'd need to change a few things first.
First of all, the correct call for the Explorer is just Explorer.one.
But really, that's not what you want (or rather, it's not what you
need). If you want to see it graphical, the Explorer will work fine,
but it won't return the answer. One thing that you may not have
realized is that you have two different variables named Root and the
one that is external to the script will not contain the final answer,
instead you need to retrieve that answer using something like this:
[Root] = {Search.base.one Robert}
The brackets are because Search.base.one returns a list of one
element. Finally, the record in Root will not work as a virtual
string so you cannot write it to a file directly as is. There are
still two solutions, first use System.show and then compile your
functor as an executable and pipe the output to a file. Second, take
Root and use it to create a virtual string that can be output to a
file. Someone may correct me but I don't believe there is a way to
output a record to a file formatted as it would be using System.show
unless you do it yourself.
Something as simple as this would work:
{H write(vs:{List.toTuple '#' {Record.toListInd Root}})}
but it will look almost unreadable :).
On 7/25/06, Mary Aranda Cabezas <[EMAIL PROTECTED]> wrote:
Hello
I have been trying to work with the functor, and I have taken an example
that appears in the aid on line and I want to write the solution in a text
file but this me has not been possible. It's not possible to be done or I'm
making something bad?
The code that I'm using is the following:
functor
import
Open
Explorer
FD
define
ArchivoSalida = 'Salida.txt'
Root
proc {EscribeArchivo Arc}
H={New Open.file init(name:Arc flags:[write text create truncate])}
in
{H write(vs:Root)}
{H close}
end
proc {Robert Root}
D O N A L G E R B T
in
Root = sol(d:D o:O n:N a:A l:L g:G e:E r:R b:B t:T)
Root:::0#9
{FD.distinct Root}
D \=: 0
G \=: 0
100000*D + 10000*O + 1000*N + 100*A + 10*L + D
+ 100000*G + 10000*E + 1000*R + 100*A + 10*L + D
=: 100000*R + 10000*O + 1000*B + 100*E + 10*R + T
{FD.distribute naive Root}
end
{Explorer.one.depth Robert}
{EscribeArchivo ArchivoSalida}
end
Somebody can help me, please!
Thanks!!
________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users