Page 1 of 1

net-eval

Posted: Thu Dec 08, 2005 10:45 pm
by newdep
Hi Lutz,

The Str-Expr in net-eval is very strict it seems. Im unable to replace the
str-expr position with any variable else then something between {} or "".

but this does not work and is quite pitty..->

> (setq X {(+ 3 4)})
"(+ 3 4)"
> (net-eval '( ("host" 4444 X )) 5000)

string expected in function net-eval : X


Secondly: (This is a big wish!) Does 'net-eval return ALL the eval-return-data in 1 LIST! or only last result? Because thats a BIG
advantage above 'eval-string if net-eval could..! ;-)





Regards, Norman.

Posted: Thu Dec 08, 2005 11:19 pm
by Lutz
Prepare the list(s) for net-eval before unsing functions like 'list' or 'expand':

Code: Select all

> (set 'X {(+ 3 4)})
"(+ 3 4)"
> (set 'L (expand '(("host" 444 X)) 'X))
(("host" 444 "(+ 3 4)"))

;; or

> (set 'L (list (list "host" 444 X)))
(("host" 444 "(+ 3 4)"))
> 
Typically you have a list of tasks to distribute to a list of nodes and then use something like 'map' and 'list' to construct the 'net-eval' list for multiple worker nodes.

If you want to return two results put them in a list:

Code: Select all

> (net-eval '(("localhost" 4711 {(list (+ 3 4) (+ 5 6))})) 1000)
((7 11))
> 
Lutz

Posted: Thu Dec 08, 2005 11:21 pm
by newdep
Thanks! im already on it ;-)

Posted: Mon Jun 12, 2006 9:28 am
by cormullion
I still don't understand why this happens, though:

Code: Select all

(net-eval '(("10.0.1.3" 4711 "(+ 2 2)")) 1000 )
works fine, but

Code: Select all

(set 's "(+ 2 2)")
(net-eval '(("10.0.1.3" 4711 s)) 1000 )
doesn't. I saw your preparation , Lutz, but why does the language appear not to work correctly or predictably in this instance?

Posted: Mon Jun 12, 2006 2:46 pm
by Lutz
Currently all parts of the parameter list (<host> <port> <string>) in 'net-eval' must be given as constants. This may or may not change in the future. I will clarify this in the documentation.

Lutz

Posted: Mon Jun 12, 2006 2:54 pm
by Lutz
.... what can help in this instance is 'letex' or 'expand' as shown in this example:

Code: Select all

(letex ((host "localhost") (port 4711) (str "(+ 3 4)"))
    (net-eval '((host port str)) 1000))
The letex could be embedded ina function supplying "localhost" etc. in variables.

Lutz

ps: 8.8.9 required

Posted: Mon Jun 12, 2006 3:39 pm
by cormullion

Code: Select all

(define (my-net-eval machine port strn timeout)
	(letex ((_host machine) (_port port) (_str strn))
   (net-eval '((_host _port _str)) timeout)))
seems to work OK when called like this:

Code: Select all

(set 's "(+ 23 23)")
(my-net-eval "10.0.1.3" 4711 s 1000 )
Thanks. A note in the manual would probably be a good idea - I thought I had lost it (the plot, not the manual) earlier... :-)