multi-line command prompt -- huh?

Q&A's, tips, howto's
Locked
scratchy
Posts: 14
Joined: Sat Aug 14, 2004 10:41 pm

multi-line command prompt -- huh?

Post by scratchy »

How come newlisp gives an error when I type or paste a multiline statement into comment prompt? For example:

> (if (env BLAH)

missing parenthesis : "...(if (env BLAH)\n"

Of course, the paren is missing, because I haven't finished typing yet!!! The newlisp's IQ must be nil to give such an error, considering that the parser obviously can count the number of opening and closing parens.

And then you claim "You don't study newLISP, you use it" -- In my view newlisp is unusable, and the documentation is not adequate.

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

I think an editor is a better listener in your case :-)
-- (define? (Cornflakes))

scratchy
Posts: 14
Joined: Sat Aug 14, 2004 10:41 pm

Post by scratchy »

Looks like you have been pissing in your beer... too :-)

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

The advice from newdep was meant seriously.

The main window of the newLISP-TK frontend is a console window and not a true editor. You can click on the browser/editor button (or type CTRL-B) to get a editor window. There you can type and paste multiline sources and evaluate them.

Or use an external editor and load the source into the console window.

So I think this is some misunderstanding and you should give a second try.
newLISP's IQ (IQ for software??) is better as your current opinion and the documentation is solid.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

There is also a way to to multiline commands in a newLISP shell / console (not in the newlisp-tk frontend).

Put [cmd] on the first line then type you multiline stements than put [/cmd] on a finishing line:

Code: Select all

> [cmd]
(define (foo x)
  (+ x x))
[/cmd]

> 
This mode can also be used when communicating with newLISP from an other program. You send [cmd] then the source in one whole swoop then [/cmd]

Lutz

scratchy
Posts: 14
Joined: Sat Aug 14, 2004 10:41 pm

Post by scratchy »

Thanks for the replies. Looks like there are at least two ways to do it, which is technically fine.

However the extra syntax on the command-line ([cmd]..[/cmd]) is something that I haven't seen in other shells, and is totally weird. Most shells maintain the same syntax in the script as in interactive session for obvious reasons.

When I fired up newlisp.exe for the first time, and then copied'n'pasted examples from the Web, all I got was a bunch of errors, and that was a big turn off.

I understand that it takes man-power to fix stuff, I'm just pointing out that command-line not working as expected is a rather large drawback as perceived by newbies. And I hope you are not a bunch of stereotypical anti-newbie LISP zealots.

Thanks a lot.

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

And I hope you are not a bunch of stereotypical anti-newbie LISP zealots.
I think not. Here is not comp.lang.lisp!
;-)

At least we have introduced newLISP to the neobook community, which is a more non-programmer community and where you can find absolut Lisp-newbies.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Hi Scratchy, when you work with multi-line examples, the best is to use the newLISP-tk frontend and past examples into a code browser window (marked as 'def' in the menu.

Another possibility would be to use the (edit ...) macro built into 'init.lsp' (I think your are on Linux?). You could cutomize it to your editor and then just do:

(edit foo)

and your editor windows will pop up and you edit ypur function, then just save the editor and you are back in newLISP. I have used this 'poor man's' IDE for a long time and it works quite well.

Lutz

Locked