Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. : spc 32 ;
  2.  
  3. : half ( n -- n/2 ) 2 / ;
  4.  
  5. : rep ( c n -- ) 0 do dup emit loop drop ;
  6.  
  7. : top ( width -- ) cr dup 3 rot 2 mod - + half spc swap rep '* emit ;
  8.  
  9. : line ( width index -- )
  10. cr dup rot 2 + 2 / swap - spc swap rep
  11. dup 2 * 1+ 0
  12. do
  13. dup 3 / i + 4 mod 2 - 0= if '0 emit else '^ emit then
  14. loop drop ;
  15.  
  16. : ctree ( width -- )
  17. page
  18. dup top
  19. dup 2 + 2 / 0 do dup i line loop drop
  20. cr ;
  21.  
  22. 21 ctree bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement