Giter Club home page Giter Club logo

Comments (6)

fisherdj avatar fisherdj commented on July 29, 2024

The fix is to change the include invocations in the Guile files to include-from-path invocations. I don't have things set up to do a pull request for this project right now and it might be a few days before I can get it set up again. If anyone else wants to do this in the meantime please do so.

The problem is that include doesn't figure out where to draw its files from. 2.2 has a new special form include-from-path which should work consistently for including from the load path (what we want to do). It seems that somewhere between 2.2.0 and 2.2.4 the behavior of include was changed to reflect this change (my guess is that this behavior changed with 2.2.1, which introduced some sandboxing).

As for why Guile leans on the Vicare implementation: the Vicare implementation is mostly R6RS, so it was easiest to lean on Guile's R6RS support when I added the Guile module.

from faster-minikanren.

ZelphirKaltstahl avatar ZelphirKaltstahl commented on July 29, 2024

@fisherdj Are you saying this a simple search and replace of include with include-from-path? I could probably do it in this case. And Guile files are all which are recursively imported from mk-guile.scm?

from faster-minikanren.

fisherdj avatar fisherdj commented on July 29, 2024

@ZelphirKaltstahl You also need to prepend faster-miniKanren/ to path names, and the only files that you need to touch are mk-guile.scm and test-guile.scm. When you do the change, check it by running Guile on the test-guile.scm file.

from faster-minikanren.

ZelphirKaltstahl avatar ZelphirKaltstahl commented on July 29, 2024

I replaced all include with include-from-path and prepended faster-miniKanren/ to paths which are strings in the mk-guile.scm file, but now I get a different error when running the test file test-guile.scm:

[21:02:20]:[~/development/Guile/libs/faster-miniKanren]: guile test-guile.scm 
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/user/development/Guile/libs/faster-miniKanren/test-guile.scm
;;; WARNING: compilation of /home/user/development/Guile/libs/faster-miniKanren/test-guile.scm failed:
;;; no code for module (faster-miniKanren mk-guile)
Backtrace:
           9 (primitive-load "/home/user/development/Guile/libs/faster-miniKanren/test-guile.scm")
In ice-9/eval.scm:
   721:20  8 (primitive-eval (use-modules (faster-miniKanren mk-guile)))
In ice-9/psyntax.scm:
  1235:36  7 (expand-top-sequence ((use-modules (faster-miniKanren mk-guile))) _ _ #f e (eval) (# #))
  1182:24  6 (parse _ (("placeholder" placeholder)) ((top) #(ribcage () () ())) _ e (eval) (hygiene #))
   285:10  5 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) (hygiene guile-user))
In ice-9/boot-9.scm:
  3365:20  4 (process-use-modules _)
   222:17  3 (map1 (((faster-miniKanren mk-guile))))
  3366:31  2 (_ ((faster-miniKanren mk-guile)))
   2791:6  1 (resolve-interface _ #:select _ #:hide _ #:prefix _ #:renamer _ #:version _)
In unknown file:
           0 (scm-error misc-error #f "~A ~S" ("no code for module" (faster-miniKanren mk-guile)) #f)

ERROR: In procedure scm-error:
no code for module (faster-miniKanren mk-guile)

Which is a bit strange, because I see that the module is defined inside the very file I edited.

The code with changes the changes I made is:

(define-module (faster-miniKanren mk-guile)
  #:export (run run*
            == =/=
            fresh
            conde
            symbolo numbero
            absento
            matche))

(import (rnrs (6)))
(import (rnrs records syntactic (6)))

(define sub1 1-)
(define add1 1+)

(define fx= fx=?)
(define fxsla fxarithmetic-shift-left)
(define fxsra fxarithmetic-shift-right)
(define fxsll bitwise-arithmetic-shift-left)

(include-from-path "faster-miniKanren/mk-vicare.scm")
(include-from-path "faster-miniKanren/mk.scm")

(define (andmap proc . args)
  (let ((l (length (car args))))
    (when (pair? (filter (lambda (x) (not (= l (length x)))) args))
      (error 'andmap "Lists of unequal length" args)))
  (let rec
    ((result '())
     (args args))
    (if (equal? (car args) '())
      (reverse result)
      (let ((val (apply proc (map car args))))
        (if (not val)
          (reverse result)
          (rec (cons val result)
               (map cdr args)))))))

(define generate-temporary gensym)

(include-from-path "faster-miniKanren/matche.scm")

from faster-minikanren.

fisherdj avatar fisherdj commented on July 29, 2024

Strangely, the code you wrote works on my machine. The error you're getting now looks like the error I get after executing GUILE_LOAD_PATH="", double-check that the value of GUILE_LOAD_PATH is correct with echo $GUILE_LOAD_PATH.
If you're getting the error with a correct GUILE_LOAD_PATH environment variable I don't know what's going on.

from faster-minikanren.

ZelphirKaltstahl avatar ZelphirKaltstahl commented on July 29, 2024

Hm, the load path variable seems correct:

$ echo $GUILE_LOAD_PATH
/home/user/development/Guile/libs

Edit: Maybe I did not restart my terminal emulator yesterday? Today I can run the tests. Trying one more thing … Hm, even from the path from where I called the test script yesterday it works. Then I guess it must have been, that I forgot to restart the terminal emulator. Thanks for checking, I will make it a PR.

from faster-minikanren.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.