Re: [racket-users] derp-3 not working, could be bug in either derp-3 or racket (I'm guessing it's Racket)

2016-08-29 Thread 'John Clements' via Racket Users

> On Aug 29, 2016, at 5:09 PM, Matthew Flatt  wrote:
> 
> Thanks for the report! I think I have a repair, and I'll push as soon
> as it passes a build and tests.

Thanks!

John



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] derp-3 not working, could be bug in either derp-3 or racket (I'm guessing it's Racket)

2016-08-29 Thread Matthew Flatt
Thanks for the report! I think I have a repair, and I'll push as soon
as it passes a build and tests.

At Mon, 29 Aug 2016 19:45:40 -0400, "'John Clements' via Racket Users" wrote:
> In Racket v6.6.0.4, it appears that the derp-3 parser-based-on-derivatives 
> (as 
> it now exists in the https://bitbucket.org/ucombinator/derp-3 bitbucket repo) 
> doesn’t run at the command-line.
> 
> Specifically, if I download this repo and run
> 
> racket pyparse.rkt
> 
> … in the src/ directory, I get this output:
> 
> pcp143094pcs:/tmp/a/b/derp-3/src (git)-[master]- clements> racket 
> ./pyparse.rkt 
> link: bad variable linkage;
>  reference to a variable that has the wrong procedure or structure-type shape
>   reference phase level: 0
>   variable module: "/tmp/a/b/derp-3/src/derp.rkt"
>   variable phase: 0
>   reference in module: "/tmp/a/b/derp-3/src/pyparse.rkt"
>   in: set-node-tag1!
>   context...:
>/tmp/a/b/derp-3/src/pyparse.rkt: [running body]
>/tmp/a/b/derp-3/src/pyparse.rkt: [running body]
> 
> It is worth noting that this does not happen when running in DrRacket. 
> instead, you get (correctly) an error about missing command-line arguments. 
> Furthermore, stripping out later parts of the pyparse.rkt file results in a 
> file that still signals the above error at the command-line, but runs without 
> error in DrRacket.
> 
> After digging through the source a bit, I notice several things:
> 
> 1) there is no occurrence of ‘tag1’ in the source.
> 2) There is a structure named ‘node’ that has a field named ‘tag’
> 3) Derp-3 is doing some interesting things with structures: specifically, it 
> has an “unsafe-struct” form, and node is one of them.
> 
> Since this code worked in earlier versions of Racket, it seems likely that 
> either 
> 
> 1) This is a newly introduced bug in Racket, or
> 2) This is a newly *fixed* bug in Racket, or
> 3) This is a consequence of changes to the syntax system associated with the 
> transition to scope sets.
> 
> Because of the fact that I don’t see the error in DrRacket, I’m inclined to 
> lean toward number 1, and more specifically toward optimizations that may be 
> present in the command-line that aren’t present in DrRacket, or more 
> generally 
> simply differences in the .zo files generated by the two systems (if I 
> understand our current compilation process correctly).
> 
> I’m guessing that the next step in fixing this would be to attempt to convert 
> ‘node’ to a standard structure to see if the problem goes away, but I thought 
> I’d ask you folks first.
> 
> Best,
> 
> John
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] derp-3 not working, could be bug in either derp-3 or racket (I'm guessing it's Racket)

2016-08-29 Thread 'John Clements' via Racket Users
In Racket v6.6.0.4, it appears that the derp-3 parser-based-on-derivatives (as 
it now exists in the https://bitbucket.org/ucombinator/derp-3 bitbucket repo) 
doesn’t run at the command-line.

Specifically, if I download this repo and run

racket pyparse.rkt

… in the src/ directory, I get this output:

pcp143094pcs:/tmp/a/b/derp-3/src (git)-[master]- clements> racket ./pyparse.rkt 
link: bad variable linkage;
 reference to a variable that has the wrong procedure or structure-type shape
  reference phase level: 0
  variable module: "/tmp/a/b/derp-3/src/derp.rkt"
  variable phase: 0
  reference in module: "/tmp/a/b/derp-3/src/pyparse.rkt"
  in: set-node-tag1!
  context...:
   /tmp/a/b/derp-3/src/pyparse.rkt: [running body]
   /tmp/a/b/derp-3/src/pyparse.rkt: [running body]

It is worth noting that this does not happen when running in DrRacket. instead, 
you get (correctly) an error about missing command-line arguments. Furthermore, 
stripping out later parts of the pyparse.rkt file results in a file that still 
signals the above error at the command-line, but runs without error in DrRacket.

After digging through the source a bit, I notice several things:

1) there is no occurrence of ‘tag1’ in the source.
2) There is a structure named ‘node’ that has a field named ‘tag’
3) Derp-3 is doing some interesting things with structures: specifically, it 
has an “unsafe-struct” form, and node is one of them.

Since this code worked in earlier versions of Racket, it seems likely that 
either 

1) This is a newly introduced bug in Racket, or
2) This is a newly *fixed* bug in Racket, or
3) This is a consequence of changes to the syntax system associated with the 
transition to scope sets.

Because of the fact that I don’t see the error in DrRacket, I’m inclined to 
lean toward number 1, and more specifically toward optimizations that may be 
present in the command-line that aren’t present in DrRacket, or more generally 
simply differences in the .zo files generated by the two systems (if I 
understand our current compilation process correctly).

I’m guessing that the next step in fixing this would be to attempt to convert 
‘node’ to a standard structure to see if the problem goes away, but I thought 
I’d ask you folks first.

Best,

John



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Spreadsheet widget?

2016-08-29 Thread David Storrs
Is there a spreadsheet in Racket?  I dug through the list and found a
mailing list thread
 from
2008 but nothing since then.  I also checked the  Widget Gallery
 and didn't see one.

Greg Cooper, in that thread you said
 that
you'd be interested in talking/working with someone to make this happen.
Is that still the case, and do you have time / interest?  Even if you don't
want to take it on yourself I'd sure appreciate having someone to talk it
through with so I can judge if it's something I can do.

(If anyone else has time/interest in talking it out, that would also be
great.)

Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Typed racket and continuations

2016-08-29 Thread Matthias Felleisen

Continuations don’t return. In a set-oriented type system this means their 
result type is the empty set: 

#lang typed/racket

(define-type EmptySet (U))

(: d-or-s (U False (-> Number EmptySet)))
(define d-or-s #f)

(: double-or-same (-> Number Number))
(define (double-or-same x)
 (call/cc (lambda ({c : (-> Number EmptySet)})
(set! d-or-s c)
(+ x x


> On Aug 29, 2016, at 2:18 PM, Sourav Datta  wrote:
> 
> Hey everyone,
> 
> I am a beginner in Racket and recently learned the basic concepts of 
> continuations. I like Racket's support of multiple types of continuations as 
> opposed one type in Scheme. Recently I also started learning about typed 
> Racket. My problem is, I am not sure how I can annotate a continuation in a 
> typed racket program. For example, when trying to annotate the below code:
> 
> #lang racket
> 
> (define d-or-s #f)
> 
> (define (double-or-same x)
>  (call/cc (lambda (c)
> (set! d-or-s c)
> (+ x x
> 
> in typed racket, I can see that double-or-same function can have type 
> (Integer -> Integer). But what should be the type of the variable do-or-s? If 
> it is Any, then it cannot be called like a function after the continuation is 
> set to it. So basically my question is how can we type annotate different 
> types of continuations starting from a simple one like the above? Also a 
> pointer to the relevant section in typed racket docs would be great.
> 
> Thanks!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Typed racket and continuations

2016-08-29 Thread Sourav Datta
Hey everyone,

I am a beginner in Racket and recently learned the basic concepts of 
continuations. I like Racket's support of multiple types of continuations as 
opposed one type in Scheme. Recently I also started learning about typed 
Racket. My problem is, I am not sure how I can annotate a continuation in a 
typed racket program. For example, when trying to annotate the below code:

#lang racket

(define d-or-s #f)

(define (double-or-same x)
  (call/cc (lambda (c)
 (set! d-or-s c)
 (+ x x

in typed racket, I can see that double-or-same function can have type (Integer 
-> Integer). But what should be the type of the variable do-or-s? If it is Any, 
then it cannot be called like a function after the continuation is set to it. 
So basically my question is how can we type annotate different types of 
continuations starting from a simple one like the above? Also a pointer to the 
relevant section in typed racket docs would be great.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Error message from GUI

2016-08-29 Thread Dmitry Pavlov

Hello,

Sorry for dropping out of the conversation for a while.

Here is the smallest example that I could produce:

#lang racket

(require racket/gui
 racket/draw
 table-panel)

(define test%
  (class
  table-panel% (super-new (dimensions '(1 1)))
  ;vertical-panel% (super-new)
  ;horizontal-panel% (super-new)

(define vpanel
  (new vertical-panel%
   (parent this)
   (border 0)
   (style '(vscroll))
   ;(min-height 1)
   ))

(for ((i (in-range 10)))
  (new button%
   (parent vpanel)
   (label (format "Button ~a" i))
   ))
))


(define frame
  (instantiate frame% ("Test")))

(void (new test% (parent frame)))

(send frame resize 200 200)
(send frame show #t)


On Windows, it results into:
..\..\Program 
Files\Racket\share\pkgs\draw-lib\racket\draw\private\syntax.rkt:252:13: 
initialization for bitmap%: bad argument combination: 192 0 #f #t 1.0


On Linux, it works, although the vertical panel ends up with a small 
visible size.


If I specify a min-height at least one to the vertical  panel, the error 
is gone, and the panel is the size of the window.
If I use vertical-panel% or horizontal-panel% instead of table-panel%, 
the error is gone, and the panel is the size of the window.


So the problem here is that table-panel% handles its children in a 
certain way, and that the height of the scrollable panel ends up zero.


I did not write table-panel. I currently do not know whether a fix 
should be done in table-panel or gui-lib.


In my program, (min-height 1) helps, so I can live with the way it is now.

Best regards,

Dmitry




On 07/30/2016 12:44 AM, Vincent St-Amour wrote:

Should this change be added to gui-lib?

Vincent


On Fri, 29 Jul 2016 10:08:46 -0500,
Dmitry Pavlov wrote:

Matthew,

Yes that works, thank!

Also I figured why the message did not show up on my "first" WinXP
installation: the spreadsheet-editor package has not been updated there.
Newer version of spreadsheet-editor sets (style '(hide-vscroll)) and
(style '(hide-hscroll)) to panels with row and column buttons.

Styles cause the error. Changing styles to just '(hscroll) and
'(vscroll) does not remove the error.
Anyway, I need those (hide-vscroll) and (hide-hscroll), so I am going to
use the patch you proposed, unless there is a more elegant solution I am
unaware of.

(Another question is why there is a stack trace in 32-bit Windows and
just a message in 64-bit Windows, but that is of purely theoretical
importance to me.)

Best regards,

Dmitry


On 07/29/2016 05:25 PM, Matthew Flatt wrote:

It may be that a guard against a 0-sized drawing dimension is needed.
The right place for the guard might be in the `get-cr` method of

   gui-lib/mred/private/wx/common/backing-dc.rkt

after `get-backing-size` is called. A zero dimension could be just
increased to 1 before passing it to `get-backing-bitmap`. Can you try
making that change to see if it solves the problem on your machine?

At Fri, 29 Jul 2016 17:08:42 +0300, Dmitry Pavlov wrote:

Jens,

Oddly, another installation of Racket 6.6 on 32-bit Windows XP not only
reproduced the error, but also gave a stack trace:

initialization for bitmap%: bad argument combination: 495 0 #f #t 1.25
 context...:
  C:\Program
Files\Racket\share\pkgs\draw-lib\racket\draw\private\syntax.rkt:252:13: next
  C:\Program
Files\Racket\share\pkgs\draw-lib\racket\draw\private\bitmap.rkt:156:2
  C:\Program
Files\Racket\collects\racket\private\class-internal.rkt:3553:0:
continue-make-object
  C:\Program
Files\Racket\collects\racket\private\class-internal.rkt:3507:0:
do-make-object
  C:\Program
Files\Racket\share\pkgs\gui-lib\mred\private\wx\common\backing-dc.rkt:122:4:
get-cr method in backing-dc%
  C:\Program
Files\Racket\share\pkgs\gui-lib\mred\private\wx\common\canvas-mixin.rkt:144:4:
do-on-paint method in ...mon/canvas-mixin.rkt:118:2
  C:\Program
Files\Racket\share\pkgs\gui-lib\mred\private\wx\common\queue.rkt:454:6
  C:\Program
Files\Racket\share\pkgs\gui-lib\mred\private\wx\common\queue.rkt:505:32
  C:\Program
Files\Racket\share\pkgs\gui-lib\mred\private\wx\common\queue.rkt:653:3

bitmap.rkt confirms your hypothesis that the first number is the width,
and the second number is the height, and they both must be positive.

  [([exact-positive-integer? w]
[exact-positive-integer? h]
[any? [b? #f]]
[any? [alpha? #f]]
[positive-real? [scale 1.0]])

The width is not specified exactly in the app. I do not know why the
height is zero. I do not use bitmaps directly, just controls and canvas.
I will go with trial and error to get a small reproducible example.

Regards,

Dmitry


On 07/28/2016 11:50 PM, Jens Axel Søgaard wrote:

Just a hunch: If 486 is a width - then the 0 could be a problematic
height?

Do you recognize the number 486?

/Jens Axel


2016-07-28 22:29 GMT+02:00