1

I have procedure that generate sha1 hash from string:

(define (string->sha1 string)
    (let ((port (open-input-string string)))
      (hex (sha1 port))))

the function hex and sha1 are taken from A "pure" scheme implementation (R5RS) of SHA256? I've put the code in sha.scm and load using:

(load "sha.scm")

and I've got warnings like this:

;;; /home/kuba/projects/jcubic/notes/./rpc.scm:66:6: warning: possibly unbound variable `hex'
;;; /home/kuba/projects/jcubic/notes/./rpc.scm:66:11: warning: possibly unbound variable `sha1'

How can I resolve those warnings?

Community
  • 1
  • 1
jcubic
  • 61,973
  • 54
  • 229
  • 402
  • I think you should try `use-modules` instead of `load`. https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html – soegaard Mar 28 '17 at 17:46
  • @soegaard use-modules is for installed modules, but sha.scm is not a module is normal file, how can I use use-modules with normal file? – jcubic Mar 28 '17 at 18:18
  • You need to turn sha.scm into a module first. – soegaard Mar 28 '17 at 18:20

0 Answers0