unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: 71684@debbugs.gnu.org, Juliana Sims <juli@incana.org>
Subject: bug#71684: [PATCH v2] doc: Document the peek and pk procedures.
Date: Wed, 10 Jul 2024 15:48:53 -0400	[thread overview]
Message-ID: <877cdtuixm.fsf@gmail.com> (raw)
In-Reply-To: <878qy9glbd.fsf@gmail.com> (Simon Tournier's message of "Wed, 10 Jul 2024 20:21:10 +0200")

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

[...]

>> +@lisp
>> +(map (lambda (v)
>> +       (if (number? v)
>> +           (number->string v)
>> +           (pk v)))
>> +     '(1 "2" "3" 4))
>> +@result{}
>> +
>> +;;; ("2")
>> +
>> +;;; ("3")
>> +("1" "2" "3" "4")
>> +@end
>
> For what it is worth, I would suggest something as:
>
> (map (lambda (v)
>        (if (number? v)
>            (number->string v)
>            (begin
>              (pk 'else v)
>              (pk (string-append "-" v "0")))))
>      '(1 "2" "3" 4))
>
> For two reasons:
>
>  1. ’begin’ helps to mark a sequence of expressions; IMHO, that’s a good
>      habit when playing with ’pk’ for debugging purpose.
>
>  2. it exposes that ’stuff’ above can be anything.
>
>
> Well, my suggestion could be two other examples in addition to the
> current one instead of the complexification.

I think I'd prefer more simple examples than a single more complicated
one, if we go that route.  I think the text explained 'peek' clearly
already, though, so I personally would opt to leave it as is, especially
since adding a 'begin' block to showcase multiple 'pk' calls goes
against the merit of peek of being least intrusive (it prints then
returns the value, so the code structure needs not be changed).

-- 
Thanks,
Maxim





  reply	other threads:[~2024-07-10 19:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 18:54 bug#71684: [PATCH] doc: Document the peek and pk procedures Juliana Sims via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2024-07-02  3:54 ` Maxim Cournoyer
2024-07-02 16:28   ` bug#71684: [PATCH v2] " Juliana Sims via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2024-07-09  2:56     ` Maxim Cournoyer
2024-07-10 18:21     ` Simon Tournier
2024-07-10 19:48       ` Maxim Cournoyer [this message]
2024-07-11  8:59         ` Simon Tournier
2024-07-16  2:46           ` Juliana Sims via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2024-07-23 15:24             ` bug#71684: [PATCH] " jgart via Bug reports for GUILE, GNU's Ubiquitous Extension Language

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cdtuixm.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=71684@debbugs.gnu.org \
    --cc=juli@incana.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).