From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vladimir Zhbanov Newsgroups: gmane.lisp.guile.user Subject: Re: Using guile-scmutils with REPL and compilation Date: Sat, 4 Jul 2020 17:57:37 +0300 Message-ID: <20200704145737.GA2838@newvzh.lokolhoz> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.10.1 (2018-07-13) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jul 04 17:12:05 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 1jrjpl-000Aea-F0 for guile-user@m.gmane-mx.org; Sat, 04 Jul 2020 17:12:05 +0200 Original-Received: from localhost ([::1]:52998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrjpk-0003hK-G6 for guile-user@m.gmane-mx.org; Sat, 04 Jul 2020 11:12:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrjcN-0000NP-0w for guile-user@gnu.org; Sat, 04 Jul 2020 10:58:15 -0400 Original-Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:33089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jrjcL-00055f-3z for guile-user@gnu.org; Sat, 04 Jul 2020 10:58:14 -0400 Original-Received: by mail-lj1-x244.google.com with SMTP id e8so5976412ljb.0 for ; Sat, 04 Jul 2020 07:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=i3UAeBf2llsRoHZsAENmxm9Srdb3KhQZeLtXqsRICkw=; b=fY2i84CldaI5z2LYhC6cg2zk0o/8T0vMk5FOYYh70WLwUjS5cuq+x0vMLSz7FNii6r ZLLH7O9dvnA6okXBLPbB4Al7y+GEywl7POAwgrC/SNNtHi1fyYtemqIxmd6IjknqwSk2 Xc0sJWIfCRhv76FHv05xgKMBTGVhEVd/1gQqktqPEtOHxOXHVUGV1g9nzO79y/0D2uZg xnJul4TIIsgg9RCflhxE41AcStR3j4ChXRa/sMlJwfKY6CPrFNc5/WhrvvuAFOCUF9g7 ciFiXbLSkg3qEVkQMZr6juUT2tqSlbVGLQdf1z1ShMf605wq45uDHq4esCG44A3E6JWx qsbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=i3UAeBf2llsRoHZsAENmxm9Srdb3KhQZeLtXqsRICkw=; b=cQ+pmujSJFGMLb81dlSvILVA8cuDlxYjXKeCFykyX5wYmKNAixT5p3tb4XDRWFvrq0 FyebkRziOmrgiju6F6HKtowHsyWp5ddkNqHRm3yTbFBJLBw6KYYA0RznQw9LXEDb0hJu o0+Nv/v7gvoYOoY1EUoXfQ84PxEItTGLXaHdQz5/+4E1WQdmlnKj4adBtg909eryHX7a Tb312vWfB6jZABBfOlFBZJYgrn8LRgUwb3BZa3NkrwinHjE3IKNdNfncfaSzCGgXmLVQ YkYxCjmj+DHNcFRgSD1TJZW91LPlnCKNqtac1h7QSZNL4GYNoWqR9nQfBkSRCki/0M/e iXtA== X-Gm-Message-State: AOAM532M5IIhelj2t1grdY90CkenaRNzmeL44Sy3J4r8HMy/fI5FWjH9 qpZZTbUsGZ+dIu0i7IAp5PYQphfh X-Google-Smtp-Source: ABdhPJwlVyx6sNpaULW90YH4sH/ofzXl+M4YgV7T/wmM3/W8t2wiifJZmpONEptwaXYcjyrYP3RIUg== X-Received: by 2002:a2e:974f:: with SMTP id f15mr5504727ljj.193.1593874690385; Sat, 04 Jul 2020 07:58:10 -0700 (PDT) Original-Received: from newvzh.lokolhoz ([95.179.127.41]) by smtp.gmail.com with ESMTPSA id o1sm6421128lfi.92.2020.07.04.07.58.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 07:58:09 -0700 (PDT) Original-Received: from vovka by newvzh.lokolhoz with local (Exim 4.92) (envelope-from ) id 1jrjbv-0005Hd-Ub for guile-user@gnu.org; Sat, 04 Jul 2020 17:57:47 +0300 Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::244; envelope-from=vzhbanov@gmail.com; helo=mail-lj1-x244.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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-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:16630 Archived-At: On Sat, Jun 20, 2020 at 02:43:00AM +0300, Viacheslav Dushin wrote: > 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) The question is not about scmutils :-) You can run Guile interactively, just type 'guile' in your terminal, and check what every command returns. For example, the following commands will give you your load path before and after launching 'add-to-load-path': scheme@(guile-user)> %load-path scheme@(guile-user)> (add-to-load-path "/Users/slava/.guile.d/") scheme@(guile-user)> %load-path Check, if the directory *really* contains your file "guile-scmutils/src/load.scm", and try the following after that: scheme@(guile-user)> (%search-load-path "guile-scmutils/src/load.scm") Make sure the file is found and is a string, not #f. As I said before (not sure you got it, sorry), 'load' will barf if its argument is not a string. It *will* barf if the argument is #f. So, only if the command above returns the file name you're searching for, try loading it: scheme@(guile-user)> (load (%search-load-path "guile-scmutils/src/load.scm")) Another way is to just use: scheme@(guile-user)> (primitive-load "/My/absolute/file/name.scm") If you're defining a module in your file, use the 'use-modules' procedure to load it. Now about your second question. I don't know, what 'generic-environment' is. Is it defined at all? Try on the prompt: scheme@(guile-user)> generic-environment and read what it reports. BTW, the command '(set-current-module generic-environment)' won't work anyway in your code, since you use '(set-current-module guile-user-module)' just *after* it. HTH -- Vladimir (λ)επτόν EDA — https://github.com/lepton-eda