fork download
  1. USING: combinators io io.binary io.encodings.binary
  2. io.streams.byte-array kernel math namespaces
  3. sequences strings math.parser ;
  4.  
  5. IN: factorial-example
  6.  
  7. : modulo ( n -- n! )
  8. dup
  9. 2
  10. /
  11. 2
  12. *
  13. =
  14. [ 1 ]
  15. [ 0 ]
  16. if ;
  17.  
  18. : bin ( n -- )
  19. dup
  20. 0 =
  21. [ drop ]
  22. [ dup
  23. modulo
  24. swap
  25. -1
  26. shift
  27. bin
  28. number>string print
  29. ]
  30. if ;
  31.  
  32.  
  33. ! readln string>number
  34. ! bin
  35. 1
  36. 2
  37. mod
  38.  
Runtime error #stdin #stdout 0.2s 163968KB
stdin
4
stdout
Quotation's stack effect does not match call site
quot      [ 1 2 mod ]
call-site (( -- ))