multi-line command prompt -- huh?

Started by scratchy, August 14, 2004, 03:50:58 PM

Previous topic - Next topic

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

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

scratchy

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

HPW

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

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

> [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

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

#6
Quote
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

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