From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Christina O'Donnell <cdo@mutix.org>
Newsgroups: gmane.lisp.guile.user,gmane.comp.gnu.guix.user
Subject: Getting all symbols in a Scheme file as a list
Date: Sun, 4 Feb 2024 19:50:54 +0000
Message-ID: <03f7199a-daf2-e070-8156-6837d7e20e32@mutix.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="37832"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.0
Cc: help-guix@gnu.org
To: guile-user@gnu.org
Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Feb 04 20:51:24 2024
Return-path: <guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org>
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 <guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org>)
	id 1rWiWR-0009co-Vb
	for guile-user@m.gmane-mx.org; Sun, 04 Feb 2024 20:51:23 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guile-user-bounces@gnu.org>)
	id 1rWiW8-000288-1x; Sun, 04 Feb 2024 14:51:04 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <cdo@mutix.org>)
 id 1rWiW6-00027s-PT; Sun, 04 Feb 2024 14:51:02 -0500
Original-Received: from vmi993448.contaboserver.net ([194.163.141.236] helo=mutix.org)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <cdo@mutix.org>)
 id 1rWiW5-0002ye-1X; Sun, 04 Feb 2024 14:51:02 -0500
Original-Received: from [192.168.1.169]
 (host86-132-246-87.range86-132.btcentralplus.com [86.132.246.87])
 (Authenticated sender: cdo)
 by mutix.org (Postfix) with ESMTPSA id 7F8C3A607FD;
 Sun,  4 Feb 2024 20:50:56 +0100 (CET)
Content-Language: en-US
Received-SPF: pass client-ip=194.163.141.236; envelope-from=cdo@mutix.org;
 helo=mutix.org
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: guile-user@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Guile related discussions <guile-user.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guile-user>,
 <mailto:guile-user-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guile-user>
List-Post: <mailto:guile-user@gnu.org>
List-Help: <mailto:guile-user-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guile-user>,
 <mailto:guile-user-request@gnu.org?subject=subscribe>
Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org
Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.lisp.guile.user:19437 gmane.comp.gnu.guix.user:17820
Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/19437>

Hi,

I'm trying to write a Guile script to trace symbol definition and reference
between modules in a large Guile repo (GNU/Guix), for the purposes of large
scale refactoring.

I'm wondering how I could programmatically get all the values in a 
Scheme file
as an S-expression. From the manual, I know that the REPL has meta keyword
',binding' and ',apropos'
<https://www.gnu.org/software/guile/manual/guile.html#index-apropos> 
which let
you search and list all bindings in accessible to a module. These are 
exactly
what I need only, since they're meta-commands, they don't produce Scheme
expressions.

Does anyone have any pointers? Should I go down the route of,

    (open-input-pipe (string-append "guile -l" file "-c ,binding"))

? Seems a little bit baroque to me, I'd expect a simpler way of doing 
it. Any
libraries anyone knows of?

Kind regards,
  - Christina