~whereiseveryone/toys#18: 
Add signature to symbol lists

Hi,

Thanks for this service. Really nice!

For instance, the output of https://toys.whereis.みんな/symbols?search=fold does not display the signature of each procedure. It could be nice to have. Something similar to,

scheme@(guix-user)> ,apropos fold
#<procedure fold-packages (proc init #:optional modules #:key select?)>

I think this small addition show does the job:

diff --git a/toys/discovery.scm b/toys/discovery.scm
index 40f0946..5783bbd 100644
--- a/toys/discovery.scm
+++ b/toys/discovery.scm
@@ -28,6 +28,7 @@
   #:use-module (guix store)
   #:use-module (guix utils)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-71)
 
@@ -165,7 +166,12 @@ not be determined."
                             (variable-bound? variable)
                             (procedure? (variable-ref variable))
                             (procedure-documentation (variable-ref variable)))
-                          "")))
+                          ""))
+            ("signature" . (or (and
+                                (variable-bound? variable)
+                                (procedure? (variable-ref variable))
+                                (format #t "~a~%" (variable-ref variable)))
+                               "")))
           result))
       '()
       (all-modules))))

Well, the variable-ref is converted as string so the output would look as above.

Maybe, the second step could to remove #<procedure and trailing > depending on your cosmetic preferences. :-)

Hope that helps.

Cheers, simon

PS: First time I am sending something to SourceHut... and I am a bit confused by the interface. Or how to send patches.

Status
RESOLVED CLOSED
Submitter
~zimoun
Assigned to
Assign someone
Submitted
1 year, 8 months ago
Updated
1 year, 8 months ago
Labels
No labels applied.

~unwox 1 year, 8 months ago* · edit

Hey!

Thank you for your suggestion! Showing signatures would indeed be very useful. Could you send the patch to ~whereiseveryone/toys@lists.sr.ht? Then we can apply your patch properly with your authorship specified. Here are instructions on how to do it https://git-send-email.io

Thanks again

~jgart 1 year, 8 months ago · edit

hi zimoun,

Thanks for the code and suggestions. It is much appreciated!

Or how to send patches.

The process for sending a patch is just to git send-email the patch(es) to the address that unwox mentioned.

For example,

$ git send-email --to="~whereiseveryone/toys@lists.sr.ht" -1

all best,

jgart

~unwox REPORTED CLOSED 1 year, 8 months ago · edit

Register here or Log in to comment, or comment via email.