Source language: Translate to:

hpwNewLISP - interface plugin to newLISP

Questions about NeoBook PlugIns

Moderator: Neosoft Support

hpwNewLISP - interface plugin to newLISP

Postby Guest » Wed Dec 03, 2003 2:55 pm

Just released initial hpwNewLISP 1.0:

http://www.hpwsoft.de/anmeldung/html1/n ... ook14.html

A plugin for the great open-source Lisp-system.

For more info visit:

http://www.newlisp.org/

Actions: hpwNewLispCall - Send a Lisp-String to the newlisp.dll and get the return.


(Edited by HPW at 7:55 pm on Sep. 30, 2004)
Last edited by Guest on Mon Feb 28, 2005 4:59 am, edited 1 time in total.
Guest
 

hpwNewLISP

Postby Sam Cox » Wed Dec 03, 2003 3:08 pm

Hans-Peter,

Being a LISP programmer myself (at least a LISP hobbyist), I am thrilled by your new invention!  Thank you, thank you, thank you.
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

hpwNewLISP

Postby HPW » Wed Dec 03, 2003 11:26 pm

Sam,

The thanks have to go to Lutz Mueller (autor of newLISP) who has made such a great modern version of the good old Lisp. In best tradition to Xlisp, it is a modern, flexibel and powerfull language.

I have reload/upload the plugin with a new demo-pub with the lisp-samples  in a extern file (sample.lsp).
HPW
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 12:25 am

For interested newLisp user:

The current stable release of newlisp (7.3.1) does not contain the DLL-feature. It will be part of the upcoming 7.4. When you want to take a look, watch out for 7.3.14 in the development directory.
HPW
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 12:41 am

Just noticed a little glitsch with the external lisp-file.
In the replace sample-line is a regular expression "[x|y]" where neobook substitute the pipe on fileread to CR.

Change sample lisp to:
(replace "[x[#124]y]" str "PP" 0)          ;special use bracket with [#124] in neobook

And page action to:
FileRead "[PubDir]sample.lsp" "ALL" "[ListboxContent]"
StrReplace "[ListboxContent]" "[#91]#124[#93]" "|" "[ListboxContent]"

A cleaner thing would be to implement a optional fileread without pipe-hassle.


(Edited by HPW at 9:17 am on Dec. 4, 2003)
HPW
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 1:28 am

Forgot about hpwUtility:

hpwFileRead "[PUBDIR]sample.lsp" "All" "[ListboxContent]"

Then the line could stay in native syntax:
(replace "[x|y]" str "PP" 0)          ;no special use bracket



(Edited by HPW at 9:29 am on Dec. 4, 2003)
HPW
 

hpwNewLISP

Postby datadon » Thu Dec 04, 2003 4:19 am

HPW,
I took a look at the NewLisp site and there is a lot of good information there.  Perhaps you or Sam could give me or others a short idea of what types of programs you would use LISP with.  I am a little familiar with AutoLISP, which was the Autocad addon language for many years, may still be.   In what ways would it allow us to do things we cannot do in Neobook now?   It see it has additional scripts etc.  Is it geared toward certain types of programs etc.  I am trying to determine if I want to invest the time to learn further.

and thanks for another plugin,


Don
datadon
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 6:40 am

Don,

when you are familar with Autolisp, you will feel comfortable with newlisp. Coming from similar roots alisp and newlisp share some things. And over time I have asked Lutz for improvments towards alisp compatibilty. For example I asked for the command 'setq' which is only there for alisp people like me. Makros for 'foreach' and 'repeat' exists. Many other things are possible with the powerfull makro-feature.

>In what ways would it allow us to do things we cannot do in Neobook now?

I does not see it in competition to neobook, I see both as excellent products, which could benefit from each other. With the plugin you can make user-interfaces with neobook (or make them with TclTk) and use newlisp as the core-logic.

Maybe over time we will see more dynamic features in neobook, so we can even more benefit from this.

So back to your question: I would not compare neoscript with newLisp since newLisp is a lot more powerfull. But I do not want to start another language war. That can do the people on comp.lang.lisp, who praise their languages like sheme,python or common-lisp.

newLisp is like neobook: small, slick and cool!

Just my 2 cents ;-)
HPW
 

hpwNewLISP

Postby datadon » Thu Dec 04, 2003 8:31 am

HPW,

Thanks for your reply.  

Actually, I was not trying to compare to Neobook, but rather determine where the plugin could be used inside Neobook.  

For example, using the plugin would be useful if you wanted to create what type of program etc.

Or the plugin would add features that would be best suited for .......(math, drawing, database????)

And since you mentioned..."more powerful",  I am wondering in what ways?  Provide more scripts? or
options or ?    

And I guess another related question would be can NewLisp be used to create programs that would work inside autocad.   Or anyother programs??  

I'll browse the NewLisp forum and site and see what else I can learn.

Any books to check into?

Thanks a bunch.

Don
datadon
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 11:27 am

Don,

