Re: [racket-users] Scrolling problem in DrRacket with high pictures in slideshow

2017-08-11 Thread Robby Findler
Ah, I didn't realize they weren't even there. :)

Probably the right thing is to override the default behavior in a
pict-snip-specific way.

Robby


On Fri, Aug 11, 2017 at 10:53 AM, Laurent  wrote:
> Thanks Robby.
>
> I suppose this is the class in question:
> https://github.com/racket/pict-snip/blob/master/pict-snip-lib/pict/snip.rkt
>
> though there is not mention to "scroll". Could the problem lie in the more
> general snip% then?
>
> On Fri, Aug 11, 2017 at 2:05 PM, Robby Findler 
> wrote:
>>
>> My guess would be that the problem lies with the pict-snip% class and
>> how it implements the methods with the word "scroll" in their name.
>>
>> Robby
>>
>>
>> On Fri, Aug 11, 2017 at 7:58 AM, Laurent  wrote:
>> > Hi all,
>> >
>> > After running the following program in DrRacket on Ubuntu I can't use
>> > the
>> > scrollbar to see the text at the bottom (increase 1000 so that the text
>> > does
>> > not appear on the first page of the interactions).
>> >
>> > #lang racket
>> > (require slideshow)
>> >
>> > (vl-append (rectangle 10 1000)
>> >(t "Can you see me?"))
>> >
>> > Anyone knows a simple way to solve this?
>> >
>> > Thanks!
>> > Laurent
>> >
>> > --
>> > 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.


Re: [racket-users] Scrolling problem in DrRacket with high pictures in slideshow

2017-08-11 Thread Laurent
Thanks Robby.

I suppose this is the class in question:
https://github.com/racket/pict-snip/blob/master/pict-snip-lib/pict/snip.rkt

though there is not mention to "scroll". Could the problem lie in the more
general snip% then?

On Fri, Aug 11, 2017 at 2:05 PM, Robby Findler 
wrote:

> My guess would be that the problem lies with the pict-snip% class and
> how it implements the methods with the word "scroll" in their name.
>
> Robby
>
>
> On Fri, Aug 11, 2017 at 7:58 AM, Laurent  wrote:
> > Hi all,
> >
> > After running the following program in DrRacket on Ubuntu I can't use the
> > scrollbar to see the text at the bottom (increase 1000 so that the text
> does
> > not appear on the first page of the interactions).
> >
> > #lang racket
> > (require slideshow)
> >
> > (vl-append (rectangle 10 1000)
> >(t "Can you see me?"))
> >
> > Anyone knows a simple way to solve this?
> >
> > Thanks!
> > Laurent
> >
> > --
> > 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.


Re: [racket-users] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Martin Janiczek
Damn, you're right:

---

martin@janiczek ~ $ cat test.rkt
#lang racket

