A quick conversation with ChatGPT
|
01-31-2023, 09:04 PM
Post: #10
|
|||
|
|||
RE: A quick conversation with ChatGPT
On the subject of RPN/Forth, here is an interesting conversation (not mine):
ChatGPT and Forth Question write a prime test program. The program should take a number from the stack and return 1 on the stack if it is prime and 0 if it is not. The program should be written in Forth. ChatGPT Here is a simple prime test program in Forth: sql: prime? ( n -- f ) 2 dup >r begin dup * dup >r dup 2 < over 0= until r> drop r> swap 2 < if drop 0 exit then 1 ; Explanation:
The full conversation is on reddit: https://www.reddit.com/r/Forth/comments/...and_forth/ Not much of a threat to Forth programmers - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)