unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Is ice-9/poe.scm broken?
@ 2005-08-08 15:52 Alan Grover
  2005-08-10  1:56 ` Kevin Ryde
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Grover @ 2005-08-08 15:52 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 956 bytes --]

When I tried to use poe to cache some functions, I got a run-time error.
When I examined poe.scm to understand what I did wrong, I found code
that doesn't make sense under guile. Can anyone confirm that poe is
outdated, or I have a completely wrong idea of how to use it?

guile: 1.6.4

Here's how I tried to use it:

	(use-modules (ice-9 poe))
	(define (some-fn a) (list 'did-something a)) ; trivial function
	(define cached-fn (pure-funcq some-fn))

	(some-fn 'an-arg)
	(cached-fn 'an-arg) ; first time through (dies in here)
	(cached-fn 'an-arg) ; second time through

In poe.scm, it seems to be using the old idiom of '() being treated as
false:

	(or (and (and (not key) (not entry))
	... (eq? (car key) (car entry))

Which I think is supposed to be
	(or (and (and (not (pair? key)) (not (pair? entry)))
	... (eq? (car key) (car entry))

I re-wrote enough of poe.scm to get some things working.

-- 
Alan Grover
awgrover@mail.msen.com
+1.734.476.0969

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

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

* Re: Is ice-9/poe.scm broken?
@ 2005-08-08 21:53 Thien-Thi Nguyen
  0 siblings, 0 replies; 6+ messages in thread
From: Thien-Thi Nguyen @ 2005-08-08 21:53 UTC (permalink / raw)
  Cc: guile-user

   From: Alan Grover <awgrover@mail.msen.com>
   Date: Mon, 08 Aug 2005 11:52:10 -0400

   I re-wrote enough of poe.scm to get some things working.

i likewise had to munge poe.scm for Guile 1.4.x.  see:

  http://www.glug.org/people/ttn/software/guile/
  http://www.glug.org/docbits/guile/1.4.x/Memoization.html

thi


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: Is ice-9/poe.scm broken?
  2005-08-08 15:52 Alan Grover
@ 2005-08-10  1:56 ` Kevin Ryde
  2005-08-10 22:33   ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2005-08-10  1:56 UTC (permalink / raw)


Alan Grover <awgrover@mail.msen.com> writes:
>
> I re-wrote enough of poe.scm to get some things working.

In the cvs head a while ago I changed funcq-assoc to the code below.
Dunno why I didn't do the same in 1.6 (maybe the hashx stuff has
problems too).  You're right that it doesn't work.


;; return true if lists X and Y are the same length and each element
;; is `eq?'
(define (eq?-list x y)
  (if (null? x)
      (null? y)
      (and (not (null? y))
           (eq? (car x) (car y))
           (eq?-list (cdr x) (cdr y)))))

(define (funcq-assoc arg-list alist)
  (if (null? alist)
      #f
      (if (eq?-list arg-list (caar alist))
          (car alist)
          (funcq-assoc arg-list (cdr alist)))))


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: Is ice-9/poe.scm broken?
  2005-08-10  1:56 ` Kevin Ryde
@ 2005-08-10 22:33   ` Marius Vollmer
  2005-08-13  0:46     ` Kevin Ryde
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2005-08-10 22:33 UTC (permalink / raw)
  Cc: guile-user

Kevin Ryde <user42@zip.com.au> writes:

> In the cvs head a while ago I changed funcq-assoc to the code below.
> Dunno why I didn't do the same in 1.6 (maybe the hashx stuff has
> problems too).  You're right that it doesn't work.

Could you try to fix this in 1.6 as well?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: Is ice-9/poe.scm broken?
  2005-08-10 22:33   ` Marius Vollmer
@ 2005-08-13  0:46     ` Kevin Ryde
  2005-08-13 10:50       ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2005-08-13  0:46 UTC (permalink / raw)
  Cc: guile-user

Marius Vollmer <mvo@zagadka.de> writes:
>
> Could you try to fix this in 1.6 as well?

I put it in, I think it works.

On the merely dodgy as opposed to broken front, I suspect the hash
function should be using logxor, and that perfect-funcq doesn't need
to work the base-func into the hash, since the hash is private the
each func.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: Is ice-9/poe.scm broken?
  2005-08-13  0:46     ` Kevin Ryde
@ 2005-08-13 10:50       ` Marius Vollmer
  0 siblings, 0 replies; 6+ messages in thread
From: Marius Vollmer @ 2005-08-13 10:50 UTC (permalink / raw)
  Cc: guile-user

Kevin Ryde <user42@zip.com.au> writes:

> Marius Vollmer <mvo@zagadka.de> writes:
>>
>> Could you try to fix this in 1.6 as well?
>
> I put it in, I think it works.

Thanks!

> On the merely dodgy as opposed to broken front, I suspect the hash
> function should be using logxor, and that perfect-funcq doesn't need
> to work the base-func into the hash, since the hash is private the
> each func.

Hmm, I don't really understand what you are saying here, but if you
feel strongly about changing it, go ahead!  (In HEAD :).

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2005-08-13 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-08 21:53 Is ice-9/poe.scm broken? Thien-Thi Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2005-08-08 15:52 Alan Grover
2005-08-10  1:56 ` Kevin Ryde
2005-08-10 22:33   ` Marius Vollmer
2005-08-13  0:46     ` Kevin Ryde
2005-08-13 10:50       ` Marius Vollmer

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