Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - gcanyon

#1
newLISP in the real world /
December 05, 2006, 01:00:11 AM
Quote from: "HPW"By the way: Whats the size of a minimal runrev-app for windows standalone? Is it small like newLISP? ;-)


Not so small. I don't know what the actual memory use is, but on disk the minimum is about 3MB I believe.



Revolution doesn't compile conditionally. There's one engine file, and everything is in it.  So everything gets built into a standalone.



That said, you can easily build a standalone that will load and execute raw Revolution stack files. Under those circumstances you can have the user install the engine once, and just load stack files for each "app" you want to run. Stack files start at about 8KB I think -- very small.
#2
I've been away for over a month. I hadn't thought about newLISP much during that time. I happened to think of newLISP tonight, though, so I came here to the forum.



I re-read the suggestions here.



I opened TextWrangler. (Not TextMate)



I pasted in the runTK code.



I pasted in the swarm code.



I zapped gremlins. (is there a similar command in TextMate?)



I ran the code, and it worked. Just like that.



Guess it's time to start trying to build interfaces...
#3
newLISP in the real world /
October 26, 2006, 02:23:48 PM
Quote from: "cormullion"Revolution is certainly cool - I tried it for a while, and I'd certainly consider choosing it if I ever had to develop a cross-platform application with a user interface. (And if someone else paid for licenses :-))



newLISP is a very different animal, complementary more than similar in any way. I find it ideal for customizing applications and systems where you don't need much of an interface. Eg for system agents - http://newlisper.blogspot.com/2006/10/agents-and-daemons.html">//http://newlisper.blogspot.com/2006/10/agents-and-daemons.html. You wouldn't really want to do this with Revolution, I expect, unless it uses hardly any resources.



How about combining the two? A newLISP plugin for Revolution... There's a project for you........


I was actually discussing that just last night with a friend. Revolution can receive commands, so it would be possible to use it in much the same way runtk lets you use tk.



The licensing might be a headache -- I'd have to check with the owners of Revolution. Revolution's UI toolkit doen't include some things I'm looking for -- a table object, for starters. I think it would be difficult to make the integration work well. I'm not sure about that last, though. If TK works, Rev should as well.
#4
newLISP in the real world /
October 26, 2006, 10:35:24 AM
Quote from: "lisp"Any updates to either newlisp or text wrangler?


Nope.


Quote from: "cormullion"
Does a simple hello world program no longer work at all? Does it work with any other language (eg Perl, Ruby)? I'm happy to help, but there's not much information...


I'll try this when I get home today. Maybe I'm just committing some stupid mistake in my code, and Text Wrangler isn't alerting me to it. I had been using newLISP-tk, so running out of Text Wrangler is new, and as you pointed out, there are complications. This is probably just one of them.



As you suggest, I'll try a simple println to see if that works.


Quote from: "cormullion"I thought (Lutz) was just trying to help you by reminding you that running from a text editor has a few special 'issues' that you need to be aware of...


Fair enough -- I'm not upset or anything. Trying out newLISP is quite a shock coming from Revolution -- http://www.runrev.com">http://www.runrev.com.



With Revolution everything is taken care of for you. A complete beginner can follow any of a number of tutorials on the web and create a simple standalone application for three platforms in about ten minutes.



I'd say the difference is roughly the same as buying a car from a dealer and driving it off the lot, and buying a bunch of parts and trying to build the car from scratch ;-)



The end result, however, is a car that goes 100 miles per hour on a D-Cell battery, and converts to an airplane or a boat when needed. So it should be worth it to build the car.
#5
newLISP in the real world /
October 26, 2006, 06:56:55 AM
If you've read the previous messages in this thread, you know Lutz admonished me for not using newLISP through Terminal. I've been doing it using Text Wrangler, which has a Run command that works nicely and puts the results into a separate window.



In response, I told Lutz that i preferred working out of Text Wrangler.



Well, apparently Lutz is a very powerful ninja, because when I got home last night I found that using newLISP from Text Wrangler no longer worked. I've restarted, and it doesn't help.



I just tried it through Terminal, and _that_ works just fine.



For those keeping score, it's now Lutz: 1, Geoff: 0. ;-)



(any ideas what might have broken newLISP in Text Wrangler?)
#6
newLISP in the real world /
October 25, 2006, 09:27:33 AM
Quote from: "Lutz"


Some comments:

Any advanced use of newLISP (or any other scripting language) demands learning the basic UNIX commands in the Terminal application. Excutiing a file out of a text editor is practical during progragram development, but not much else (advanced Emacs and Vi users would object ;) )



Try also runinng newLISP from the Terminal application, by just doing:
newlisp
Its fun to explore newLISP doing this in an interactive manner. Multi-line defintions can be entered bracing them in [cmd],[/cmd] tags, each tag on its own line. This way it is easy to copy/paste code from the manual or website.



