Newbie problem with newLisp-gs

Started by techdir0, December 17, 2009, 01:36:34 AM

Previous topic - Next topic

techdir0

New to Lisp, and newLisp



Why does (setq res (parse (read-line))) produce expected result in command line version,

but return

( "(" "setq" "res" "(" "parse" "(" "read-line" ")" ")" ")" )



if entered in newLisp-gs?? that is, in the IDE.



I'm using v10.1.7 on WinXP

Lutz

#1
When running newLISP-GS, the newLISP monitor process in the lower part of the IDE is controlled using STD I/O. This is why 'read-line' and other built-in functions processing STD I/O channels should only be used when running newLISP in a terminal shell.



Ps: welcome to newLISP

techdir0

#2
Thanks - I think I understand now what is going on.



Since my interest in newLisp is for natural language interaction, I guess I will work in a terminal until or unless I have a simple graphical interface for the user.

Kazimir Majorinc

#3
You can find some ways around if you want to work from gs. for example



> (begin (setq z (read-line))(println "parse z=" (parse z)))

Hey man, what are you doing there?

parse z=("Hey" "man" "," "what" "are" "you" "doing" "there?")

("Hey" "man" "," "what" "are" "you" "doing" "there?")

>
http://kazimirmajorinc.com/\">WWW site; http://kazimirmajorinc.blogspot.com\">blog.

techdir0

#4
Well, that would be useful, but it doesn't seem to work that way for me.



This is what happens to me
(begin (setq z (read-line))(println "parse z= " (parse z)))
hey this is great
parse z= ("(" "begin" "(" "setq" "z" "(" "read-line" ")" ")" "(" "println" "parse z= " "("
 "parse" "z" ")" ")" ")")
("(" "begin" "(" "setq" "z" "(" "read-line" ")" ")" "(" "println" "parse z= " "("
 "parse" "z" ")" ")" ")")
> nil
nil
nil
nil


Am I missing something obvious here?

cormullion

#5
This works OK for me:


$ newlisp
newLISP v.10.1.8 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.

>  (begin (setq z (read-line))(println "parse z= " (parse z)))
this seems to work ok in the terminal
parse z= ("this" "seems" "to" "work" "ok" "in" "the" "terminal")
("this" "seems" "to" "work" "ok" "in" "the" "terminal")
>


although this is less noisy if you're using the terminal:


> (set 'z (parse (read-line)))
this is a test
("this" "is" "a" "test")
>


I confess I don't use newlisp-gs - i prefer the full-on editing environment of a text editor like BBEdit, using the terminal for interaction. I would - not very convincingly and only if pushed - argue that it's better to meet newLISP first of all in the simplest environment possible (the terminal), then move up to editors and stuff later. Something to do with cognitive loading... :)

Kazimir Majorinc

#6
OK, techdir0, I understand why it didn't worked for you and worked for me.





1. Write (parse (read-line)) and press enter in editor part of IDE.

2. Select (with mouse) and copy (parse (read-line)) together with enter from editor part of IDE.

3. Paste in dialog part of IDE.

4. Write the statement you want parsed and press enter.

5. Goto 3.



---



Lutz will maybe fix it when he came back from travelling. I also use GS IDE only for short programs, and Scite for longer programs. I described how it can be
http://kazimirmajorinc.com/\">WWW site; http://kazimirmajorinc.blogspot.com\">blog.

techdir0

#7
That seems to work - thank you for finding it.



I think I will go along with the majority opinion, and stick to the terminal view.   I expect I shall end up using TextPad as my

editor, since I'm used to it, and I can modify the syntax files to suit newLisp.