Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Logo > Re: need help w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 9 Topic 1544 of 1596
Post > Topic >>

Re: need help with numberp and memberp

by bh@[EMAIL PROTECTED] (Brian Harvey) Feb 1, 2008 at 07:05 AM

davidciccarello@[EMAIL PROTECTED]
 writes:
>numberp :v iffalse [messagebox [error] [you need to use number(s) are
>your first digits]]

Logo procedures are divided into COMMANDS (which /do/ something) and
OPERATIONS (which compute a value for use by other procedures).  A Logo
instruction has to start with a command.  So this line, which starts with
the operation NUMBERP, is already wrong before looking at anything else.

As other people have said, either you want
	TEST NUMBERP :V
	IFFALSE [...]
or you want the more compact
	IF NOT NUMBERP :V [,,,]
TEST and IF are commands.  IF decides to take or not take an action (in
your
case the MESSAGEBOX instruction) based on a true/false test.  TEST just
remembers the result of a true/false test for use by a later IFTRUE and/or
IFFALSE.

>numberp 1>:v>13 iftrue [messagebox [error] [your first 2 inputs must
>be numbers between 1 and 13]]

As several people have remarked, Logo (like most programming languages,
I think) doesn't do what you mean with ...<...<... (I'm assuming you meant
lessthan, not greaterthan, since 1>13 would always be false!)

Also as has been remarked, the result from < would in any case always be
TRUE or FALSE, neither of which is a number, so the NUMBERP would return
FALSE.  Just leave out the NUMBERP.

"P" at the end of a procedure name means (by convention) "Predicate,"
i.e., an OPERATION that always returns a TRUE or FALSE value.  So it's
asking the question "is such-and-such a number?"  You've already asked
that question in the previous line; you don't have to ask it again.
 




 9 Posts in Topic:
need help with numberp and memberp
davidciccarello@[EMAIL PR  2008-01-31 17:29:27 
Re: need help with numberp and memberp
Andreas Micheler <Andr  2008-02-01 02:46:37 
Re: need help with numberp and memberp
davidciccarello@[EMAIL PR  2008-01-31 17:59:03 
Re: need help with numberp and memberp
winston19842005 <bjjly  2008-01-31 21:04:05 
Re: need help with numberp and memberp
davidciccarello@[EMAIL PR  2008-01-31 18:03:44 
Re: need help with numberp and memberp
davidciccarello@[EMAIL PR  2008-01-31 18:06:39 
Re: need help with numberp and memberp
winston19842005 <bjjly  2008-01-31 21:17:14 
Re: need help with numberp and memberp
davidciccarello@[EMAIL PR  2008-01-31 18:25:22 
Re: need help with numberp and memberp
bh@[EMAIL PROTECTED] (Br  2008-02-01 07:05:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:12:49 CDT 2008.