[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sending and and or as an argument links their behavior
From: |
Gregory Marton |
Subject: |
sending and and or as an argument links their behavior |
Date: |
Fri, 25 Jan 2008 19:07:03 -0500 (EST) |
Hi folks,
I'm wondering what to make of this behavior, seen in both guile 1.8.1 and
1.8.3, discovered by my colleague L. Brown Westrick, cc:ed above:
guile> (define (apply2 f a b) (f a b))
guile> (apply2 or #t #f)
#t
guile> (apply2 and #t #f)
#t
[ #f expected ]
guile> (quit)
[because we're dealing with order here, it's useful to get a clean start.
it turns out that this doesn't reset. You will keep getting #t for
(apply2 and #t #f) and (apply2 and #f #t), though (apply2 and #f #f) will
be correct.]
guile> (define (apply2 f a b) (f a b))
guile> (apply2 and #t #f)
#f
guile> (apply2 or #t #f)
#f
[ #t expected ]
(and #t #f) and (or #t #f) are not sensitive to this -- one has to pass
them to another function and invoke them thus. I know these are not normal
procedures, in that (procedure? and) ===> #f but this still seems wrong.
I've attached a new test file boolean.test that tests this, as well as
other standard things we expect of booleans which all pass. I am in the
process of getting signed off w.r.t. copyright.
Thanks,
Grem
--
------ __@ Gregory A. Marton http://csail.mit.edu/~gremio/
--- _`\<,_ .
-- (*)/ (*) The perfect is the enemy of the good.
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~
boolean.test
Description: Text document
- sending and and or as an argument links their behavior,
Gregory Marton <=