(parameterize ([read-accept-bar-quote #f])
  (let* ([input "(|| a b)"]
 [result (read (open-input-string input))])
(begin
  (println result)
  (println (first result))
  (println (symbol? (first result))


martin@janiczek ~ $ racket test.rkt
'(|| a b)
'||
#t

martin@janiczek ~ $

---

I don't know what I did wrong before. Thank you!

On Friday, August 11, 2017 at 3:26:20 PM UTC+2, Matthew Flatt wrote:
> Setting `read-accept-bar-quote` to #f should do what you want. Can you
> say more about how you tried to use it --- maybe providing a program
> that doesn't behave the way you expect?
> 
> At Fri, 11 Aug 2017 00:46:17 -0700 (PDT), Martin Janiczek wrote:
> > Hello everybody,
> > 
> > is there a way to tell the `(read)` function not to interpret `|` as an 
> > "copy 
> > this verbatim" delimiter?
> > 
> > What I want to do is:
> > (read "(|| a b)") ;=> '(|| a b)
> > (read "(<| a b)") ;=> '(<| a b)
> > etc. - allow `|` as a symbol.
> > 
> > I know about readtables - dabbled with them before and they seem like the 
> > right tool for the job. But in this case, my last attempt was:
> > 
> > (make-readtable (current-readtable)
> >   #\|
> >   'terminating-macro
> >   read-as-symbol)
> > 
> > and I couldn't get the `read-as-symbol` function right. Also experimented 
> > with 
> > `read-accept-bar-quote` parameter but no dice.
> > 
> > Any help/pointers?

-- 
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] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Matthew Flatt
Setting `read-accept-bar-quote` to #f should do what you want. Can you
say more about how you tried to use it --- maybe providing a program
that doesn't behave the way you expect?

At Fri, 11 Aug 2017 00:46:17 -0700 (PDT), Martin Janiczek wrote:
> Hello everybody,
> 
> is there a way to tell the `(read)` function not to interpret `|` as an "copy 
> this verbatim" delimiter?
> 
> What I want to do is:
> (read "(|| a b)") ;=> '(|| a b)
> (read "(<| a b)") ;=> '(<| a b)
> etc. - allow `|` as a symbol.
> 
> I know about readtables - dabbled with them before and they seem like the 
> right tool for the job. But in this case, my last attempt was:
> 
> (make-readtable (current-readtable)
>   #\|
>   'terminating-macro
>   read-as-symbol)
> 
> and I couldn't get the `read-as-symbol` function right. Also experimented 
> with 
> `read-accept-bar-quote` parameter but no dice.
> 
> Any help/pointers?

-- 
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] Scrolling problem in DrRacket with high pictures in slideshow

2017-08-11 Thread Robby Findler
My guess would be that the problem lies with the pict-snip% class and
how it implements the methods with the word "scroll" in their name.

Robby


On Fri, Aug 11, 2017 at 7:58 AM, Laurent  wrote:
> Hi all,
>
> After running the following program in DrRacket on Ubuntu I can't use the
> scrollbar to see the text at the bottom (increase 1000 so that the text does
> not appear on the first page of the interactions).
>
> #lang racket
> (require slideshow)
>
> (vl-append (rectangle 10 1000)
>(t "Can you see me?"))
>
> Anyone knows a simple way to solve this?
>
> Thanks!
> Laurent
>
> --
> 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] Scrolling problem in DrRacket with high pictures in slideshow

2017-08-11 Thread Laurent
Hi all,

After running the following program in DrRacket on Ubuntu I can't use the
scrollbar to see the text at the bottom (increase 1000 so that the text
does not appear on the first page of the interactions).

#lang racket
(require slideshow)

(vl-append (rectangle 10 1000)
   (t "Can you see me?"))

Anyone knows a simple way to solve this?

Thanks!
Laurent

-- 
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] A bug in the Typed Racket system?

2017-08-11 Thread Sourav Datta
Thanks for the clarification.

On 09-Aug-2017 3:29 AM, "Sam Tobin-Hochstadt"  wrote:

> The reason that Typed Racket chooses the istantiation `Nothing` here
> is that because `a` is used in both a positive and negative position
> (both as an input and an output) in the type of the `val` field,
> there's no way to pick a "best" choice for `a`. `(Foo Integer)` is not
> a subtype of `(Foo Any)`, for example. Furthermore, whatever Typed
> Racket chooses for `a`, the function application will type check.
> Typed Racket therefore picks the smallest type that works, which is
> `Nothing`.
>
> This actually tells you more about your second program -- in
> particular, you can't ever call the `val` function from the `(Foo a)`,
> because you can't construct a value of type `a`.
>
> Sam
>
> On Fri, Jul 21, 2017 at 1:40 PM, Sourav Datta 
> wrote:
> > On Friday, July 21, 2017 at 9:06:16 PM UTC+5:30, Ben Greenman wrote:
> >> Type inference is failing you again.
> >
> > Yes, well, that seems to be a common theme whenever I hover around the
> these type of areas which are uncommon but works perfectly fine in untyped
> Racket.
> >
> >>
> >>
> >> If you instantiate `foo/s`, you get the type you expect:
> >>
> >>
> >>
> >> #lang typed/racket
> >>
> >>
> >> (struct (a) Foo ([val : (-> a a)]))
> >>
> >>
> >> (: foo/s (All (a b)
> >>   (-> (-> a b)
> >>   (-> (Foo a)
> >>   (Foo b)
> >>   (Foo b)
> >> (define (foo/s f)
> >>   (λ ([f1 : (Foo a)]
> >>   [f2 : (Foo b)])
> >> f2))
> >>
> >>
> >>
> >>
> >> (define r1 (#{foo/s @ Integer String} (λ ([x : Integer]) (format "~a"
> x
> >>
> >> ;> r1
> >> ;- : (-> (Foo Integer) (Foo String) (Foo String))
> >
> > Yes, that works fine. For my personal use it is good enough, but
> exporting that function as a library would require every user to annotate
> the type whenever they want to call it, even for very simple types - which
> is not a very good experience for a typed language.
> >
> >>
> >>
> >>
> >>
> >> I wouldn't call this a bug, but it's definitely a program that a better
> type inferencer should accept.
> >
> > In other cases where type inference fails, the compiler bails out with
> an error (even though that is a confusing one like `expected: (Seq a)
> given: (Seq Integer)`). But here:
> >
> > 1. The inference did not fail but assumed it's Nothing just because I
> changed the function signature from (-> a) to (-> a a). I can't understand
> why the inference fails for this change. And on top of this,
> >
> > 2. The function type is clearly specified as (-> (Foo a) (Foo b) (Foo
> b)) and it can unify a = Integer, b = String, from the first argument
> alone. So, even though a is Integer, it still produces a = Nothing, without
> a compile error. Integer =/= Nothing. Seems very close to a bug in the type
> deduction algorithm.
> >
> >
> >>
> >>
> >> On Fri, Jul 21, 2017 at 5:19 AM, Sourav Datta 
> wrote:
> >> Consider this program,
> >>
> >>
> >>
> >> #lang typed/racket
> >>
> >>
> >>
> >> (struct (a) Foo ([val : (-> a)]))
> >>
> >>
> >>
> >> (: foo/s (All (a b)
> >>
> >>   (-> (-> a b)
> >>
> >>   (-> (Foo a)
> >>
> >>   (Foo b)
> >>
> >>   (Foo b)
> >>
> >> (define (foo/s f)
> >>
> >>   (λ ([f1 : (Foo a)]
> >>
> >>   [f2 : (Foo b)])
> >>
> >> f2))
> >>
> >>
> >>
> >>
> >>
> >> (define r1 (foo/s (λ ([x : Integer]) (format "~a" x
> >>
> >>
> >>
> >> The type of r1 is correctly deduced as:
> >>
> >>
> >>
> >> - : (-> (Foo Integer) (Foo String) (Foo String))
> >>
> >> #
> >>
> >>
> >>
> >> However, if I slightly change the struct Foo and do the same, like this:
> >>
> >>
> >>
> >> #lang typed/racket
> >>
> >>
> >>
> >> (struct (a) Foo ([val : (-> a a)]))
> >>
> >>
> >>
> >> (: foo/s (All (a b)
> >>
> >>   (-> (-> a b)
> >>
> >>   (-> (Foo a)
> >>
> >>   (Foo b)
> >>
> >>   (Foo b)
> >>
> >> (define (foo/s f)
> >>
> >>   (λ ([f1 : (Foo a)]
> >>
> >>   [f2 : (Foo b)])
> >>
> >> f2))
> >>
> >>
> >>
> >>
> >>
> >> (define r1 (foo/s (λ ([x : Integer]) (format "~a" x
> >>
> >>
> >>
> >> Now, r1 has this type:
> >>
> >>
> >>
> >> - : (-> (Foo Nothing) (Foo String) (Foo String))
> >>
> >> #
> >>
> >>
> >>
> >> Surprisingly (Foo Integer) has changed to (Foo Nothing)! Is this a
> possible bug in the type system? Or, may be I'm missing something?
> >>
> >>
> >>
> >> 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...@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] Readtable - allowing pipes (bars) in operator

2017-08-11 Thread Martin Janiczek
Hello everybody,

is there a way to tell the `(read)` function not to interpret `|` as an "copy 
this verbatim" delimiter?

What I want to do is:
(read "(|| a b)") ;=> '(|| a b)
(read "(<| a b)") ;=> '(<| a b)
etc. - allow `|` as a symbol.

I know about readtables - dabbled with them before and they seem like the right 
tool for the job. But in this case, my last attempt was:

(make-readtable (current-readtable)
  #\|
  'terminating-macro
  read-as-symbol)

and I couldn't get the `read-as-symbol` function right. Also experimented with 
`read-accept-bar-quote` parameter but no dice.

Any help/pointers?

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