From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) Newsgroups: gmane.lisp.guile.user Subject: Re: get all available symbols in scheme Date: Tue, 14 Jun 2016 00:07:07 +0200 Message-ID: <8737ogvj3o.fsf@T420.taylan> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1465855599 3724 80.91.229.3 (13 Jun 2016 22:06:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jun 2016 22:06:39 +0000 (UTC) Cc: "guile-user@gnu.org" To: source liu Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 14 00:06:39 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bCa0A-0008I1-1Z for guile-user@m.gmane.org; Tue, 14 Jun 2016 00:06:34 +0200 Original-Received: from localhost ([::1]:59667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCa08-0001nF-IS for guile-user@m.gmane.org; Mon, 13 Jun 2016 18:06:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCZzU-0001kv-IK for guile-user@gnu.org; Mon, 13 Jun 2016 18:05:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCZzS-0006ZC-Km for guile-user@gnu.org; Mon, 13 Jun 2016 18:05:51 -0400 Original-Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:35058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCZzR-0006Yk-Ve for guile-user@gnu.org; Mon, 13 Jun 2016 18:05:50 -0400 Original-Received: by mail-wm0-x22c.google.com with SMTP id v199so96328064wmv.0 for ; Mon, 13 Jun 2016 15:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=h73J2W5B6Z5uZvT9C/zh7UQH80uOgyW1lm9Cs4FeXcQ=; b=V4xzaNVf6ERTanf0hT05hoCSLAnASDZZj/8NHvZozKq7S4SLPM04G/MVD12zyv6YPE XUmxyIgxJPog6UurVimdl/FIh48r5UJmZGYvFcH5b+o8MsSebjQbAswwhuJ2rlfOxzyS u+g1VbIws0Vyb8ibT7PLwZ4KclhDp8T09KNxFFUp5CiAZxVjil8cRWJ/YiI/FYjVzcmM ZoBxNlIrDwZgmxkoNqMPBF3jgUVJU8lcJGAyMZsrlRE4MkklM+N6Hk4jtHa6/nRMTPKV zZWKDnuUDfu9bwuq/jp6lJ0Bk6zITIQTKC/XWwqRyaCestNvtr7Yxg959rsI0Jx6mIhc BeXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=h73J2W5B6Z5uZvT9C/zh7UQH80uOgyW1lm9Cs4FeXcQ=; b=iRXAj5lTMhVZBEPplCofLzI3zZkxhuEM361Ixw1Stp9mfIMa5lo1gdB8ul1JDMwD9x hzvD+SngxcNTLpgk/k4M4h9KXxpZX6x2ozlvwJYUik8E+WUSlocBPsljG0ke1B6YJffa SnwosxOMGj7uuzqtxywkU6RtoE/Ad2n+ZQJ9GUlVmdxCXkcvBoUHVSScIFEoo4FqIi89 +aH9scNQtCG7NXOcqaaySQ4lX/L8w2m9oGtooYAUS8pnSRkJ/YQC3kGwMLBNeNES+xQO gAay+PgLHu/KLi/92MhI4RYskDZ8X+wFUV4MiHhxVuWf6oGXemhvbwN7FjxWLJq35l/f iZ2A== X-Gm-Message-State: ALyK8tKMhkhlUe5EZu9+ibqu/Tj0jYiABDCZqHrNaw1bjAXHlfogGBFFgzkxD/36/olsew== X-Received: by 10.28.158.132 with SMTP id h126mr1392968wme.43.1465855548883; Mon, 13 Jun 2016 15:05:48 -0700 (PDT) Original-Received: from T420.taylan ([2a02:908:c30:3540:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id i74sm749378wmg.21.2016.06.13.15.05.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jun 2016 15:05:47 -0700 (PDT) In-Reply-To: (source liu's message of "Tue, 14 Jun 2016 02:38:06 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22c X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12635 Archived-At: source liu writes: > Hi=EF=BC=8C > > glad to join the list > > I wonder if there is some way to dump all available symbols in current > enviroment=EF=BC=88something like =E2=80=9Cdir=E2=80=9D in python=EF=BC= =89=EF=BC=8C i think it is very useful when > you are trying new modules > > I have tried the guile reference guide as well as google=EF=BC=8Cbut cant= find any > clue > > Any suggestion=EF=BC=9F > > great thanks You can define something like: (define (display-module-interface module) (module-for-each (lambda (name variable) (let* ((name-length (string-length (symbol->string name))) (value (variable-ref variable)) (documentation (object-stexi-documentation value))) (format #t "~a\n" name) (format #t "~a\n\n" (make-string name-length #\=3D)) (format #t "Documentation:\n~a\n\n" documentation) (format #t "Value:\n~a\n\n\n" value))) (resolve-interface module))) and then use it like this in the REPL: (display-module-interface '(rnrs bytevectors)) Comment out the line printing the value if you want... One problem with this is that the stexi documentation may not look very nice in plain text. Another problem is that documentation is attached to objects in Guile, rather than module/symbol combinations; this means, for example, if a module defines a constant like O_APPEND which is bound to a number, it's unclear where the documentation should be attached, since attaching it to a number would be pretty weird. A third problem is that we often lack documentation, sadly. Taylan