|
|
Subscribe / Log in / New account

Micro Python on the pyboard

Micro Python on the pyboard

Posted Jun 24, 2015 15:50 UTC (Wed) by cry_regarder (subscriber, #50545)
In reply to: Micro Python on the pyboard by robbe
Parent article: Micro Python on the pyboard

Darn...I didn't read it as IF ... THEN since they are compile-only words! That is pedantic though. There was nothing wrong with alonz's answer. But just 'cause, here we go: :-p

: forth s" forth" ;
: you   s" cry" ;
: read  s" reads" ;
: kudos s" kudos" ;
: robbe s" robbe" ;

: cats
  2rot
  pad place
  s"  " pad +place
  pad +place
  s"  " pad +place
  pad +place
  pad count
  ;

: can? 
  2rot 2swap cats
  s" cry reads forth"
  COMPARE
  IF false
  ELSE true
  THEN
  ;

: get ( s1 s2 : "s1 gets s2" )
  s" gets"
  cats
  ;

: if?
  2 pick
  IF type ELSE ." Nope! No kudos!" THEN
  ;

CR
forth you read can? you kudos get if?
CR
forth robbe read can? robbe kudos get if?
CR
OMFG that is some bad code...it has been too long.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds