fork download
  1. #!/bin/sh
  2. #|
  3. exec csi -s "$0" "$@"
  4. |#
  5.  
  6. (require-extension (only srfi-1 last unfold))
  7. (import (chicken process-context)
  8. (chicken format))
  9.  
  10. (define (Func num max)
  11. (modulo
  12. (last
  13. (unfold (lambda (x) (> (* x (modulo x 10)) max))
  14. (lambda (x) x)
  15. (lambda (x) (+ x 1))
  16. num)) 10))
  17.  
  18. (define (main args)
  19. (handle-exceptions exn
  20. (begin
  21. (display "bad argument count")
  22. (newline))
  23. (format #t "N = ~a~%" (apply Func (map string->number args))))
  24. 0)
  25.  
  26. (cond-expand
  27. (chicken-script
  28. (main (command-line-arguments)))
  29. (else))
  30.  
  31.  
Runtime error #stdin #stdout #stderr 0.02s 7756KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: (import) during expansion of (import ...) - cannot import from undefined module: process-context

	Call history:

	<syntax>	  (require-extension (only srfi-1 last unfold))
	<syntax>	  (##core#require-extension ((only srfi-1 last unfold)) #t)
	<syntax>	  (##core#begin (##core#begin (##sys#load-library (quote srfi-1) #f) (import (only srfi-1 last unfold)...
	<syntax>	  (##core#begin (##sys#load-library (quote srfi-1) #f) (import (only srfi-1 last unfold)))
	<syntax>	  (##sys#load-library (quote srfi-1) #f)
	<syntax>	  (quote srfi-1)
	<syntax>	  (##core#quote srfi-1)
	<syntax>	  (import (only srfi-1 last unfold))
	<syntax>	  (##core#undefined)
	<syntax>	  (##core#undefined)
	<eval>	  (##sys#load-library (quote srfi-1) #f)
	<syntax>	  (import (chicken process-context) (chicken format))	<--