The file names for saving do not matter as long as you use then those names subsequently.



Lutz


I followed the steps you gave and got the same error I got when I incorporated the  swarm code into the runtk file:



invalid function : (map?set? '(myin?tcout) ? (pipe))





Responding to your comments -- I know the basics of using the terminal application -- I could have told you how to make a file executable, for example. But my knowledge stops there -- I never would have guessed that runtk needed to be executable any more than swarmp.lsp does.



Forgive me for being a bit defensive, but I don't understand why following the directions given in the runtk file for embedding code in the file makes me somehow less "cool" than running through terminal. Since I got the same error both ways, I think my way wasn't inferior.



Further, since what I'm interested in is "program development" (as you said above) working in a text editor should be fine for me. I don't intend to use newLISP as a command in terminal -- as you might guess, I don't use terminal on a regular basis. ;-)
#7
newLISP in the real world /
October 25, 2006, 08:19:46 AM
Quote from: "Lutz"Have you tried to run the programs without combining, as described here?

http://newlisp.org/index.cgi?Tips_and_Tricks">http://newlisp.org/index.cgi?Tips_and_Tricks



Lutz


Yes, with no luck. I have no idea:



-- What file name to save the runtk code as.

-- Where to save that file.

-- What to do then.



I tried:



-- Saving it as runtk (with no file extension)

-- Saving it in /usr/bin (beside newlisp)

-- putting the following code into TextWrangler and running it:


#!/usr/bin/newlisp

./runtk ~/Desktop/newLISP/newswarm.lsp


I also tried just runtk and /usr/bin/runtk



Thanks for your help,



Geoff
#8
newLISP in the real world / Can't get runtk to work?
October 24, 2006, 07:00:35 AM
I'm trying to use runtk to call tk, and getting an error. Here's the error:



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.


#!/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.
#9
newLISP in the real world /
October 11, 2006, 05:07:02 PM
Quote from: "Lutz"yes, that is exactly it, you should construct the list before the loop begins: (snip)


Or just this?


(map println '(1 2 3 4))
#10
I'm using TextMate 1.5.3 and trying to install the newLISP syntax bundle. Whnever I drag the bundle onto TextMate I get a dialog that says, "Bundle is Corrupt." Specifically the info.plist file is corrupt, it says, or missing.



Any ideas what I might be doing/not doing?



thanks,



gc
#11
I looked in the documentation and didn't see anything related to playing sounds, either resources or external files. Is there a way to do this?



thanks,



Geoff
#12
newLISP newS / Really nice!
September 27, 2006, 02:41:32 PM
Out of curiosity (since I barely understand newLISP, let alone macros) I tried extending the example with a synonym:



(set 'From 0 'To 1 'Subject 2 'Body 3 'Through 4 'Using 4)



After that modification, I could make it work with either Through or Using for the server name. So it would be possible to anticipate a wide variety of user choices.
#13
Anything else we might add? / Tk libraries?
September 25, 2006, 10:07:19 PM
Has anyone put together libraries for tying in to Tk to create a user interface? I'm thinking of something that shields a poor simpleton like me from having to learn any Tcl along with trying to shove newLISP into my brain. I'm thinking of something that would take



(tk-newwidget windowid widgettype widgetname)



and evaluate to whatever tk code is needed to accomplish the task. Sorry I don't understand tk well enough yet to give a reasonable example, but here's a bad example.



(tk-newwindow "prefs") #creates a new window named entry with appropriate defaults

(tk-newwidget "prefs" "entry" "username") #creates a new entry field



I don't know how well this would work, or how to do it. After all, if I did, I wouldn't need it! ;-)
#14
Anything else we might add? /
September 25, 2006, 08:43:27 PM
After doing some research, a signiifcant portion of the difference came down to the arrays I used. Revolution uses associative arrays only. Even if you use x[1], x[2], x[3] etc., Revolution is still using associative arrays. Thus something simple like



                (set 'x (prisonerArray x)))



can be up to 9 times faster in newLISP. Interestingly, if prisonerArray is storing a single  character rather than a number, newLISP's performance is cut by a factor of 4 -- still faster than Revolution, but much slower than it is with an integer.



The interesting part to me was how similar newLISP and Revolution were at many tasks -- within 10% of each other for many commands. I'm no statistician but that seemed like a strange coincidence.
#15
Anything else we might add? /
September 24, 2006, 12:46:02 PM
Quote from: "Lutz"
QuoteWouldn't this make more sense in defining a sum-of-squares routine?


Yes, absolutely, the example has been kept simple for didactic purposes.



Lutz


Thanks, just making sure I wasn't missing something.



gc