invalid function : (map set '(myin tcout) (pipe))
Thanks for any help -- Geoff
This is the code I tried to run. It's a combination of the runtk file with the swarm example code.
Code: Select all
#!/usr/bin/newlisp
; setup communications to Tcl/Tk
(map set '(myin tcout) (pipe))
(map set '(tcin myout) (pipe))
(process "wish" tcin tcout)
; tk function to pass commands to Tcl/Tk
(define (tk)
(write-line (append "if { [catch { puts ["
(apply string (args)) "] }] } { "
[text] tk_messageBox -message $errorInfo; exit }
[/text]) myout)
(let (str "")
(while (starts-with (setq str (read-line myin)) "newLISP:")
(eval-string ((length "newLISP: ") -1 str)))
str))
(global 'tk)
;; this is for compatibility with newlisp-tk for running
;; the Demo.lsp programs distributed with newlisp-tk
;; for new programs just use 'puts' without the 'Newlisp' wrapper
(tk "proc Newlisp { command } { puts $command }")
;; exit when main window is closed
(tk "bind . <Destroy> {puts {(exit)}}")
;;
;; Swarm simulation
;;
;; Simulation of the swarm of flies. Written as a test of concepts of complex systems.