Post Reply 
NOT AND INSTRUCTION ?
08-05-2019, 09:11 AM
Post: #1
NOT AND INSTRUCTION ?
Hi all,

I wonder if NOT AND boolean instruction exist in the HP Prime. I think no, but how can we emule this instruction ?
I try since a moment but without success.

Maybe one can help me ?

Goog day.

Gérard.
Find all posts by this user
Quote this message in a reply
08-05-2019, 12:36 PM (This post was last modified: 08-05-2019 01:24 PM by chromos.)
Post: #2
RE: NOT AND INSTRUCTION ?
I think Gérard meant 'NAND' command.

If logical values are stored in list L1 then something like this could work:

   

Edit: strikethrough text was reaction to previous advice of another user and that post is now deleted.

Prime, 15C CE
Find all posts by this user
Quote this message in a reply
08-05-2019, 01:55 PM (This post was last modified: 08-05-2019 02:09 PM by StephenG1CMZ.)
Post: #3
RE: NOT AND INSTRUCTION ?
Thanks for that suggestion Chromos.
If it is NAND that is wanted I would suggest:
Code:

EXPORT NAND(LST)
BEGIN
 IF SIZE(LST)==1 THEN
  RETURN (LST(1)==0);
 END;
 RETURN NOT (ΠLIST(LST));
END;

That has the advantage of also working with a single input, which the built-in list function does not handle.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
08-05-2019, 02:22 PM
Post: #4
RE: NOT AND INSTRUCTION ?
Yes it is NAND I was speaking.
Thank you for reply.

Gérard.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)