From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Viacheslav Dushin Newsgroups: gmane.lisp.guile.user Subject: Using guile-scmutils with REPL and compilation Date: Sat, 20 Jun 2020 02:43:00 +0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="59493"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jun 20 02:56:21 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmRnx-000FMQ-Mf for guile-user@m.gmane-mx.org; Sat, 20 Jun 2020 02:56:21 +0200 Original-Received: from localhost ([::1]:58390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmRnw-0003rd-NS for guile-user@m.gmane-mx.org; Fri, 19 Jun 2020 20:56:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmQfF-00085c-47 for guile-user@gnu.org; Fri, 19 Jun 2020 19:43:17 -0400 Original-Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:43829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmQfB-0002Dx-SN for guile-user@gnu.org; Fri, 19 Jun 2020 19:43:16 -0400 Original-Received: by mail-wr1-x444.google.com with SMTP id l10so11231348wrr.10 for ; Fri, 19 Jun 2020 16:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Zokz+NWqhPo0oVJOydleQ/EwvMqvhLc4gs5yzxiUBRI=; b=gAdec5G0EflUn0plSrGJf3Ko83ohy9vrjp8/ctAu5+VbAInv7xs+2JwZMjGOiIVwxH ZEJs0sOn+fnt3RBRrilq3Ce1e2jDEePe8nYQzfFX0T0gND5XpJM8FESE/DGy/0inqsYf 7DQ10LDO6dWse/qFCJ6ztoyCH2TEkOkHo6Ht6ftq9ESggID4Xe9D4cOgH74Q8SLS2Htx vAwuJE1oZbYPwrLgGlz8nWgrSxV7bzl/iJ7hDoLkxZTXnICLOuxJLCm4vMgoF0Gguh4H c4noAvwlnZXSztO8RQiRgRTZOrc9bmcovHseU5fmBysuslgk7yqtcqmk5oppz4LxwxgM cPbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Zokz+NWqhPo0oVJOydleQ/EwvMqvhLc4gs5yzxiUBRI=; b=pN8vtgaG7A32efgNdISonow9tclZ05JdlFCqvIaVn3UZv4VB1Y9SO8VgYZeGAdQFbC Gqcz/cEmZyMYme8muNAjYEz21VSO4cd/XIyDko+D847pMbOyOCAiOp7RKoXczOO2jP4I KtMwRxX+JbCvmGwx32NVVyeu+thklSqwvNgaVFlQ8mc8ZJkmSh0NO2T3kiqvyZXKnToV XTnP1zP1da5fuh6meCSkdoXqrRmuhYFnU/mZXOBYQEoHFYZb0LBoWiXNaRCtwd27BQwH kKd3ZRnvJmjcK+hFYUppnYsc3O8yiFpNWAEsy+yRv2LJVHiumq07366iq4dhz8YQDnst myjw== X-Gm-Message-State: AOAM532Lk8tIVDCXKonfc8n+kPSFhzm+WXsXNC0hIIc2GR0J/VGJ0fcm 3zmeElcYtzuHZ66O2f2BQzTK/9kZt8fhrs3rY1VTDMLM X-Google-Smtp-Source: ABdhPJwyS7cAEO+wKV1X9Qe5r2Hey0oLAh+h23PkLTddQOSaERsYf7Ov4eV0gll2gzXUegmJ/leRrx9bpl17GY62eqY= X-Received: by 2002:adf:fecc:: with SMTP id q12mr6732306wrs.135.1592610191345; Fri, 19 Jun 2020 16:43:11 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=slava333@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Fri, 19 Jun 2020 20:54:47 -0400 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16594 Archived-At: Hello all I have a couple of questions about guile-scmutils. First one: I run into a similar problem that is described here: https://lists.gnu.org/archive/html/guile-user/2008-04/msg00007.html Turns out the solution is to modify top-repl as said here: https://lists.gnu.org/archive/html/guile-user/2008-04/msg00021.html Since I'm new to Lisp I decided to work on the ice-9 source code directly. I'm going to create my own scmutils-top-repl after I resolve all problems. Here is how my top-repl from top-repl.scm looks like: (define (top-repl) (let ((guile-user-module (resolve-module '(guile-user)))) (add-to-load-path "/Users/slava/.guile.d/") (load (%search-load-path "guile-scmutils/src/load.scm")) (set-current-module generic-environment) ;; Use some convenient modules (in reverse order) (set-current-module guile-user-module) (process-use-modules (append '(((ice-9 r5rs)) ((ice-9 session))) (if (provided? 'regex) '(((ice-9 regex))) '()) (if (provided? 'threads) '(((ice-9 threads))) '()))) (call-with-sigint (lambda () (and (defined? 'setlocale) (catch 'system-error (lambda () (setlocale LC_ALL "")) (lambda (key subr fmt args errno) (format (current-error-port) "warning: failed to install locale: ~a~%" (strerror (car errno)))))) (let ((status (start-repl (current-language)))) (run-hook exit-hook) status))) ) ) I simply added these three lines: (add-to-load-path "/Users/slava/.guile.d/") (load (%search-load-path "guile-scmutils/src/load.scm")) (set-current-module generic-environment) When I run it I get the following error: ;;; note: source file /usr/local/Cellar/guile/2.2.7_2/share/guile/2.2/ice-9/boot-9.scm ;;; newer than compiled /usr/local/Cellar/guile/2.2.7_2/lib/guile/2.2/ccache/ice-9/boot-9.go ;;; note: source file /usr/local/Cellar/guile/2.2.7_2/share/guile/2.2/ice-9/top-repl.scm ;;; newer than compiled /usr/local/Cellar/guile/2.2.7_2/lib/guile/2.2/ccache/ice-9/top-repl.go ;;; note: source file /usr/local/Cellar/guile/2.2.7_2/share/guile/2.2/ice-9/top-repl.scm ;;; newer than compiled /Users/slava/.cache/guile/ccache/2.2-LE-8-3.A/usr/local/Cellar/guile/2.2.7_= 2/share/guile/2.2/ice-9/top-repl.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /usr/local/Cellar/guile/2.2.7_2/share/guile/2.2/ice-9/top-rep= l.scm ;;; ice-9/top-repl.scm:53:4: warning: possibly unbound variable `generic-environment' ;;; compiled /Users/slava/.cache/guile/ccache/2.2-LE-8-3.A/usr/local/Cellar= /guile/2.2.7_2/share/guile/2.2/ice-9/top-repl.scm.go Backtrace: 3 (apply-smob/1 #) In ice-9/eval.scm: 657:36 2 (_ _) In ice-9/top-repl.scm: 52:4 1 (top-repl) In unknown file: 0 (_ # # #) ERROR: In procedure module-lookup: Unbound variable: generic-environment If I remove (set-current-module guile-user-module), then it runs OK and I even have access to the scmutils functions, e.g.: (define h (compose cube sin)) (h 2) outputs: .7518269446689928 What am I missing? Second one: There is also a problem with code compilation: (load (%search-load-path "guile-scmutils/src/load.scm")) (set-current-module generic-environment) (define ((Gamma w) t) (up t (w t) ((D w) t))) works fine in the REPL, but fails to compile (guile code.scm) with the following error: ;;; note: source file /usr/local/Cellar/guile/2.2.7_2/share/guile/2.2/ice-9/boot-9.scm ;;; newer than compiled /usr/local/Cellar/guile/2.2.7_2/lib/guile/2.2/ccache/ice-9/boot-9.go ;;; note: source file /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm ;;; newer than compiled /Users/slava/.cache/guile/ccache/2.2-LE-8-3.A/Users/slava/Documents/work/fu= nc-diff-geometry/prologue/code.scm.go ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /Users/slava/Documents/work/func-diff-geometry/prologue/code.= scm ;;; WARNING: compilation of /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm failed: ;;; Syntax error: ;;; /Users/slava/Documents/work/func-diff-geometry/prologue/code.scm:4:0: source expression failed to match any pattern in form (define ((Gamma w) t) (up t (w t) ((D w) t))) Backtrace: 6 (primitive-load "/Users/slava/Documents/work/func-diff-=E2=80= =A6") 5 (_ # # #) 4 (_ # # #) 3 (_ # # #) In ice-9/eval.scm: 245:16 2 (_ #(#(# #f # = =E2=80=A6))) In unknown file: 1 (string-prefix? "/" #f # # # =E2=80=A6) 0 (_ # # #) ERROR: In procedure string-prefix?: Wrong type argument in position 2 (expecting string): #f Thanks, Slava