Email or username:

Password:

Forgot your password?
Devine Lu Linvega

@d6 I can't come on IRC at the moment, but I have a question, and I think you might be able to help.

It's probably very silly, but I need a second opinion, for a part of a routine that checks if two characters are whitespace ( char1 char2 -- f ):

Instead of:
#21 LTH SWP #21 LTH AND

Would it be safe to just do:
ORA #21 LTH

6 comments
David JONES

@neauoire @d6 on a tangential note, I recommend.you implement WITHIN from Forth 2012. It encodes "is in" and "not in" range checks. I found it invaluable for tokenizing in my Forth.

⛧ esoterik ⛧

@neauoire best i can come up with for this is:

LTHk JMP SWP NIP #21 LTH

Kartik Agaram

@neauoire @d6 Neat idea, but here's a counter-example. If the stack countains a space (#20) and a tab (#09), their ORA would be #29, which would return false instead of true.

Kartik Agaram

@neauoire Too clever by far for my taste 😄

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan

@d6

⛧ esoterik ⛧

@neauoire @akkartik i think comparing the max against #20 would be more straightforward but this works too i guess

Go Up