>Or the plugin would add features that would be best suited for .......(math, drawing, database????)

Hard to say. Math and string processing. Building parser. One feature is surely the complete PCRE (Perl regular expression)-engine.

>And since you mentioned..."more powerful",  I am wondering in what ways?

The language conzept is more powerfull. Lispers are talking about functional programming or bottom up programming. Every Lisp-programmer mostly build his own language on top of Lisp.

>And I guess another related question would be can NewLisp be used to create programs that would work inside autocad.

Because you have Autolisp/Visual Lisp in Autocad you do not need another one. Autodesk seems to go with MS and is forcing VB instead. Also rumors are heared that .NET will take place in Autocad. So porting existing code from inside alisp to standalone could make sense for using newlisp.

>Or anyother programs??

Any programm which can call DLL-functions (stdcall).
And of cource where Lisp fits in.

>Any books to check into?

I am only a Lisp-programmer and not a Lisp-advocat.
But you can take a look to lisp-gurus like Paul Graham.
His Book "ANSI Common Lisp" is one of my favorite.
He offers interesting readings on his site.

http://www.paulgraham.com/

Also take note that this is not my first attempt to use lisp in neobook. HpwDllCall was build to use corman-lisp DLL's in neobook. It's a ANSI common lisp compiler with also nice features. But it is also an other thing in size and complexity. Those who want to use CLOS (object oriented programming) can go this way.

So we have a lot of choices. May be a matter of personal taste.

What's most important: To get the job done. ;-)


(Edited by HPW at 7:29 pm on Dec. 4, 2003)
HPW
 

hpwNewLISP

Postby datadon » Thu Dec 04, 2003 12:56 pm

Hans-Peter,

(HPW is too rigid for a nice fellow like you)

Very interesting....
I went and had a look at the Paul Graham
site and now have my interest has peaked.

In particular, if anyone is interested, they might want to go to the book site:

http://www.paulgraham.com/acl.html

and take a look at the chapter 1 preview near the bottom of the page.

Seems very interesting.  He makes some interesting quotes that could apply nicely to Neobook as well.  Thanks for taking the time to light the path.   I shall look into it even more.

Don
datadon
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 1:18 pm

Just upload a new plugin zip with a new newlisp.dll 7.315 (bug-fix) and a demo-pub which uses hpwUtility for file-reading, because of the pipe-problem.
HPW
 

hpwNewLISP

Postby HPW » Thu Dec 04, 2003 2:13 pm

Just upload a new plugin zip with a recompiled newlisp.dll 7.315 (error messages were disabled) and a demo-pub without a key-binding with '1' for the lisp-call button.
HPW
 

hpwNewLISP

Postby Sam Cox » Sat Dec 06, 2003 10:36 am

Hi Hans-Peter

Perhaps you can provide some insight into a little problem I'm having with newLisp.  According to the manual (p.116), the parse function can handle strings longer than 2048 characters if the "str-break" parameter is supplied.  But when I run the following code I get a "token string too long" error from newLisp.  I wonder if I am misunderstanding the documentation for the parse function.

.. Purpose: create [OutFile] consisting of just one copy of each unique line in [InFile]

.. [InFile] consists of one string value per line
SetVar "[InFile]" "[PubDir]Data1.txt"

.. [OutFile] is written to have only one copy of each unique input value
SetVar "[OutFile]" "[PubDir]Data2.txt"

SetVar "[NL]" "[#13][#10]"
SetVar "[Divider]" "%%%"

.. read values from [InFile] and replace [NL] with [Divider]
.. the result is one long string in [Content]
FileRead "[InFile]" "ALL" "[Content]"
StrReplace "[Content]" "[NL]" "[Divider]" "[Content]"

.. [LispCode] contains the LISP program
.. a) parse [Content] into a list of substrings delimited by [Divider]
.. b) unique returns just one copy of each substring
.. c) join puts the substrings back together separated by [Divider]

SetVar "[LispCode]" "(join (unique (parse {[Content]} {[Divider]})) {[Divider]})"
hpwNewLispCall "[PubDir]" "[LispCode]" "[LispResult]"

.. remove the leading and trailing quotes added by LISP
StrLen "[LispResult]" "[Len]"
SubStr "[LispResult]" "2" "[Len]-2" "[LispResultMinusQuotes]"

.. replace [Divider] with [NL] and write the output file
StrReplace "[LispResultMinusQuotes]" "[Divider]" "[NL]" "[Result]"
FileWrite "[OutFile]" "ALL" "[Result]"

(Edited by Sam Cox at 5:52 am on Dec. 6, 2003)
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

hpwNewLISP

Postby Sam Cox » Sat Dec 06, 2003 11:24 am

Hi Hans-Peter,

After I posted the above, I found the newLisp Forum and posted my question there.  Hopefully, Lutz or someone on that forum will be able to answer my question.  I know that I should not be referring my LISP questions to you.  I'm glad that there's a forum for newLisp.

Thank you again for developing the NeoBook interface to newLisp.
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Next

Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest