Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
506B

  1. : _pd ( a -- n f, parse decimal )
  2. C@+ OVER C@ 0 ( a len firstchar startat )
  3. ( if we have '-', we only advance. more processing later. )
  4. SWAP '-' = IF 1+ THEN ( a len startat )
  5. ( if we can do the whole string, success. if _pdacc returns
  6. false before, failure. )
  7. 0 ROT ROT ( len ) ( startat ) DO ( a r )
  8. OVER I + C@ ( a r c ) _pdacc ( a r f )
  9. NOT IF DROP 1- 0 UNLOOP EXIT THEN LOOP ( a r )
  10. ( if we had '-', we need to invert result. )
  11. SWAP C@ '-' = IF 0 -^ THEN 1 ( r 1 ) ;