data
                                
                                 data copied to clipboard
                                
                                    data copied to clipboard
                            
                            
                            
                        Force, rentrent promise promise/e (or, pam/e is too strict)
I have the following program:
#lang racket
(require data/enumerate
         data/enumerate/lib)
(pam/e (λ (x) x)
       (letrec ([expr/e (delay/e
                         (or/e
                          natural/e
                          (pam/e (λ (x) x)
                                 expr/e
                                 #:contract any/c)))])
         expr/e)
       #:contract any/c)
And when I run it, I get:
. . racket/racket/collects/racket/private/promise.rkt:104:10: force: reentrant promise `promise/e'
I suspect the problem is related to the inner pam/e, because when I turn the inner expression:
(pam/e (λ (x) x)
    expr/e
    #:contract any/c)))])
Into: expr/e the program runs normally.
For now I found data/enumerate/unsafe, and my program seems to work fine in it.
A smaller program breaks too:
#lang racket/base
(require pict/tree-layout
         data/enumerate
         data/enumerate/lib)
(define bt/e
  (delay/e
   (or/e (single/e #f)
         (pam/e (λ (x) (tree-layout (car x) (cdr x)))
                (cons/e bt/e bt/e)
                #:contract tree-layout?))))
(from-nat bt/e 0)
On Wed, Mar 2, 2016 at 2:00 PM, Leif Andersen [email protected] wrote:
For now I found data/enumerate/unsafe, and my program seems to work fine in it.
— Reply to this email directly or view it on GitHub https://github.com/racket/data/issues/4#issuecomment-191373156.
Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io
       "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great." - D&C 64:33
I just got back to looking into this and I'm not seeing the error anymore, although I think I did see if when Leif first posted this.
Maybe one of the compiler optimization fixes fixed it?
I'm on commit 509da64135f412acd8522747daa3568524ac59ae and I have the error.
On Wed, Mar 9, 2016 at 6:06 PM, Robby Findler [email protected] wrote:
I just got back to looking into this and I'm not seeing the error anymore, although I think I did see if when Leif first posted this.
Maybe one of the compiler optimization fixes fixed it?
— Reply to this email directly or view it on GitHub https://github.com/racket/data/issues/4#issuecomment-194558083.
Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io
       "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great." - D&C 64:33
I'm two days ahead of you, but I don't really see any obvious commits that would fix it. Nevertheless, I get the expected error for both of these programs, namely:
delay/e-expression: broke its own contract
promised: two-way-enum?
produced: #<infinite-one-way-enum...>
in: an and/c case of
  (and/c
   infinite-enum?
   two-way-enum?
   flat-enum?)
contract from: /Users/robby/tmp.rkt
blaming: /Users/robby/tmp.rkt
(assuming the contract is correct)
at: /Users/robby/tmp.rkt:7.0
context...:
/Users/robby/git/exp/plt/racket/collects/racket/contract/private/blame.rkt:156:0: raise-blame-error16
/Users/robby/git/exp/plt/racket/collects/racket/private/promise.rkt:104:10
/Users/robby/git/exp/plt/racket/collects/racket/private/more-scheme.rkt:265:2: call-with-exception-handler
/Users/robby/git/exp/plt/racket/collects/racket/private/promise.rkt:96:0: force/generic
/Users/robby/git/exp/plt/extra-pkgs/data/data-enumerate-lib/data/enumerate/private/core.rkt:1076:9
/Users/robby/tmp.rkt: [running body]
I get
force: reentrant promise `promise/e'
  context...:
   /Users/jay/Dev/scm/plt/racket/collects/racket/private/promise.rkt:96:0:
force/generic
   ...private/base.rkt:107:23
 /Users/jay/Dev/scm/plt/racket/collects/racket/contract/private/base.rkt:159:5
 /Users/jay/Dev/scm/plt/racket/collects/racket/contract/private/list.rkt:339:2
 /Users/jay/Dev/scm/plt/racket/collects/racket/contract/private/arrow-higher-order.rkt:454:2
 /Users/jay/Dev/scm/plt/racket/collects/racket/contract/private/arr-i.rkt:1094:2:
un-dep/maybe-chaperone
   ...rivate/arr-i.rkt:914:19
   /Users/jay/Dev/scm/plt/racket/collects/racket/private/kw.rkt:1585:36
   ...private/more.rkt:576:56
 /Users/jay/Dev/scm/plt/extra-pkgs/data-enumerate-lib/data-enumerate-lib/data/enumerate/private/more.rkt:601:13:
temp203
   /Users/jay/Dev/scm/plt/racket/collects/racket/private/promise.rkt:96:0:
force/generic
 /Users/jay/Dev/scm/plt/extra-pkgs/data-enumerate-lib/data-enumerate-lib/data/enumerate/private/core.rkt:1074:9
   /tmp/t.rkt: [running body]
 /Users/jay/Dev/scm/plt/extra-pkgs/compiler-lib/compiler-lib/compiler/commands/test.rkt:176:16
t.rkt: raco test: test raised an exception
Compilation exited abnormally with code 1 at Wed Mar  9 19:04:46
If you expect these programs to both error, how do you think we should write down recursive one-way enumerations?
Jay
On Wed, Mar 9, 2016 at 7:01 PM, Robby Findler [email protected] wrote:
I'm two days ahead of you, but I don't really see any obvious commits that would fix it. Nevertheless, I get the expected error for both of these programs, namely:
delay/e-expression: broke its own contract
promised: two-way-enum?
produced: #<infinite-one-way-enum...>
in: an and/c case of
(and/c
infinite-enum?
two-way-enum?
flat-enum?)
contract from: /Users/robby/tmp.rkt
blaming: /Users/robby/tmp.rkt
(assuming the contract is correct)
at: /Users/robby/tmp.rkt:7.0
context...:
/Users/robby/git/exp/plt/racket/collects/racket/contract/private/blame.rkt:156:0: raise-blame-error16
/Users/robby/git/exp/plt/racket/collects/racket/private/promise.rkt:104:10
/Users/robby/git/exp/plt/racket/collects/racket/private/more-scheme.rkt:265:2: call-with-exception-handler
/Users/robby/git/exp/plt/racket/collects/racket/private/promise.rkt:96:0: force/generic
/Users/robby/git/exp/plt/extra-pkgs/data/data-enumerate-lib/data/enumerate/private/core.rkt:1076:9
/Users/robby/tmp.rkt: [running body]
— Reply to this email directly or view it on GitHub https://github.com/racket/data/issues/4#issuecomment-194575942.
Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io
       "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great." - D&C 64:33
I still don't see why the error went away for me, but the obvious thing to guess is that something happened in the two days of git commits. And yes, I did indeed see that error before.
Meanwhile, here's the program I think that you wanted?
#lang racket/base
(require pict/tree-layout
data/enumerate
data/enumerate/lib)
(define bt/e
(delay/e
 (or/e (single/e #f)
       (pam/e (λ (x) (tree-layout (car x) (cdr x)))
              (cons/e bt/e bt/e)
              #:contract tree-layout?))
 #:two-way-enum? #f))
(for/list ([i (in-range 1 10)])
  (binary-tidier (from-nat bt/e i)))