unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#41353: (const x) is a thunk
@ 2020-05-17 10:41 Jan Synacek
  2020-05-17 14:08 ` bug#41353: (thunk? (const 1)) David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Synacek @ 2020-05-17 10:41 UTC (permalink / raw)
  To: 41353


With guile-3.0.2:

scheme@(guile-user)> (thunk? (const 1))
$1 = #t

Since thunk is a procedure that does not accept arguments (section
6.9.7, documentation for 'thunk?'), the result of the above evaluation
should be #f.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#41353: (thunk? (const 1))
  2020-05-17 10:41 bug#41353: (const x) is a thunk Jan Synacek
@ 2020-05-17 14:08 ` David Kastrup
  2020-05-17 14:46   ` Jan Synacek
  2020-05-27 20:50   ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: David Kastrup @ 2020-05-17 14:08 UTC (permalink / raw)
  To: 41353


I think this is more a matter of the documentation being not quite right:

 -- Scheme Procedure: thunk? obj
 -- C Function: scm_thunk_p (obj)
     Return ‘#t’ if OBJ is a thunk—a procedure that does not accept
     arguments.

"if OBJ can serve as a thunk—a procedure called without arguments."

Note that (thunk? (lambda x x)) also returns #t and that ((const 1))
returns 1.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#41353: (thunk? (const 1))
  2020-05-17 14:08 ` bug#41353: (thunk? (const 1)) David Kastrup
@ 2020-05-17 14:46   ` Jan Synacek
  2020-05-17 15:31     ` lloda
  2020-05-27 20:50   ` Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Synacek @ 2020-05-17 14:46 UTC (permalink / raw)
  To: 41353

On Sun, May 17, 2020 at 4:09 PM David Kastrup <dak@gnu.org> wrote:
> I think this is more a matter of the documentation being not quite right:
>
>  -- Scheme Procedure: thunk? obj
>  -- C Function: scm_thunk_p (obj)
>      Return ‘#t’ if OBJ is a thunk—a procedure that does not accept
>      arguments.
>
> "if OBJ can serve as a thunk—a procedure called without arguments."
>
> Note that (thunk? (lambda x x)) also returns #t and that ((const 1))
> returns 1.

But both (lambda x ...) and (const whatever) are still a procedure that accepts
an argument, aren't they? My understanding of thunk is (lambda () ...),
because that's a procedure that takes zero arguments.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#41353: (thunk? (const 1))
  2020-05-17 14:46   ` Jan Synacek
@ 2020-05-17 15:31     ` lloda
  0 siblings, 0 replies; 5+ messages in thread
From: lloda @ 2020-05-17 15:31 UTC (permalink / raw)
  To: Jan Synacek; +Cc: 41353



> On 17 May 2020, at 16:46, Jan Synacek <jsynacek@redhat.com> wrote:
> 
> On Sun, May 17, 2020 at 4:09 PM David Kastrup <dak@gnu.org> wrote:
>> I think this is more a matter of the documentation being not quite right:
>> 
>> -- Scheme Procedure: thunk? obj
>> -- C Function: scm_thunk_p (obj)
>>     Return ‘#t’ if OBJ is a thunk—a procedure that does not accept
>>     arguments.
>> 
>> "if OBJ can serve as a thunk—a procedure called without arguments."
>> 
>> Note that (thunk? (lambda x x)) also returns #t and that ((const 1))
>> returns 1.
> 
> But both (lambda x ...) and (const whatever) are still a procedure that accepts
> an argument, aren't they? My understanding of thunk is (lambda () ...),
> because that's a procedure that takes zero arguments.

(lambda x ...) takes any number of arguments, including none.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#41353: (thunk? (const 1))
  2020-05-17 14:08 ` bug#41353: (thunk? (const 1)) David Kastrup
  2020-05-17 14:46   ` Jan Synacek
@ 2020-05-27 20:50   ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2020-05-27 20:50 UTC (permalink / raw)
  To: David Kastrup; +Cc: 41353-done

Hi,

David Kastrup <dak@gnu.org> skribis:

> I think this is more a matter of the documentation being not quite right:
>
>  -- Scheme Procedure: thunk? obj
>  -- C Function: scm_thunk_p (obj)
>      Return ‘#t’ if OBJ is a thunk—a procedure that does not accept
>      arguments.
>
> "if OBJ can serve as a thunk—a procedure called without arguments."

Agreed.  Fixed in 9c03e44dcfc118c37d28bb948f4d255c7b755d96.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-27 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 10:41 bug#41353: (const x) is a thunk Jan Synacek
2020-05-17 14:08 ` bug#41353: (thunk? (const 1)) David Kastrup
2020-05-17 14:46   ` Jan Synacek
2020-05-17 15:31     ` lloda
2020-05-27 20:50   ` Ludovic Courtès

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).