09:40:05
##forth
<veltas>
: SCAN ( addr u c - n|-1) SWAP 0 ?DO OVER I + C@ OVER = IF 2DROP I UNLOOP EXIT THEN LOOP 2DROP -1 ;
09:40:46
##forth
<veltas>
I was convinced there wasn't a 'nice' way to write this, but after sweating it out I've got something that's almost readable
09:41:44
##forth
<olle>
Is Forth declarative or imperative or something else?
09:46:57
##forth
<veltas>
It's definitely not declarative although you can use it that way
09:47:22
##forth
<veltas>
My above code is very imperative
09:50:07
##forth
<olle>
:P
09:51:06
##forth
<veltas>
Forth is definitely its own thing, I'd say a language was Forth-like if it was in same class
09:51:43
##forth
<veltas>
Concatenative maybe
09:58:07
##forth
<olle>
Forth-like = implicit stack
09:58:09
##forth
<olle>
!=
09:58:10
##forth
<olle>
~=
10:53:02
##forth
<veltas>
Just asked copilot for this and didn't get anything useful
10:53:37
##forth
<veltas>
Anyone get a good result asking for e.g. an ANS Forth word that takes a string and character, and returns index of first position of character or -1 if not found
10:53:49
##forth
<veltas>
On claude or something maybe
10:55:45
##forth
<veltas>
It's really patterns and not smarts because it produced code that just wasn't even slightly close to correct
10:56:01
##forth
<veltas>
I've given it the right answer so maybe it will remember that(?)
10:58:50
##forth
<olle>
LLM is bad with implicit stack
11:09:39
##forth
<veltas>
I think the issue more might be it's bad with everything, but implicit stack stuff has a lot less training data so it seems worse
11:14:31
##forth
<olle>
"bad" is relative, I guess
11:14:40
##forth
<olle>
But yea, training data for sure.
14:03:28
##forth
<veltas>
Oh whoops : S>D ( n - N ) DUP 0< IF -1 ELSE 0 THEN ;
14:03:40
##forth
<veltas>
Could have just been : S>D DUP 0< ;