net-eval

Started by newdep, December 08, 2005, 02:45:19 PM

Previous topic - Next topic

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.
-- (define? (Cornflakes))

Lutz

#1
Prepare the list(s) for net-eval before unsing functions like 'list' or 'expand':

> (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:

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

Lutz

newdep

#2
Thanks! im already on it ;-)
-- (define? (Cornflakes))

cormullion

#3
I still don't understand why this happens, though:


(net-eval '(("10.0.1.3" 4711 "(+ 2 2)")) 1000 )

works fine, but



(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?

Lutz

#4
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

Lutz

#5
.... what can help in this instance is 'letex' or 'expand' as shown in this example:



(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

cormullion

#6
(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:


(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... :-)