Re: [racket] Primitive scheme -> racket namespace converter

2010-06-10 Thread Stephen Chang
This doesn't seem to do the replacement when the language is just #lang scheme.




On Thu, Jun 10, 2010 at 11:28 PM, synx  wrote:
> Yeah I went there. I tested it on a directory full of .ss files and it
> worked, but as you can see I resort to rather crude hacks involving my
> complete lack of understanding how to write syntax to file, never mind
> preserving line breaks and whitespace. I think it loses comments too, so
> still needs a lot of work. I dunno about line-based comments... there
> should be a comment form like quote except it doesn't go into compiled
> code or...something.
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket-users] eq? behavior changed on Racket CS?

2021-05-20 Thread Stephen Chang
Hi everyone, Has eq? behavior changed with Racket CS? (ie, 8.0+)

Specifically:

$ racket79/bin/racket
Welcome to Racket v7.9 [bc].
> (eq? (integer->char 955) (integer->char 955))
#f

$ plt/racket/bin/racket
Welcome to Racket v8.1.0.6 [cs].
> (eq? (integer->char 955) (integer->char 955))
#t

Is this expected behavior?

(I know this has probably been addressed and I wasn't paying
attention, but I did a quick search of the list and docs and couldnt
find anything, so just want to double check. Thanks!)

Steve

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1LQw_ECHrgRN%3DfrK9H%2BE8kSFFEqdShqSdvXXmfCmcB0Eg%40mail.gmail.com.


[racket-users] how to convert encoded path to something build-path can use?

2021-05-21 Thread Stephen Chang
Hi,

It seems that, since 8.1, the format of paths in links.rktd has changed?

Are there new API fns that deal with this new kind of encoded path? Or
what is the recommended way to process them?

Something like this? (Is this `decode-link-path` public? I couldnt find it)
https://github.com/racket/racket/commit/2ac7e21ad422ee322daa4a7e0db318f9b72b6c48#diff-51453f6da842dc20af8fe776f54ec99dd15f4f8b7e9e73cd5d45cdeb96e40ef6R49-R52

I used to pass the paths directly to `build-path` but now it no longer
works. Here's an example error:

build-path: contract violation
  expected: (or/c path-string? path-for-some-system? 'up 'same)
  given: '(up up #"pkgs" #"racket-lib")

Any recommendations would be appreciated. Thanks!
Steve

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1J%3DZ%2BoKNi1-OP7YmRYyttNSamBaHxsMZntd9mxOJCKJGA%40mail.gmail.com.


Re: [racket-users] how to convert encoded path to something build-path can use?

2021-05-21 Thread Stephen Chang
Thanks!

We were previously manually processing the files from
current-library-collection-links, but using `links` saves ~100 lines
of code.

On Fri, May 21, 2021 at 11:50 AM Matthew Flatt  wrote:
>
> Yes, the format changed in that commit.
>
> The `decode-link-path` function is not meant to be public, although it
> could be exposed. But for an approach that works now and with older
> versions, the API you want is `links` from `setup/link`, possibly like
> this:
>
>   (links #:file (find-links-file) #:with-path? #t)
>   (links #:file (find-links-file) #:root? #t)
>
>
> At Fri, 21 May 2021 11:33:41 -0400, Stephen Chang wrote:
> > Hi,
> >
> > It seems that, since 8.1, the format of paths in links.rktd has changed?
> >
> > Are there new API fns that deal with this new kind of encoded path? Or
> > what is the recommended way to process them?
> >
> > Something like this? (Is this `decode-link-path` public? I couldnt find it)
> > https://github.com/racket/racket/commit/2ac7e21ad422ee322daa4a7e0db318f9b72b6c48
> > #diff-51453f6da842dc20af8fe776f54ec99dd15f4f8b7e9e73cd5d45cdeb96e40ef6R49-R52
> >
> > I used to pass the paths directly to `build-path` but now it no longer
> > works. Here's an example error:
> >
> > build-path: contract violation
> >   expected: (or/c path-string? path-for-some-system? 'up 'same)
> >   given: '(up up #"pkgs" #"racket-lib")
> >
> > Any recommendations would be appreciated. Thanks!
> > Steve
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/20210521095016.3e9%40sirmail.smtps.cs.utah.edu.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1Jf2po6sYq2dDqv-eVHiFFYDSzUpxj_kKJnjQEYqobNqw%40mail.gmail.com.


Re: [racket-users] Why does syntax-parser work here but not syntax-parse?

2021-09-08 Thread Stephen Chang
> shouldn't the entire parenthesized expression be given to the macro processor 
> and then replaced with something valid before being rejected?

That would be true if you're defining a macro, i.e. if you use
`define-syntax` instead of `define`.

>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAE8gKofDYFY8AYb2Lyh7CQXx1i01w8jm4DVcMrJL%3DQYHX9SsRQ%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1LxRJNCNHTi%2Bi8Tz2W4wtJ6_s%3D-2jXQfxyMi%3DHE9hQptg%40mail.gmail.com.


[racket-users] confusion about real vs not real zero

2021-11-19 Thread Stephen Chang
In the following, why is the first considered a real number but the
second considered not real

> (real? 0.0+0i)
#t
> (real? 0.0+0.0i)
#f

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1%2BYygGrLH2rtwby8AWg7Edyvq-tzmANTNypq5Rqd-eXFw%40mail.gmail.com.


Re: [racket-users] confusion about real vs not real zero

2021-11-19 Thread Stephen Chang
Lol I read that page and still didn't get it.

Any opinion for a potential workaround?

On Fri, Nov 19, 2021 at 3:08 PM Sorawee Porncharoenwase
 wrote:
>
> I had this exact same question when I looked at the RacketScript issue lol.
>
> The answer is https://docs.racket-lang.org/reference/numbers.html:
>
> a complex number with an exact zero imaginary part is a real number.
>
> Since 0.0 is not exact, 0.0i is not a real number.
>
> On Fri, Nov 19, 2021 at 11:59 AM Stephen Chang  wrote:
>>
>> In the following, why is the first considered a real number but the
>> second considered not real
>>
>> > (real? 0.0+0i)
>> #t
>> > (real? 0.0+0.0i)
>> #f
>>
>> --
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/CAFfiA1%2BYygGrLH2rtwby8AWg7Edyvq-tzmANTNypq5Rqd-eXFw%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1%2B3yRzzh%3DKhcOddt0geMezNsxQGHqzwGTYbZjLekUQ8kQ%40mail.gmail.com.


Re: [racket-users] confusion about real vs not real zero

2021-11-19 Thread Stephen Chang
Sorry, the "workaround" was in regard to complex numbers. How to
support them in a minimal way so that programs that dont use them are
not blocked by lack of full support.

On Fri, Nov 19, 2021 at 3:20 PM Sam Tobin-Hochstadt  wrote:
>
> On Fri, Nov 19, 2021 at 3:13 PM Stephen Chang  wrote:
> >
> > Lol I read that page and still didn't get it.
> >
> > Any opinion for a potential workaround?
>
> It depends what you mean by "workaround". The distinction between
> exact and inexact numbers is pretty deeply built-in to how Racket
> numbers work, so there's not going to be a simple workaround that
> fixes this issue.
>
> For RacketScript I think the choices are (a) use floats for everything
> and have semantics that diverge substantially from Racket or (b) have
> a separate implementation of integers that's not JS numbers (maybe JS
> bigints would work).
>
> Sam
>
> >
> > On Fri, Nov 19, 2021 at 3:08 PM Sorawee Porncharoenwase
> >  wrote:
> > >
> > > I had this exact same question when I looked at the RacketScript issue 
> > > lol.
> > >
> > > The answer is https://docs.racket-lang.org/reference/numbers.html:
> > >
> > > a complex number with an exact zero imaginary part is a real number.
> > >
> > > Since 0.0 is not exact, 0.0i is not a real number.
> > >
> > > On Fri, Nov 19, 2021 at 11:59 AM Stephen Chang  
> > > wrote:
> > >>
> > >> In the following, why is the first considered a real number but the
> > >> second considered not real
> > >>
> > >> > (real? 0.0+0i)
> > >> #t
> > >> > (real? 0.0+0.0i)
> > >> #f
> > >>
> > >> --
> > >> 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.
> > >> To view this discussion on the web visit 
> > >> https://groups.google.com/d/msgid/racket-users/CAFfiA1%2BYygGrLH2rtwby8AWg7Edyvq-tzmANTNypq5Rqd-eXFw%40mail.gmail.com.
> >
> > --
> > 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/CAFfiA1%2B3yRzzh%3DKhcOddt0geMezNsxQGHqzwGTYbZjLekUQ8kQ%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1%2BT7LQ22WibP7XEt%2BBWxY1R2iH-LoDeOjO2vJgQuhnVJg%40mail.gmail.com.


Re: [racket-users] confusion about real vs not real zero

2021-11-19 Thread Stephen Chang
I dont want to fully support complex numbers. I just want to do the
minimum so that programs that dont use them are not blocked by the
lack of support

On Fri, Nov 19, 2021 at 3:30 PM Sorawee Porncharoenwase
 wrote:
>
> Yeah, I was about to reply that I don't think there's a workaround, too.
>
> What is your goal, though? Do you intend to support complex numbers properly 
> right now? In particular, that problematic code is random generation from 
> contracts, which is rarely invoked anyway. Intuitively, there's no reason why 
> the complex number feature is required to get the code running.
>
> So one potential solution is to not support complex numbers right now, and 
> compile all complex number literals to a JS expression that throws an 
> exception at runtime.
>
>
>
> On Fri, Nov 19, 2021 at 12:20 PM Sam Tobin-Hochstadt  
> wrote:
>>
>> On Fri, Nov 19, 2021 at 3:13 PM Stephen Chang  wrote:
>> >
>> > Lol I read that page and still didn't get it.
>> >
>> > Any opinion for a potential workaround?
>>
>> It depends what you mean by "workaround". The distinction between
>> exact and inexact numbers is pretty deeply built-in to how Racket
>> numbers work, so there's not going to be a simple workaround that
>> fixes this issue.
>>
>> For RacketScript I think the choices are (a) use floats for everything
>> and have semantics that diverge substantially from Racket or (b) have
>> a separate implementation of integers that's not JS numbers (maybe JS
>> bigints would work).
>>
>> Sam
>>
>> >
>> > On Fri, Nov 19, 2021 at 3:08 PM Sorawee Porncharoenwase
>> >  wrote:
>> > >
>> > > I had this exact same question when I looked at the RacketScript issue 
>> > > lol.
>> > >
>> > > The answer is https://docs.racket-lang.org/reference/numbers.html:
>> > >
>> > > a complex number with an exact zero imaginary part is a real number.
>> > >
>> > > Since 0.0 is not exact, 0.0i is not a real number.
>> > >
>> > > On Fri, Nov 19, 2021 at 11:59 AM Stephen Chang  
>> > > wrote:
>> > >>
>> > >> In the following, why is the first considered a real number but the
>> > >> second considered not real
>> > >>
>> > >> > (real? 0.0+0i)
>> > >> #t
>> > >> > (real? 0.0+0.0i)
>> > >> #f
>> > >>
>> > >> --
>> > >> 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.
>> > >> To view this discussion on the web visit 
>> > >> https://groups.google.com/d/msgid/racket-users/CAFfiA1%2BYygGrLH2rtwby8AWg7Edyvq-tzmANTNypq5Rqd-eXFw%40mail.gmail.com.
>> >
>> > --
>> > 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.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/racket-users/CAFfiA1%2B3yRzzh%3DKhcOddt0geMezNsxQGHqzwGTYbZjLekUQ8kQ%40mail.gmail.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1K-pso_eyGDJ98UFfi1GjPHUoxvPkM_7CZ-L5WerV6g2g%40mail.gmail.com.


Re: [racket] About bug reporting

2011-09-09 Thread Stephen Chang
It looks like it has been received but not assigned yet. The beginning
of the school year tends to be a busier time for most, so it may take
slightly longer for bugs to get fixed.

You can track the status of your bug report here:

http://bugs.racket-lang.org/query/?cmd=view&pr=12149





On Fri, Sep 9, 2011 at 4:58 PM, Eddie Rucker  wrote:
> Hello,
>
> I sent a list-box% bug to b...@racket-lang.org on August 31. Since I haven't 
> gotten a response, I just wondered if you got the report, or I did something 
> incorrectly, or you guys haven't gotten to it yet? If you haven't gotten to 
> it yet, I promise to be more patient.
>
> Eddie Rucker
>
> Director of Institutional Research
> Blue Mountain College
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Unable to use Step in Dr. Racket

2011-09-15 Thread Stephen Chang
I can't duplicate the problem with 5.1.3. Which exact installer did
you use, because I dont see an x86 64bit installer for ubuntu? I used
racket-5.1.3-bin-i386-linux-ubuntu-jaunty.sh



On Thu, Sep 15, 2011 at 2:50 AM, Anirudh Sanjeev  wrote:
> Hi,
>
> I am new to scheme. I am trying to run small programs from SICP on Dr. Racket.
>
> This is my code:
> (define (factorial n)
>  (if (= n 1) 1
>      (* n (factorial (- n 1)
>
> (factorial 5)
>
> It runs fine. When I click the "Step" Button, I get an error like this:
>
> sequence-contract-violation: negative: method insert cannot be called,
> except in states (unlocked), args ")" 408
>
>  === context ===
> /usr/local/lib/racket/collects/mred/private/snipfile.rkt:256:6: flush-text
> /usr/local/lib/racket/collects/mred/private/snipfile.rkt:279:9
> /usr/local/lib/racket/collects/mzlib/private/port.rkt:53:7
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:1210:9: loop
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:1210:9: loop
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:1210:9: loop
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:1210:9: loop
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:1210:9: loop
> /usr/local/lib/racket/collects/racket/pretty.rkt:978:7: pr
> /usr/local/lib/racket/collects/racket/pretty.rkt:422:3: generic-write
> /usr/local/lib/racket/collects/racket/pretty.rkt:234:18
> ...
>
> Information:
> Dr. Racket 5.1.3 using the latest x86_64 installer on Ubuntu 11.04 64
> bit, with the "beginning student" language pack.
>
> I tried it on a Windows Machine and it works beautifully. Please let
> me know how I can re-install it to work properly on my linux machine.
>
> Thank you,
> Anirudh
>
> --
> http://skyronic.com
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] list->values

2011-09-17 Thread Stephen Chang
>> Is there a function that converts a list into a values expression which
>> contains every element of the list?

> (apply values (list 1 2 3))
1
2
3



>> I've run into a bit of trouble trying to
>> implement something like it myself, and it's probably because I don't
>> understand exactly how values is used (or supposed to be used).
>> My use case is essentially to make my web-server templating code shorter by
>> using let*-values and calling a lookup table to return a bunch of strings
>> corresponding to which page I want to serve.
>> Jeremy
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] list in Beginning Student

2011-09-30 Thread Stephen Chang
Seems like it's been there since the beginning:

http://download.plt-scheme.org/doc/200/html/beginning/list.html



On Fri, Sep 30, 2011 at 5:47 PM, Prabhakar Ragde  wrote:
> When did `list' sneak its way into Beginning Student (without List
> Abbreviations)? Or has it always been there, and I have always been just
> clueless? Thanks. --PR
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] list in Beginning Student

2011-09-30 Thread Stephen Chang
Yah but when did the "beginner-abbr" language come into existence? I
didnt see it in any previous versions:

http://download.plt-scheme.org/doc/103p1/html/




On Fri, Sep 30, 2011 at 6:00 PM, Robby Findler
 wrote:
> That's 200 versions in! :)
>
> Robby
>
> On Fri, Sep 30, 2011 at 4:58 PM, Stephen Chang  wrote:
>> Seems like it's been there since the beginning:
>>
>> http://download.plt-scheme.org/doc/200/html/beginning/list.html
>>
>>
>>
>> On Fri, Sep 30, 2011 at 5:47 PM, Prabhakar Ragde  
>> wrote:
>>> When did `list' sneak its way into Beginning Student (without List
>>> Abbreviations)? Or has it always been there, and I have always been just
>>> clueless? Thanks. --PR
>>> _
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/users
>>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket] Racket: A language worth checking out

2011-10-07 Thread Stephen Chang
I've never heard of this site and I realize the article is 3 years
old, but this was tweeted by Hacker News today:

http://www.h3rald.com/articles/10-programming-languages/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] lazy racket

2011-11-14 Thread Stephen Chang
The problem is that only applications are wrapped with the
toplevel-forcer. (And you don't actually need !!. Just the regular !
should be sufficient.)

For a short term solution, if you select Lazy Racket in the language
menu instead of #lang lazy, it will do what you want, due to a
subtlety in the way languages are implemented. Lazy Racket when
selected in the menu is implemented as a "tool", so top level
variables are wrapped with #%top, which gets forced. #lang languages
are module languages and module level variables have no such wrapping.

ps racket-dev, should the #%top from lazy racket be removed?




On Mon, Nov 14, 2011 at 2:53 PM, Eric Tanter  wrote:
> Hi,
>
> I'd like to tweak Lazy Racket such that the top-level interactions in the 
> REPL always use `!!' (recursive force), in order to mimic Haskell's behavior 
> as close as possible.
>
> If someone can help me in the very brief term, I would really appreciate it 
> (I plan to start teaching on laziness using Lazy Racket tomorrow).
>
> Thanks in advance!
>
> -- Éric
>
> PS: Eli told me of some parameter that controls this behavior. I think it is 
> `toplevel-forcer', but a) I'm not sure, b) even if I hack it manually (edit 
> lazy.rkt), it does not work:
>
> ;; parameter is properly set to `!!'
>> (toplevel-forcer)
> #
>
>> ones
> #
>
>> (!! ones)
> #0='(1 . #0#)
>
> I'd like the following behavior:
>> ones
> #0='(1 . #0#)
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] lazy racket

2011-11-14 Thread Stephen Chang
On Mon, Nov 14, 2011 at 5:04 PM, Eric Tanter  wrote:
> Thanks for the input.
> I tried with Lazy Racket in the language menu instead of #lang, but it does 
> not really do what I want (ie. Haskell).
> Actually, apart from the fact that things are printed differently, the result 
> is quite the same:
>
>> ones
> (cons 1 (delay ...))
>
> ;; ! is not enough
>> (! ones)
> (cons 1 (delay ...))
>
>> (!! ones)
> (shared ((-0- (cons 1 -0-))) -0-)

The behavior is a little different in that one level of the cons is
forced. You can change the output style in the "Details" section of
the language menu. If you want to emulate Haskell does that mean you
want an infinite loop? You can use !!list for that.
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Find and Replace pane in DrRacket

2011-11-16 Thread Stephen Chang
I don't disagree with your request, but something to know that might
alleviate the problem is that drracket remembers the state of the
replace search box. So you only need to enable the replace box once,
and it will always appear automatically on subsequent clicks of
"find".



On Tue, Nov 15, 2011 at 8:33 PM, Harry Spier  wrote:
> In DrRacket the "Replace" menu item is disabled until the "Find" menu item
> is selected which then brings up the pane to both "Find" and "Replace"..  Is
> there some reason why its set up this way so I can't just click the
> "replace" menu to bring up the "find and replace" pane  without first having
> to click on the "find" menu item.
> Harry Spier
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Google Challenge

2011-11-26 Thread Stephen Chang
I ported the python starter package to Racket and submitted a pull
request. I also inquired about what needs to be done so people can
submit their Racket bots to the actual server, so hopefully people
will be able to use Racket in the contest soon.

For now, you can access my starter package here:

https://github.com/stchang/aichallenge/tree/epsilon/ants/dist/starter_bots/racket





On Wed, Nov 23, 2011 at 9:43 AM, Matthias Felleisen
 wrote:
>
> On Nov 23, 2011, at 9:39 AM, Sam Tobin-Hochstadt wrote:
>
>> Here's the overview and existing starter packages:
>> http://aichallenge.org/starter_packages.php
>> There's a faq that talks about it here: http://aichallenge.org/faq.php
>> Here's the guide to creating starter packages:
>
>
> I found all those of course. It's the last link I was looking for.
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Google Challenge

2011-11-29 Thread Stephen Chang
Racket is now installed on the game servers, so you can upload your
Racket bots. Also, you can get the Racket starter package here:
http://aichallenge.org/starter_packages.php



On Sat, Nov 26, 2011 at 4:45 PM, Stephen Chang  wrote:
> I ported the python starter package to Racket and submitted a pull
> request. I also inquired about what needs to be done so people can
> submit their Racket bots to the actual server, so hopefully people
> will be able to use Racket in the contest soon.
>
> For now, you can access my starter package here:
>
> https://github.com/stchang/aichallenge/tree/epsilon/ants/dist/starter_bots/racket
>
>
>
>
>
> On Wed, Nov 23, 2011 at 9:43 AM, Matthias Felleisen
>  wrote:
>>
>> On Nov 23, 2011, at 9:39 AM, Sam Tobin-Hochstadt wrote:
>>
>>> Here's the overview and existing starter packages:
>>> http://aichallenge.org/starter_packages.php
>>> There's a faq that talks about it here: http://aichallenge.org/faq.php
>>> Here's the guide to creating starter packages:
>>
>>
>> I found all those of course. It's the last link I was looking for.
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] How can I comfigure drracket to be Emacs styles?

2011-12-15 Thread Stephen Chang
In DrRacket, Edit -> Preferences -> Editing -> General, uncheck "Enable
keybindings in menus"

This should give you most of the common emacs key bindings.


On Wed, Dec 14, 2011 at 8:07 AM, mahaitao  wrote:

> **
> I often use emacs for other editing works beside writing racket programs.
> *The question is how can I configure it to be emacs editing style such
> as, Ctrl+n means
> move to next line and so on.
>
> Best regards
>
> mht
> *
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] W: A Game Written in Racket

2011-12-20 Thread Stephen Chang
Cool game. I couldnt figure out what to do on the floor puzzle room either.


On Tue, Dec 20, 2011 at 9:00 PM, Thom Chiovoloni  wrote:
> Yes, thats the last level.  As I mentioned, it is a pretty short game right
> now haha.
>
> -Thom
>
> On Tue, Dec 20, 2011 at 8:07 PM, Vincent St-Amour 
> wrote:
>>
>> At Tue, 20 Dec 2011 19:47:20 -0500,
>> Thom Chiovoloni wrote:
>> > Haha, the fourth is a hallway, so you probably mean the fifth, in which
>> > case you need to make all the floors the same.
>>
>> Right. I thought these two were together.
>>
>> I figured the floor puzzle, but can't go anywhere after that. Is that
>> the end of the game?
>>
>> Vincent
>
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Is the racket home page down for anyone else?

2012-02-13 Thread Stephen Chang
Works for me. I was just looking at the documentation.


On Mon, Feb 13, 2012 at 4:37 PM, Danny Yoo  wrote:
> I can't get to documentation or PLaneT at the moment.
> 
>  Racket Users list:
>  http://lists.racket-lang.org/users


  Racket Users list:
  http://lists.racket-lang.org/users


[racket] does render-term or term->pict work in a metafunction?

2012-03-14 Thread Stephen Chang
Is there a way in redex to convert an arbitrary term to a pict?


I have this language:

#lang racket
(require redex)

(define-language L
  (e (λ x e) (e e) x)
  (x variable-not-otherwise-mentioned))

(define-metafunction L
  [(x->pict x) ,(render-term L x #f)])


and (term (x->pict x)) and (term (x->pict y)) both return a pict of x
because render-term is a macro so x is treated as syntax and not as a
pattern variable. Is there a way in redex to do what what I want?


  Racket Users list:
  http://lists.racket-lang.org/users


Re: [racket] does render-term or term->pict work in a metafunction?

2012-03-14 Thread Stephen Chang
> What you have written suggests that
> you're writing a metafunction that returns a pict, which would mean
> that the terms in your language are being represented as Racket-level
> picts (instead of the usual Racket-level sexpressions).

Yes, that's what I'm trying to do. I want to convert an arbitrary term
to a pict, to use in slideshow.


> Anyways, if you want to render a term, you have to use lw->pict and
> to-lw. It is more complex than it needs to be.

I don't think this would work either, since to-lw is still a macro.

Something like:

(define-metafunction L
  [(x->pict x) ,(lw->pict (language-nts L) (to-lw x))])

still gives a pict of x for (term (x->pict y)).


To get what I want, I figured out I can do:

(define-metafunction L
  [(x->pict x) ,(text (symbol->string (term x)))])




> Also, if no one has pointed you there yet, the git head has a redex
> tutorial now that includes some typesetting. (You'll find more in the
> SEwPR book, which Matthias may have a copy to lend you.)
>
> Robby
>
> 2012/3/14 Stephen Chang :
>> Is there a way in redex to convert an arbitrary term to a pict?
>>
>>
>> I have this language:
>>
>> #lang racket
>> (require redex)
>>
>> (define-language L
>>  (e (λ x e) (e e) x)
>>  (x variable-not-otherwise-mentioned))
>>
>> (define-metafunction L
>>  [(x->pict x) ,(render-term L x #f)])
>>
>>
>> and (term (x->pict x)) and (term (x->pict y)) both return a pict of x
>> because render-term is a macro so x is treated as syntax and not as a
>> pattern variable. Is there a way in redex to do what what I want?
>>
>> 
>>  Racket Users list:
>>  http://lists.racket-lang.org/users


  Racket Users list:
  http://lists.racket-lang.org/users


Re: [racket] slideshow, footer

2012-04-13 Thread Stephen Chang
On Fri, Apr 13, 2012 at 3:48 PM, Geoffrey S. Knauth  wrote:
> Is there a standard way that people use to add a footer and/or image to each 
> slideshow slide?  I'm sure I can roll my own, but I was wondering if there 
> were examples in the wild so I don't reinvent the wheel.

current-slide-assembler can also do what you want:
http://docs.racket-lang.org/slideshow/Configuration.html?q=assembler#(def._((lib._slideshow/base..rkt)._current-slide-assembler))


Here's the example code from the tutorial (collects/slideshow/tutorial.rkt)

;; 
;; Background

;; A pict to use behind the main content
(define fade-bg
  (let ([w (+ (* 2 margin) client-w)]
[h (+ (* 2 margin) client-h)]
[trans (make-object brush% "white" 'transparent)]
[inside (make-object brush% "white" 'solid)])
(inset (dc (lambda (dc x y)
 (let ([b (send dc get-brush)]
   [p (send dc get-pen)]
   [draw-one
(lambda (i)
  (send dc draw-rectangle
(+ x i) (+ y i)
(- w (* 2 i)) (- h (* 2 i])
   (send dc set-brush trans)
   (color-series
dc margin 1
(make-object color% "black")
(make-object color% "white")
draw-one
#t #t)
   (send dc set-brush inside)
   (draw-one margin)
   (send dc set-pen p)
   (send dc set-brush b)))
   w h 0 0)
   (- margin

(define orig-assembler (current-slide-assembler))

;; Normally, you'd set the slide assembler at the beginning
;;  of a talk and never change it
(current-slide-assembler
 (lambda (s v-sep c)
   (lt-superimpose
fade-bg
(let ([c (colorize c "darkred")])
  (if s
  (vc-append v-sep
 ;; left-aligns the title:
 (para (titlet s))
 c)
  c)

(outline 'background)

(slide
 #:title "Controlling the Background"
 (para "The" (code current-slide-assembler)
"parameter lets you change the overall look of a slide")
 (para "For this slide and the previous one, the assembler")
 (item "Colorizes the uncolored content as dark red")
 (item "Left-aligns the title")
 (item "Draws a fading box around the slide"))

(current-slide-assembler orig-assembler)







>
> (I'm giving a CAP safety briefing tomorrow morning, and while I could do it 
> in PowerPoint, which is what everyone does, the briefing involves looking at 
> actual aviation maps and weather graphics real-time, which made me think of 
> Racket Slideshow.)
>
> Geoff
> 
>  Racket Users list:
>  http://lists.racket-lang.org/users


  Racket Users list:
  http://lists.racket-lang.org/users


[racket] read-language (was: How to associate a custom syntax color lexer with a new module language)

2012-06-22 Thread Stephen Chang
> FWIW, DrRacket calls read-language on a port containing the contents
> of the definitions window. Probably the call you're interested in is
> in drracket/private/module-language-tools.rkt. If you see exceptions
> being swallowed there, then probably I coudl add some logging code to
> help others avoid these problems in the future.

Tangentially related question. I have a drracket (definitions-text)
plugin that I only want active when the #lang is a specific language.
Is read-language the proper thing to use for this?

Is there an example somewhere of using read-language for this purpose?
I've been trying to figure out how to use the result from
read-language but I'm having trouble understanding the docs and the
examples I've found in collects only seem to test whether
read-language succeeded or not.



>
> Robby
>
> On Fri, Jun 22, 2012 at 9:24 AM, Jens Axel Søgaard
>  wrote:
>> That might be it. I thought that the get-info business avoided
>> the need of an info.rkt file.
>>
>> Thanks,
>> Jens Axel
>>
>>
>> 2012/6/22 Robby Findler :
>>> One thing that's easy to forget is to re-run 'raco setup' to register
>>> the info.rkt's keys.
>>>
>>> Robby
>>>
>>> On Fri, Jun 22, 2012 at 9:08 AM, Danny Yoo  wrote:
> However it seems that DrRacket never calls the get-info function in 
> question.
> To check this, I added a displayln call to print a message each get-info
> is called, and I never see any output from this.

 Odd; I'm seeing output!  So I can't duplicate what you're seeing:
 DrRacket appears to be running the get-info function on my end.

 Here's what I'm seeing on the console when I try running on one of
 your test files "testing.rkt":

 ---
 kepler ~/work/bracket/bracket/lang $ drracket ../tests/testing.rkt
 (reader/get-info # bracket/lang/reader #f #f 1)
 (reader/get-info drracket:toolbar-buttons #f)
 (reader/get-info drscheme:toolbar-buttons #f)
 (reader/get-info drracket:opt-out-toolbar-buttons ())
 (reader/get-info # bracket/lang/reader #f #f 1)
 close
 close
 (reader/get-info # bracket/lang/reader #f #f 1)
 (reader/get-info # bracket/lang/reader 1 0 1)
 (reader/get-info color-lexer #f)
 exception in colorer thread: #(struct:exn:fail:contract:arity "context
 expected 1 value, received 5 values: \"\\n\" 'white-space #f
 # #" #)

  === context ===
 /home/dyoo/local/racket-5.2.1/lib/racket/collects/syntax-color/module-lexer.rkt:25:0:
 module-lexer
 /home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/racket.rkt:1281:26
 /home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/color.rkt:292:4:
 re-tokenize method in ...rk/private/color.rkt:66:2
 /home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/color.rkt:455:17
 
  Racket Users list:
  http://lists.racket-lang.org/users
>>
>>
>>
>> --
>> --
>> Jens Axel Søgaard
>
> 
>  Racket Users list:
>  http://lists.racket-lang.org/users


  Racket Users list:
  http://lists.racket-lang.org/users


Re: [racket] Unquote symbol outside quasiquote

2012-09-05 Thread Stephen Chang
(Assuming you meant to reply-all.)

Does Ryan's syntax-local-eval suggestion help you?




On Tue, Sep 4, 2012 at 4:57 PM, André Matheus  wrote:
>
>
> Em 04 set 2012 às 13:25, Stephen Chang  escreveu:
>
>>> I want to create a macro to get fields of an object specified by a list
>>> of
>>> symbols. Like
>>>
>>> (get-fields '(x y) obj) -> (list (get-field x obj) (get-field y obj))
>>
>> I'm not sure you want a macro for this? Will map suffice?
>>
>> (define (get-fields flds obj)
>> (map (λ (fld) (get-field fld obj)) flds))
>
> Oops, I misunderstood how to use get-field (and my example happened to
> work because I had a field named "fld" in my test example).
>
> Yes, you need a macro. One way to do it is to match the "quote" directly:
>
> (define-syntax (test stx)
> (syntax-case stx ()
> [(_ (quote (fld ...)) obj)
> #'(list (get-field fld obj) ...)]))
>
>
> Thanks for everyone who told about matching the quote, it worked like you
> said but
> then I discovered it's not what I need, I misunderstood my problem. What I
> want to
> do is have a macro that in fact takes a list of symbols and get all theses
> symbol from
> the object, like the list of symbols that field-names returns:
>
> (field-names obj)
> '(y x)
>
> I want a macro that expands like this:
>
> (get-fields (field-names x) obj) --> (list (get-field x obj) (get-field y
> obj))
>
> I don't know, maybe I'll need a function first to compute (field-names obj)
> and later
> call the macro?
>
> Frankly this compile-time/run-time thing is confusing me a little.
>
> Thanks and sorry for the confusion.


  Racket Users list:
  http://lists.racket-lang.org/users


[racket] run big-bang universe server on headless server?

2015-02-27 Thread Stephen Chang
Is there any way to run a big-bang universe server without the gui?

Or more generally has anyone figured out how to run a big-bang
universe server on a headless server?

  Racket Users list:
  http://lists.racket-lang.org/users


Re: [racket] run big-bang universe server on headless server?

2015-02-27 Thread Stephen Chang
> It shows state windows and debugging windows only when you specify 
> appropriate clauses in its description.

They seem to appear by default and I don't see anywhere to disable them?




But, it pulls in a shared library from 'world' that relies on
racket/gui. So the answer is 'currently not possible but doable in
principle'.
>
> -- Matthias
>
>
>
>
>
> On Feb 27, 2015, at 6:12 PM, Stephen Chang wrote:
>
>> Is there any way to run a big-bang universe server without the gui?
>>
>> Or more generally has anyone figured out how to run a big-bang
>> universe server on a headless server?
>> 
>>  Racket Users list:
>>  http://lists.racket-lang.org/users
>

  Racket Users list:
  http://lists.racket-lang.org/users


Re: [racket] updated trycode.io

2015-03-03 Thread Stephen Chang
This is really neat!

I tried the guessing game and it seems to have a bug though?
> (guess)
50
> (smaller)
25
> (bigger)
37
> (bigger)
37

On Tue, Mar 3, 2015 at 10:22 AM, Matthias Felleisen
 wrote:
>
> Thanks. This is really neat. When (if really) I ever find time, I would love 
> to help with putting more of Realm out there like this. -- Matthias
>
>
>
> On Mar 2, 2015, at 10:10 PM, Floyd Arguello  wrote:
>
>> trycode.io has been updated with the Guess My Number game from Realm of 
>> Racket. Please take a look and tell me your thoughts.
>>
>> Cheers,
>> Floyd
>>
>> 
>>  Racket Users list:
>>  http://lists.racket-lang.org/users
>
>
> 
>   Racket Users list:
>   http://lists.racket-lang.org/users

  Racket Users list:
  http://lists.racket-lang.org/users


[racket-users] Re: [racket] Racket 6.0 does not work

2015-05-05 Thread Stephen Chang
> ./racket: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found 
> (required by ./racket)

I just ran into this problem and a search led me to this thread, thanks.

I am running Debian 7.8 wheezy which includes glibc 2.13. I originally
used the Ubuntu 12.04 (Precise) 64bit installer from the Utah snapshot
page and got the above error.
http://www.cs.utah.edu/plt/snapshots/

I then installed with the wheezy 64bit installer from the Northwestern
snapshot page and everything worked out of the box.
http://plt.eecs.northwestern.edu/snapshots/

Thanks everyone.

On Wed, Mar 12, 2014 at 6:42 PM, Matthew Flatt  wrote:
> The new download pages include a 64-bit Debian Squeeze installer for v6.0.
>
> At Mon, 10 Mar 2014 07:10:50 +0100, Manfred Lotz wrote:
>> John Clements asked about a Debian version the other day. Robby Findler
>> pointed him to: http://plt.eecs.northwestern.edu/snapshots/
>>
>> I suggest downloading the Debian Wheezy version which I guess would
>> have the glibc version you need.
>>
>>
>> --
>> Manfred
>>
>>
>> On Wed, 5 Mar 2014 18:03:26 -0300
>> Junia Magellan  wrote:
>>
>> > I am a professor of Computer Science in a technological institute. My
>> > research is comparing productivity of computer languages using
>> > Measurement Theory. I think you already know that from my previous
>> > posts. The point is that Racket 6.0 installer is very unfriendly.
>> > Well, it is almost like the installer of Racket 6.0. The only
>> > difference is that Racket 6.0 does not work.
>> >
>> > I asked about 8 students to install Racket 6.0. Nobody succeeded.
>> > 100% of failures. I tried the installation myself, and failed. I will
>> > give an example.  I am using Cloud computing, and cannot modify the
>> > machine. For instance, I cannot install a new operating system to
>> > satisfy the requirements of Racket 6.0. Given these constraints, the
>> > situation is the following:
>> >
>> > cat /proc/cpuinfo
>> >
>> > vendor_id: AuthenticAMD
>> > cpu family: 21
>> > model: 2
>> > model name: AMD Opteron 63xx class CPU
>> > stepping: 0
>> > microcode: 0x165
>> > cpu MHz: 2299.909
>> > cache size: 512 KB
>> > fpu: yes
>> > fpu_exception: yes
>> > cpuid level: 13
>> > wp: yes
>> > bogomips: 4599.81
>> > TLB size: 1024 4K pages
>> > clflush size: 64
>> > cache_alignment: 64
>> > address sizes: 48 bits physical, 48 bits virtual
>> >
>> > This particular machine has 16 cores, and the kernel is:
>> >
>> > uname -mrs
>> > Linux 3.2.52 x86_64
>> >
>> > When I try to run Racket 5.36, everything works perfectly well. Here
>> > is an example:
>> >
>> > # mv racket racket60
>> > # mv racket-old/ racket
>> > # racket/bin/racket -il xrepl
>> > Welcome to Racket v5.3.6.
>> > -> (* 3 4 5)
>> > 60
>> > -> (exit)
>> >
>> > Now, let us see what happens with Racket 6.0:
>> >
>> > # mv racket racket-old
>> > # mv racket60 racket
>> > # mv racket60 racket
>> > # racket/bin/racket
>> > racket/bin/racket: /lib64/libc.so.6: version `GLIBC_2.14' not found
>> > (required by racket/bin/racket)
>> > #
>> >
>> > I would like you to understand that most people are not PhD in
>> > Computer Science. 90% of people want to run out of the box
>> > applications. Even programmers don't have in depth knowledge about
>> > the workings of computers and operating systems. I don't know why
>> > Racket 6.0 needs libc.so.6, or GLIBC_2.14. I just want to run
>> > statistics programs written in Racket from an Internet page.
>> >
>> > I will give you another example about Racket 6.0. There are a lot of
>> > people that use a text editor called Vim+mzscheme. This text editor
>> > has a lot of applications about Rasch measurement, that are used by
>> > people in the business of education. I mean, people who work in
>> > things like SAT, GRE, USMLE, and equivalent activities in countries
>> > around the world. These programs test students, and the processed
>> > scores are often used by admission offices to accept applicants. I
>> > happen to work with this kind of programs.
>> >
>> > Installing Vim+mzscheme is a nuisance, since people must compile
>> > Racket from sources, and Vim from sources. In Windows, few people
>> > succeed in performing the task. The same is true in the case of OS-X.
>> > I am talking about Racket 5.36, for I don't know a single person who
>> > installed vim+mzscheme with Racket 6.0.
>> >
>> > What I need is a version of Racket that work right out of the box, at
>> > least for OS-X, Windows 7, Windows 8, and Linux. I also need a fast
>> > editor, like Vim.
>> >
>> > Well members of this list, here is what I am going to do. I will
>> > download Bigloo, learn how to use it, hire a programmer to write
>> > array operations in Bigloo, translate a lot of programs from Racket
>> > and Common Lisp to Bigloo, and start from zero, as in Edith Piaf's
>> > song.
>> >
>> >
>> >
>> >
>> >
>> > * Junia Magalhães Rocha*
>> >
>> > Doutoranda em Inteligência Arti

[racket-users] Re: Use Parsack to parse a #language?

2015-05-11 Thread Stephen Chang
Glad you're having a good time!

I think you should be able to use it to implement your language's
reader but I don't have any actual experience doing so.

I seem to recall that Racket used to come with a combinator parser
library. It's been removed but I don't remember why but maybe that
could be an indication that it's not a good idea?

My library is currently a straight port from Haskell (ie, not
idiomatic Racket) so it won't be as nice as the built-in parsing tools
in terms of fitting into the Racket toolchain. You may have to do some
manual "gluing".

A few things off the top of my head:
1) Input-wise the parser combinators only consume strings. To be fully
Rackety, they should work with ports (if anyone wants to take a crack
at it, it would be very appreciated).
2) You'll have to manually convert the character outputs to syntax.
3) You'll have to manually extract the source location from the
parsack state and add it to your syntax objects.

Greg Hendershott can probably fill you in on more unpleasantries, as
his markdown parser is the biggest client (that I currently know of)
:)


On Mon, May 11, 2015 at 9:40 PM, Daniel Prager
 wrote:
> I've been having a great time playing with Stephen Chang's Parsack
> (parsec-style parsing for Racket) and enjoying the straightforward learning
> curve and usability. Thanks Stephen!
>
> Has anyone used Parsack to do the parsing for a little language and then
> plugged it into the main Racket infrastructure?
>
> Good idea? Mismatched tool? What does it / would it take?
>
>
> Thanks
>
> Dan

-- 
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] Re: Use Parsack to parse a #language?

2015-05-12 Thread Stephen Chang
> Once I get my head around what's needed to connect up a custom
> reader

Matthew's example from his talk at the first RacketCon (and other
conferences) might be a good place to start:
https://github.com/mflatt/scratchy/blob/master/scratchy/reader.rkt
https://github.com/mflatt/scratchy/blob/master/scratchy/parser.rkt

>> I seem to recall that Racket used to come with a combinator parser
library. It's been removed but I don't remember why

(Replying to myself) I found the old library. Looks like it was
discontinued for lack of a maintainer.
http://planet.racket-lang.org/package-source/plt/combinator-parser.plt/1/0/planet-docs/combinator-parser/index.html

-- 
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] right abstraction for this?

2015-06-11 Thread Stephen Chang
Would any of the functions in unstable/list help? For example,

#lang racket
(require unstable/list)

(define (gather lst)
  (for/hash ([g (group-by car lst)])
(values (caar g) (append-map cdr g

(gather '((a c) (a d) (b e) (b f)))
; => '#hash((a . (c d)) (b . (e f)))

On Thu, Jun 11, 2015 at 12:25 PM, 'John Clements' via users-redirect
 wrote:
> I write this kind of code all the darn time:
>
> ;; take (listof (list a b)) into (hashof a (listof b))
> (define (gather l)
>   (for/fold ([ht (make-hash)])
> ([pr l])
> (hash-set ht (first pr) (cons (second pr)
>   (hash-ref ht (first pr) empty)
>
> ;; gather the responses into a table:
> (define rating-table (gather responses2))
>
> ;; compute the mean rating for each student
> (for/list ([(student ratings) (in-hash rating-table)])
>   (list student (mean ratings)))
>
> … that is: given an association list, gather them together, then compute 
> (say) the mean of the values. In this case, I’m trying to compute the mean 
> rating for a bunch of students. Very simple.
>
> So… why does it take so much code? I feel like these should be built-in 
> abstractions. There are (at least) two possibilities:
>
> 1) There’s an obvious, built-in way to do this, and I’m just missing it.
> 2) There’s an abstraction that we’re missing, and I feel like Clojure might 
> have it. Or am I just making this up? Getting clojure running is such a pain….
>
> Thanks for any advice!
>
> 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.


Re: [racket-users] API function naming

2015-07-03 Thread Stephen Chang
> What symbols have the least historic baggage?

I've gone through this exercise a few times, and each time settled on '$'.

As Greg points out, pretty much every one of my my Racket libraries
makes use of this symbol (was it that obvious? :) ) exactly because I
was looking for something that Racket programmers would not confuse
for something else.

Off the top of my head, here are some other Racket symbol conventions
(may not apply to Scheme in general):

~: syntax-parse pattern combinators; I've tried to use this before and
received negative feedback about it
!: imperative/side-effecting functions
@: documentation, at mentioned by Greg, and also units
#: recognized by the reader (often in combination with a second
symbol) for various literals
%: objects, and <%> is for interfaces (as a suffix)
^: unit signatures (suffix)
&: this one may be relatively safe, I think?
*: sometimes denotes "list version" or more often just "alternate" (eg let*)
-: standard word delimiter, a la '_' in C and other languages
/: often pronounced "with", as in call/cc; can also just be a
delimiter (eg in the web server)
_: the C ffi bindings have this prefix; some use it to mean "internal"
?: predicates (suffix)
=: equality functions (suffix)

Did I miss any?

Note that I excluded symbols that already have special meaning to the
reader: http://docs.racket-lang.org/reference/reader.html

(Should these go in the style guide somewhere?)

Another idea is to use two or more symbols?



>
>
>
>
>
>
>
> --
> 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] API function naming

2015-07-03 Thread Stephen Chang
> You also have unicode available to you. IDE support can help with this
> -- I think the cmd-\ for lambda has worked pretty well.

I've been going this route more, especially because DrRacket supports
autocompletion of (what it deems) unique latex prefixes. For example,
in DrRacket, type "\G", followed by ctrl-\

However, I often hate myself afterwards, exactly because:

> These punctuation characters that typically require a shift modifier might be
> pleasing to the eye, but unpleasing to the typist.

That being said, I haven't stopped doing it yet.



>
> Robby
>
> On Fri, Jul 3, 2015 at 12:36 PM, Stephen Chang  wrote:
>>> What symbols have the least historic baggage?
>>
>> I've gone through this exercise a few times, and each time settled on '$'.
>>
>> As Greg points out, pretty much every one of my my Racket libraries
>> makes use of this symbol (was it that obvious? :) ) exactly because I
>> was looking for something that Racket programmers would not confuse
>> for something else.
>>
>> Off the top of my head, here are some other Racket symbol conventions
>> (may not apply to Scheme in general):
>>
>> ~: syntax-parse pattern combinators; I've tried to use this before and
>> received negative feedback about it
>> !: imperative/side-effecting functions
>> @: documentation, at mentioned by Greg, and also units
>> #: recognized by the reader (often in combination with a second
>> symbol) for various literals
>> %: objects, and <%> is for interfaces (as a suffix)
>> ^: unit signatures (suffix)
>> &: this one may be relatively safe, I think?
>> *: sometimes denotes "list version" or more often just "alternate" (eg let*)
>> -: standard word delimiter, a la '_' in C and other languages
>> /: often pronounced "with", as in call/cc; can also just be a
>> delimiter (eg in the web server)
>> _: the C ffi bindings have this prefix; some use it to mean "internal"
>> ?: predicates (suffix)
>> =: equality functions (suffix)
>>
>> Did I miss any?
>>
>> Note that I excluded symbols that already have special meaning to the
>> reader: http://docs.racket-lang.org/reference/reader.html
>>
>> (Should these go in the style guide somewhere?)
>>
>> Another idea is to use two or more symbols?
>>
>>
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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.
>
> --
> 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] API function naming

2015-07-03 Thread Stephen Chang
> The prefixes are based on this file:
> https://github.com/racket/gui/blob/master/tex-table/tex-table.rkt
>
> Maybe there are missing ones you're used to?

Sorry, that was supposed to be a compliment! I love DrRacket's support
for unicode and I havent wanted any symbols that aren't already
supported.

I was agreeing with Neil V's general sentiment that inputting
non-standard symbols (even with DrRacket's assistance) often feels
more cumbersome than simply choosing a longer name. It's like the
right-handed version of "emacs pinky"?

However, ultimately I stick with the shorter names because I agree
that it's more readable.



>
> Robby
>
> --
> 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] variadic function who use parameters from a mother variadic function

2015-07-03 Thread Stephen Chang
I think the call to "values" is misplaced.

Here's a functioning version of foo, and a perhaps more concise alternative:

(define (foo . L)
  (let ([bar (string-join (build-list (length L) (λ (x) "~a")) "")])
(apply format bar L)))

(define (my-foo . L)
  (string-join (map ~a L) ""))

On Fri, Jul 3, 2015 at 4:06 PM, mazert  wrote:
> Hello,
>
> To directly go to the essential : here is an example :
>
> (define (foo . L)
>   (let ([bar (string-join (build-list (length L) (λ (x) "~a")) "")])
> (format bar (apply values L
>
> Globally, I want to use a function who has variable parameters within a
> function who has variable parameters too.
>
> It is possible ?
> Thanks in advance.
>
> --
> 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] variadic function who use parameters from a mother variadic function

2015-07-03 Thread Stephen Chang
Actually, ~a by itself might do what you want.

(~a 1 2 3) ; => "123"

On Fri, Jul 3, 2015 at 4:18 PM, Stephen Chang  wrote:
> I think the call to "values" is misplaced.
>
> Here's a functioning version of foo, and a perhaps more concise alternative:
>
> (define (foo . L)
>   (let ([bar (string-join (build-list (length L) (λ (x) "~a")) "")])
> (apply format bar L)))
>
> (define (my-foo . L)
>   (string-join (map ~a L) ""))
>
> On Fri, Jul 3, 2015 at 4:06 PM, mazert  wrote:
>> Hello,
>>
>> To directly go to the essential : here is an example :
>>
>> (define (foo . L)
>>   (let ([bar (string-join (build-list (length L) (λ (x) "~a")) "")])
>> (format bar (apply values L
>>
>> Globally, I want to use a function who has variable parameters within a
>> function who has variable parameters too.
>>
>> It is possible ?
>> Thanks in advance.
>>
>> --
>> 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] API function naming

2015-07-03 Thread Stephen Chang
> Perhaps this isn’t applicable in this case, but may I suggest a less-common 
> alternative: no prefixing at all? If you put all the commands into a separate 
> module, users of the module can use ‘prefix-in’ to choose whatever prefix 
> they prefer.

Prefixes (and suffixes) have two purposes. One is to disambiguate a
global namespace, as with the "set-" or "hash-" functions. I think
your proposal applies in this case and I mostly agree.

The other purpose is to convey a (sometimes package-local) convention.
For example, users of my Parsack package know that any $-prefixed
identifier is a parser. Removing the prefix would defeat the
readability that I'm trying to achieve, similar to removing the '?'
from predicates.

John's case seems to fall into the latter so I think a prefix would be
useful. (And I second Neil T's suggestion.)



>
> This can be paired with documentation that uses a particular prefix in all 
> its examples, encouraging a standard of sorts, but the choice of any prefix 
> would still be available if a user prefers. For an example of this in the 
> wild see Racket’s own parser-tools library 
> (http://docs.racket-lang.org/parser-tools/Lexers.html). The common matchers 
> are provided unprefixed in the parser-tools/lex-sre module, but the docs 
> consistently use a ‘:’ prefix to create a standardized usage.
>
> This doesn’t eliminate the problem of needing to choose a prefix entirely, 
> but it does give a little more flexibility to avoid the fear of choosing a 
> prefix some users really don’t like.
>
> Alexis
>
> --
> 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] API design 2 -- variadic styles

2015-07-06 Thread Stephen Chang
Racket has linguistic support for keyword arguments, which address
many of the issues you raised:
http://docs.racket-lang.org/guide/keywords.html

Would this help in your case?

Additional background: http://www.cs.utah.edu/plt/publications/scheme09-fb.pdf

On Mon, Jul 6, 2015 at 10:56 AM, John Carmack  wrote:
> A primary goal of the scripting work is that it should be easy to do easy
> things.  You shouldn’t have to specify all the options if you just want to
> play a sound or show a picture, but you should still be able to get at them
> when you need them.
>
>
>
> For the case of a sound effect, all of the following data may be specified:
>
>
>
> Wav file – URI to a .wav file with audio samples.
>
> Volume – Scale factor for the wav samples.
>
> Position – 3D point for HRTF spatialized audio processing.
>
> Looping – Flag to cause the wav file to loop continuously.
>
> Name – An identifier to allow the parameters on a playing sound to be
> updated later.
>
> Time – Absolute time for the sound to start, necessary for synced background
> audio in drop-in multiplayer servers and glitch free transitioning between
> wav files.
>
>
>
> There are four broad strategies for exposing all that.
>
>
>
> Multiple functions for different sets of parameters:
>
> (+sound wav-string)
>
> (+sound-positioned Wav-string position-vec3)
>
> (+named-sound wav-string position-vec3 sound-name)
>
> (+sound-update sound-name new-position-vec3)
>
>
>
> This has a combinatorial explosion problem.
>
>
>
> Optional parameter count with implicit type by position, C++ style:
>
> (+sound wav-string position-vec3 name-int volume-float looping-bool
> time-float)
>
>
>
> Need to define special values for parameters that are essentially skipped –
> POSITION_NONE, NAME_NONE, etc, since it is possible to want to set later
> values without all the preceding ones.  Not very self-documenting, and not
> feasible for large numbers of options like GPU state.
>
>
>
> Keyword delimited parameters, command line parsing style:
>
> (+sound ‘wav wav-string ‘position position-vec3 ‘name name-int ‘volume
> volume-float ‘looping looping-bool ‘time time-float)
>
>
>
> A typo in an option symbol name will not be detected at compile time if done
> as a function, but I guess that is a good argument for a macro.
>
>
>
> Option functions:
>
> (+sound (opt-wav wav-string) (opt-position position-vec3) (opt-name
> name-int) (opt-volume volume-float) (opt-looping looping-bool) (opt-time
> time-float))
>
>
>
> Simple to do transformations or validation on the inputs, but the most
> verbose.
>
> Bad option names will be detected at compile time, but you could still
> compile, say, graphics options into a sound command, which would have been
> detected with the keyword delimited parameters.
>
>
>
> In some cases, parameters can be inferred by type.  For sounds, a parameter
> that is a string is the wav, a float is the volume, a bool is looping, a
> vec3 is position, an int is name.  That is sheer luck – other commands would
> very likely have multiple parameters with common types, and even here there
> would be an ambiguity with time.  Still, it would be possible to go
> type-system-happy and explicitly have types for everything.  I suppose that
> would syntactically degenerate to option functions.
>
>
>
> It is tempting to use flags that are just signaled by their presence – just
> add ‘looping instead of ‘looping #t or (looping #t), but that can be awkward
> when the state of a flag is programmatically evaluated.
>
>
>
> Currently I am using a hybrid form, where the first parameter is an implicit
> type (and second parameter for gfx commands), and all following parameters
> are evaluated and appended as options.
>
> --
> 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] API design 2 -- variadic styles

2015-07-06 Thread Stephen Chang
Just realized that the first link is not very useful. These might be
more informative:

http://docs.racket-lang.org/guide/application.html?q=keyword#%28part._keyword-args%29
http://docs.racket-lang.org/guide/contracts-general-functions.html?q=keyword#%28part._contracts-keywords%29

On Mon, Jul 6, 2015 at 11:05 AM, Stephen Chang  wrote:
> Racket has linguistic support for keyword arguments, which address
> many of the issues you raised:
> http://docs.racket-lang.org/guide/keywords.html
>
> Would this help in your case?
>
> Additional background: http://www.cs.utah.edu/plt/publications/scheme09-fb.pdf
>
> On Mon, Jul 6, 2015 at 10:56 AM, John Carmack  wrote:
>> A primary goal of the scripting work is that it should be easy to do easy
>> things.  You shouldn’t have to specify all the options if you just want to
>> play a sound or show a picture, but you should still be able to get at them
>> when you need them.
>>
>>
>>
>> For the case of a sound effect, all of the following data may be specified:
>>
>>
>>
>> Wav file – URI to a .wav file with audio samples.
>>
>> Volume – Scale factor for the wav samples.
>>
>> Position – 3D point for HRTF spatialized audio processing.
>>
>> Looping – Flag to cause the wav file to loop continuously.
>>
>> Name – An identifier to allow the parameters on a playing sound to be
>> updated later.
>>
>> Time – Absolute time for the sound to start, necessary for synced background
>> audio in drop-in multiplayer servers and glitch free transitioning between
>> wav files.
>>
>>
>>
>> There are four broad strategies for exposing all that.
>>
>>
>>
>> Multiple functions for different sets of parameters:
>>
>> (+sound wav-string)
>>
>> (+sound-positioned Wav-string position-vec3)
>>
>> (+named-sound wav-string position-vec3 sound-name)
>>
>> (+sound-update sound-name new-position-vec3)
>>
>>
>>
>> This has a combinatorial explosion problem.
>>
>>
>>
>> Optional parameter count with implicit type by position, C++ style:
>>
>> (+sound wav-string position-vec3 name-int volume-float looping-bool
>> time-float)
>>
>>
>>
>> Need to define special values for parameters that are essentially skipped –
>> POSITION_NONE, NAME_NONE, etc, since it is possible to want to set later
>> values without all the preceding ones.  Not very self-documenting, and not
>> feasible for large numbers of options like GPU state.
>>
>>
>>
>> Keyword delimited parameters, command line parsing style:
>>
>> (+sound ‘wav wav-string ‘position position-vec3 ‘name name-int ‘volume
>> volume-float ‘looping looping-bool ‘time time-float)
>>
>>
>>
>> A typo in an option symbol name will not be detected at compile time if done
>> as a function, but I guess that is a good argument for a macro.
>>
>>
>>
>> Option functions:
>>
>> (+sound (opt-wav wav-string) (opt-position position-vec3) (opt-name
>> name-int) (opt-volume volume-float) (opt-looping looping-bool) (opt-time
>> time-float))
>>
>>
>>
>> Simple to do transformations or validation on the inputs, but the most
>> verbose.
>>
>> Bad option names will be detected at compile time, but you could still
>> compile, say, graphics options into a sound command, which would have been
>> detected with the keyword delimited parameters.
>>
>>
>>
>> In some cases, parameters can be inferred by type.  For sounds, a parameter
>> that is a string is the wav, a float is the volume, a bool is looping, a
>> vec3 is position, an int is name.  That is sheer luck – other commands would
>> very likely have multiple parameters with common types, and even here there
>> would be an ambiguity with time.  Still, it would be possible to go
>> type-system-happy and explicitly have types for everything.  I suppose that
>> would syntactically degenerate to option functions.
>>
>>
>>
>> It is tempting to use flags that are just signaled by their presence – just
>> add ‘looping instead of ‘looping #t or (looping #t), but that can be awkward
>> when the state of a flag is programmatically evaluated.
>>
>>
>>
>> Currently I am using a hybrid form, where the first parameter is an implicit
>> type (and second parameter for gfx commands), and all following parameters
>> are evaluated and appended as options.
>>
>> --
>> 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] could i get some feedback and help on a graphical editor project?

2015-07-08 Thread Stephen Chang
The Style Guide is a good place to start for learning Racket
conventions: http://docs.racket-lang.org/style/index.html

Overall, things look good! Your code already uses many Racket idioms.

Some things that caught my attention on first glance:

- The code is wider than typical. Though tastes differ, most Racket
code tries to stay within 80 or 102 columns.

- Use square brackets in certain places to aid readability. For
example, around cond and match clauses and let binding clauses. You
already do this somewhat, so just use it more consistently.

- unless/when already return void, so an explicit subsequent (void) is
unnecessary.

- To reduce code verbosity, utilize pattern matching (more than you
already do), particularly to destructure structs. For example, instead
of:

;; from clockwise-turn?
  (let* ((ax (node-x a))
 (ay (node-y a))
 (bx (node-x b))
 (by (node-y b))
 (cx (node-x c))
 (cy (node-y c)))
(not (positive? (- (* (- bx ax) (- cy ay)) (* (- cx ax) (- by ay))

write:

  (match* (a b c)
[((node ax ay) (node bx by) (node cx cy))
 (not (positive? (- (* (- bx ax) (- cy ay)) (* (- cx ax) (- by ay)]))

- Avoid manually traversing lists. Use "for" list comprehensions
instead of let loops. For example, instead of:

;; from highlight-paths
(let loop : Void
([x : (Listof path) (filter path? lst)])
(cond ((empty? x) (void))
  (else (when (any-entity-highlighted? (path-entities (car x)))
  (map (lambda ([i : Entity])
(set-entity-highlighted! i #t)) (path-entities (car x
(loop (cdr x)

write:

  (for ([p : path (filter path? lst)]
#:when (any-entity-highlighted? (path-entities p)))
(for ([i : Entity (path-entities p)]) (set-entity-highlighted! i #t)))


I didnt see anything blatant that should be converted to macros. In
general, you should prefer functions to macros, and I think your code
is organized well in general. That being said, you may want to look
into match expanders:

For example:

(define-match-expander line-pat
  (syntax-rules () [(_ pat1 pat2) (struct* line ([p1 pat1][p2 pat2]))]))

would allow you to write:

   (match i
 [(line-pat p1 p2) (list (node-x p1) (node-x p2))] ...)

instead of:
;; from canvas-utils.rkt
   (match i
 [(struct* line  ([p1 p1] [p2 p2])) (list (node-x p1)
(node-x p2))] ..)

And then you could nest a pattern more easily. For example, instead of:

;; from canvas-utils.rkt
  (let ((lx1 (node-x (line-p1 line-struct)))
(ly1 (node-y (line-p1 line-struct)))
(lx2 (node-x (line-p2 line-struct)))
(ly2 (node-y( line-p2 line-struct ...)

you could write:

  (match line-struct
[(line-pat (node lx1 ly1) (node lx2 ly2)) ...])

Functionality-wise, I tried to open "disk_cover R14.dxf" but got the
following error:

hash-ref: no value found for key
  key: "8"

I was able to open "disk_cover R2004-2006.dxf". It did lag somewhat
when I tried to drag it but I'm not sure if this is due to some parts
of the code or the large image itself. Maybe some others who have more
experience writing gui apps will comment.

On Wed, Jul 8, 2015 at 6:17 AM, copycat  wrote:
> Hello all,
>
>   feedback is most appreciated. I had a lot of fun writing this small program 
> (see bottom for details and repository link), and i want to improve my skills 
> so i can write idiomatic Scheme/Racket code one day. Particularly helpful 
> would be suggestions as to where i can use macros to reduce the amount of 
> code the program has. There is also some seriously verbose stuff in 
> "lst-utils.rkt" (find-entity-with-starting-node, find-entities-from-node ...) 
> that i'm not sure how to refactor at the moment now.
>
>   Also, I am a new programmer and have only seriously programmed in VB.NET 
> and Racket and am thinking about building on this program to develop a GUI 
> for a gantry robot teaching interface. But i am worried about any roadblocks 
> that i may encounter on the way in using Racket. Please help me clear my 
> doubts.
>
> 
>
> WARNING: bottom is a long description which is as much for me as it for you. 
> Skip to the below for a TL;DR.
>
>   The first part of the GUI will be displaying a large image of a printed 
> circuit board (PCB) consisting of stitched high-resolution images taken with 
> an area-scan camera. The idea is to let the user "draw" on this background 
> image the order of movements (commands) of the gantry robot. More detailed 
> control of the robot movements has to be specified in a spreadsheet/display 
> list of some sort. There will also be some commands involving machine vision 
> for checking position markers (fiducials), and various sort of vision 
> inspections. These commands are then saved as a "program" to be executed in 
> the second part of the GUI.
>
>  Those are the very basics, more f

Re: [racket-users] How to return summary from the inner loop?

2015-07-10 Thread Stephen Chang
Perhaps I don't understand the problem, but why is the inner loop necessary?

By the way, you can use (printf ...) instead of (fprintf
(current-output-port) ...)

Would this work?

(define (validate-ranges2 value-list low-list high-list)
  (for/sum ([v value-list]
[lo low-list]
[hi high-list]
#:when (< lo v hi))
(printf "\n*** Faulty!\n")
1))

Or, without using for:

(define (validate-ranges3 vals los his)
  (count
   (λ (lo v hi)
 (and (< lo v hi)
  (printf "\n*** Faulty!\n")))
   los vals his))

Without the printing:

(define (validate-ranges4 vals los his)
  (count < los vals his))


On Fri, Jul 10, 2015 at 4:01 PM, Pekka Niiranen
 wrote:
> Hello users,
>
> I want to loop thru values and return the total number of failures
> instead of breaking out of loop as soon as the first failure is encountered.
>
> The code below works as intended:
>
> define (validate-order value-list low-list)
>   ;; Checks whether all the values are all above list of low limits
>   (define result
> (for/fold ([failures 0])
>   ([e low-list]
>[v value-list])
>   (if (< v e)
>   (begin
> (fprintf (current-output-port) "BS~n")
> (add1 failures))
>   failures)))
>   result)
>
>
> However, if I need to use nested loop I have to build
> intermediate list "ranges" before looping:
>
> (define (validate-ranges value-list low-list high-list)
>   ;; Checks whether all the values are all between list
>   ;; of low/high limits
>
>   ;; I do not like this intermediate definition:
>   (define ranges (for/list ([s low-list]
> [e high-list])
>(cons s e)))
>
>   (define result
> (for/fold ([failures 0])
>   ([v value-list]
>[r ranges])
>
>   ;; I do not like the car/cdr -function calls either:
>
>   (if (< (car r) v (cdr r))
>   (begin
> (fprintf (current-output-port) "~n")
> (fprintf (current-output-port) "*** Faulty!~n")
> (add1 failures))
>   failures)))
>   result)
>
> Is is somehow possible to return the result from the inner
> loop to the scope of the outer loop? Somehow like this:
>
> (define (validate-ranges value-list low-list high-list)
>   (define result (for/??? ([s low-list]
>[e high-list])
>   (for/fold ([failures 0])
> ([v value-list])
> (if (< s v e)
> (begin
>   (fprintf (current-output-port) "BS~n")
>   (add1 failures))
> failures
> result)
>
> -pekka-
>
> --
> 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] Re: How to return summary from the inner loop?

2015-07-10 Thread Stephen Chang
I understand now. I still claim that an (explicit) inner loop is not needed:

(define (validate-ranges5 value-list low-list high-list)
  (for*/fold ([failures 0])
 ([(lo hi) (in-parallel low-list high-list)]
  [v value-list]
  #:when (< lo v hi))
(printf "\n*** Faulty!: ~a < ~a < ~a\n" lo v hi)
(add1 failures)))

(validate-ranges5 '(5 15 25) '(1 11 21) '(10 20 30))

=>

*** Faulty!: 1 < 5 < 10

*** Faulty!: 11 < 15 < 20

*** Faulty!: 21 < 25 < 30
3

On Fri, Jul 10, 2015 at 5:40 PM, Pekka Niiranen
 wrote:
> Thanks Sir,
>
> This was exactly what I tried to reason.
> It never occured to me that parameter "failure" can be used
> in both for/fold -constructs.
>
> About the problem (Stephen):
>
> value-list: '(5, 15, 25)
> low-list:   '(1, 11, 21)
> high-list:  '(10, 20, 30)
>
> I need to check the following 9 cases:
>
> LVH
>
> 1 <  5 < 10  BS
> 1 < 15 < 10
> 1 < 25 < 10
>
> 11 <  5 < 20
> 11 < 15 < 20 BS
> 11 < 25 < 20
>
> 21 <  5 < 30
> 21 < 15 < 30
> 21 < 25 < 30 BS
>
> -pekka-
>
>
> On 7/10/15 11:48 PM, Pierpaolo Bernardi wrote:
>>
>> On Fri, Jul 10, 2015 at 10:45 PM, Pierpaolo Bernardi
>>  wrote:
>>>
>>> If I understand correctly the spec, this should do what you ask?
>>
>>
>> which, fixing the typo, becomes:
>>
>> (define (validate-ranges value-list low-list high-list)
>>(for/fold ((failures 0))
>>  ((low (in-list low-list))
>>   (high (in-list high-list)))
>>  (for/fold ((failures 0))
>>((value (in-list value-list)))
>>(if (<= low value high)
>>  failures
>>  (add1 failures)
>>
>
>
> --
> 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] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
I haven't played with the example in detail, but do you want the cut
operator here?

http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29

On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard
 wrote:
> Hi All,
>
> The syntax-parse form can often generate sensible errors based on the
> progress made
> during the attempt to match a pattern against a syntax-object. Given
> multiple choices
> the choice where the "maximum" progress was made is used to generate the
> error message.
>
> Is there a way to tell syntax-parse, that a given choice is to be used as
> the source
> of the error, if the match fails?
>
> A concrete example: In the toy language below a top-level form can be a
> definition
> or an expression. The malformed definition (define (foo 3) x) is not a legal
> definition -- it is however clear that the user intended to write a
> definition,
> since the form begins with (define ...). During matching syntax-parse
> makes more progress under the assumption that the definition is a sequence
> expression, so the error message becomes: begin expected.
>
> How can I stop the matching prematurely when the (define ...) is seen?
>
> /Jens Axel
>
> #lang racket
> ;;;
> ;;; URLANG
> ;;;
>
> ; In the grammar below x stands for a non-keyword identifier
>
> ; ::=  ...
> ;  ::=  | 
>
> ;  ::= (define (x x ...) )
> ;::= 
>
> ;::=  |  |  | 
> ;   ::= x
> ; ::= (x0 x ...)
> ;::= (begin  ...)
>
> ; ::= define | begin
>
> ;   ::= 
>
> ;  an identifier that is not a keyword
> ;  an integer between -2^53 and 2^53
>
> (require syntax/parse)
>
> (define min-fixnum (- (expt 2 53)))
> (define max-fixnum(expt 2 53))
>
> (define (Fixnum? r)
>   (and (number? r) (integer? r)
>(<= min-fixnum r max-fixnum)))
>
> (define-syntax-class Fixnum
>   #:opaque
>   (pattern d
>#:fail-unless (Fixnum? (syntax-e #'d)) #f))
>
> (define-syntax-class Datum
>   (pattern (~or d:Fixnum)))
>
> (define-syntax-class Keyword
>   #:literals (begin define)
>   (pattern (~or begin define)))
>
> (define-syntax-class Id
>   (pattern (~and x:id
>  (~not y:Keyword
>
> (define-syntax-class Reference
>   (pattern x:Id))
>
> (define-syntax-class Application
>   #:literals (define)
>   (pattern (e:Expr ...)))
>
> (define-syntax-class Sequence
>   #:literals (begin)
>   (pattern (begin e0:Expr e:Expr ...)))
>
> (define-syntax-class Definition
>   #:literals (define)
>   (pattern (define (name:Id a:Id ...) body:Body)))
>
>
> (define-syntax-class Body
>   (pattern b:Expr))
>
> (define-syntax-class Expr
>   (pattern (~or e:Datum
> e:Application
> e:Reference
> e:Sequence)))
>
> (define-syntax-class TopLevelForm
>   (pattern (~or t:Definition
> t:Expr)))
>
> (define-syntax-class Program
>   (pattern (p:TopLevelForm ...)))
>
> ;;; The following expressions show some legal
> ;;; constructs that are matched correctly.
>
> (syntax-parse #'3
>   [d:Datum 'datum])
>
> (syntax-parse #'3
>   [e:Expr 'expr])
>
> (syntax-parse #'(define (a x) x)
>   [t:TopLevelForm 'toplevelform])
>
> (syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
>   [p:Program 'program])
>
> ;;; The malformed definition (define (a 4 x) x) is
> ;;; correctly rejected as a toplevel form, but the
> ;;; automatically generated error is not as intended.
>
> (syntax-parse #'(define (a 4 x) x)
>   [t:TopLevelForm 'toplevelform])
>
> --
> 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] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
Actually, I dont get the "begin expected" error that you mention. I'm getting:

define: expected identifier
  parsing context:
   while parsing Id
   while parsing Definition
   while parsing TopLevelForm in: 4

with the 4 highlighted, which seems correct since it comes from using
the Definition class?

On Sat, Jul 25, 2015 at 10:51 AM, Stephen Chang  wrote:
> I haven't played with the example in detail, but do you want the cut
> operator here?
>
> http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29
>
> On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard
>  wrote:
>> Hi All,
>>
>> The syntax-parse form can often generate sensible errors based on the
>> progress made
>> during the attempt to match a pattern against a syntax-object. Given
>> multiple choices
>> the choice where the "maximum" progress was made is used to generate the
>> error message.
>>
>> Is there a way to tell syntax-parse, that a given choice is to be used as
>> the source
>> of the error, if the match fails?
>>
>> A concrete example: In the toy language below a top-level form can be a
>> definition
>> or an expression. The malformed definition (define (foo 3) x) is not a legal
>> definition -- it is however clear that the user intended to write a
>> definition,
>> since the form begins with (define ...). During matching syntax-parse
>> makes more progress under the assumption that the definition is a sequence
>> expression, so the error message becomes: begin expected.
>>
>> How can I stop the matching prematurely when the (define ...) is seen?
>>
>> /Jens Axel
>>
>> #lang racket
>> ;;;
>> ;;; URLANG
>> ;;;
>>
>> ; In the grammar below x stands for a non-keyword identifier
>>
>> ; ::=  ...
>> ;  ::=  | 
>>
>> ;  ::= (define (x x ...) )
>> ;::= 
>>
>> ;::=  |  |  | 
>> ;   ::= x
>> ; ::= (x0 x ...)
>> ;::= (begin  ...)
>>
>> ; ::= define | begin
>>
>> ;   ::= 
>>
>> ;  an identifier that is not a keyword
>> ;  an integer between -2^53 and 2^53
>>
>> (require syntax/parse)
>>
>> (define min-fixnum (- (expt 2 53)))
>> (define max-fixnum(expt 2 53))
>>
>> (define (Fixnum? r)
>>   (and (number? r) (integer? r)
>>(<= min-fixnum r max-fixnum)))
>>
>> (define-syntax-class Fixnum
>>   #:opaque
>>   (pattern d
>>#:fail-unless (Fixnum? (syntax-e #'d)) #f))
>>
>> (define-syntax-class Datum
>>   (pattern (~or d:Fixnum)))
>>
>> (define-syntax-class Keyword
>>   #:literals (begin define)
>>   (pattern (~or begin define)))
>>
>> (define-syntax-class Id
>>   (pattern (~and x:id
>>  (~not y:Keyword
>>
>> (define-syntax-class Reference
>>   (pattern x:Id))
>>
>> (define-syntax-class Application
>>   #:literals (define)
>>   (pattern (e:Expr ...)))
>>
>> (define-syntax-class Sequence
>>   #:literals (begin)
>>   (pattern (begin e0:Expr e:Expr ...)))
>>
>> (define-syntax-class Definition
>>   #:literals (define)
>>   (pattern (define (name:Id a:Id ...) body:Body)))
>>
>>
>> (define-syntax-class Body
>>   (pattern b:Expr))
>>
>> (define-syntax-class Expr
>>   (pattern (~or e:Datum
>> e:Application
>> e:Reference
>> e:Sequence)))
>>
>> (define-syntax-class TopLevelForm
>>   (pattern (~or t:Definition
>> t:Expr)))
>>
>> (define-syntax-class Program
>>   (pattern (p:TopLevelForm ...)))
>>
>> ;;; The following expressions show some legal
>> ;;; constructs that are matched correctly.
>>
>> (syntax-parse #'3
>>   [d:Datum 'datum])
>>
>> (syntax-parse #'3
>>   [e:Expr 'expr])
>>
>> (syntax-parse #'(define (a x) x)
>>   [t:TopLevelForm 'toplevelform])
>>
>> (syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
>>   [p:Program 'program])
>>
>> ;;; The malformed definition (define (a 4 x) x) is
>> ;;; correctly rejected as a toplevel form, but the
>> ;;; automatically generated error is not as intended.
>>
>> (syntax-parse #'(define (a 4 x) x)
>>   [t:TopLevelForm 'toplevelform])
>>
>> --
>> 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] is this a bug?

2015-07-29 Thread Stephen Chang
What's the output you expected?

Does this post help you?
http://stackoverflow.com/questions/8778492/why-is-foldl-defined-in-a-strange-way-in-racket

On Wed, Jul 29, 2015 at 9:45 AM,   wrote:
> Dear racket maintainers,
>
> Maybe, I found a bug.
>
>> (foldr (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5))
> '(a1 (a2 (a3 (a4 (a5 ())
>> (foldl (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5))
> '(a5 (a4 (a3 (a2 (a1 ())
>
> Thanks, I hope racket language is more popular.
>
> Taro
>
> --
> 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] Re: is this a bug?

2015-07-29 Thread Stephen Chang
For any f, acc, and lst, (foldl f acc lst), from left-to-right,
applies to f to each element of lst and the current accumulated value.
The initial accumulator is acc so the second intermediate accumulated
value is (f (first lst) acc). Replacing f, acc, and lst with your
arguments, the second intermediate accumulated value in your example
is (list 'a1 '()), and so on.

On Wed, Jul 29, 2015 at 10:09 AM,   wrote:
> Sorry Stephen,
>
> I expected,
>
>> (foldl (lambda (x y) (list x y)) () '(list a1 a2 a3 a4 a5))
> (list (list (list (list (list a1 a2) a3) a4) a5).
>
> it may be a problem in non-commutative operations.
>
> Taro
>
> --
> 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] Some help with syntax-parse: macro in macro

2015-07-31 Thread Stephen Chang
You might want to specify "collect" in #:datum-literals if it is not a
defined name.

Can you describe some usage examples? That may lead to better insight
for the implementation.

On Fri, Jul 31, 2015 at 11:49 AM, Deren Dohoda  wrote:
> Suppose I have a macro (experiment ...) which is intended, among other 
> things, to be composed of uses of a macro (collect ...).
>
> For instance:
> (experiment
>   (collect ...)
>   (collect ...) ...)
>
> To my understanding, "collect" is not a literal. Can I turn the collect macro 
> itself into a syntax class somehow? Should I instead create a dummy literal 
> "collect" for this purpose, and then create a (collect* ...) macro?
>
> Thanks for any advice.
>
> Deren
>
> --
> 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] macro-generate attribute access?

2015-08-21 Thread Stephen Chang
Is there a way to access an attribute, other than with the "." syntax?

For example, the following example does not work:

#lang racket
(require (for-syntax syntax/parse))

(define-syntax (define-stuff stx)
  (syntax-parse stx
[(_ attr-name macro-name)
 #'(begin
 (begin-for-syntax
   (define-syntax-class C
 (pattern any #:attr attr-name #'any)))
 (define-syntax macro-name
   (syntax-parser
 [(_ (~var c C))
  #'c.attr-name])))]))
(define-stuff an-attr a-macro)
(a-macro 1)

I've also tried various format-id's which I also can't get to work. Is
there an alternate way, in the spirit of ~var vs ":", to get an
attribute's value?

-- 
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] Whalesong-as-a-service

2015-09-08 Thread Stephen Chang
Hi Racket users,

This past summer, Vishesh Yadav created a web application to
facilitate sharing of Racket programs as Javascript (big-bang programs in
particular).

Vishesh is exploring improvements to Whalesong as part of a master's
thesis, taking a descriptive approach and focusing on how Racket
programmers prefer to use Javascript. We're hoping this site will help
us collect some useful examples.

We invite everyone to check it out in its current state and provide
feedback: http://bigbang.ccs.neu.edu/
Submit problems here: https://github.com/vishesh/whalebin

Here are some big-bang programs we've ported:
http://bigbang.ccs.neu.edu/search?q=%23Stevelikes

Vishesh has also developed a DrRacket tool to make local development
in Whalesong easier. The tool adds 2 buttons: a Scribble-style local
compile button, and button that uploads to the website.

I've added the tool as "whalesong-tools" to the pkg server. The src is
here: https://github.com/vishesh/drracket-whalesong

The local-compile button requires a Whalesong installation. Use the
version maintained by Jens. I don't think installation works via the
package manager, but installation instructions are here:
https://github.com/soegaard/whalesong. It will run with Racket 6.2.1
but not anything more recent than that.

-- 
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] PasteRack fails notifying IRC users

2015-09-12 Thread Stephen Chang
Thanks for the report. The Irc connection is always finicky. I've restarted
the server and the bot seems to be working again.
On Sep 12, 2015 8:26 AM, "Paolo Giarrusso"  wrote:

> Hi!
> When I try to notify myself on #racket, PasteRack fails with:
> ```
> Exception
> The application raised an exception with the message:
>
> tcp-write: error writing
>   system error: Broken pipe; errno=32
> Stack trace:
>
> irc-paste at:
>   line 49, column 0, in file /home/stchang/racket/pasterack/irc-bot.rkt
> process-paste21 at:
>   line 454, column 0, in file /home/stchang/racket/pasterack/pasterack.rkt
> ```
>
> Luckily the paste is at least created.
>
> Cheers,
> Paolo
>
> --
> 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] Strange garbage collection behavior with closures

2015-10-22 Thread Stephen Chang
pasterack uses make-module-evaluator in a sandbox. It's also still
running 6.1.1. Would either of those cause the observed difference?

On Wed, Oct 21, 2015 at 9:18 PM, Matthew Flatt  wrote:
> An empty closure is allocated as a constant --- similar to a literal
> string or literal fraction in your program. The "closure" will stick
> around as long as the code does, and the code will stick around as the
> namespace where its loaded.
>
> If you change `(λ () 0`) to `(λ () (if box 0 'huh?))`, then you end up
> with a non-empty closure (i.e., allocated at run time) due to the
> reference to `box`, and so you get `#f` at the end as you expect.
>
> I don't know why PasteRack produces #f, but it must not hold onto the
> namespace.
>
> At Wed, 21 Oct 2015 21:07:52 -0400, Scott Moore wrote:
>> I’m trying to do something a bit fancy that makes use of weak-hashes, but 
>> I’ve
>> run into strange behavior (things not being removed that I believe should be)
>> when I use keys that are closures. Doing some of my own debugging, this
>> doesn’t appear specific to weak hashes, but also to weak boxes. Here is a
>> short example (based on the example programs in section 19.11 of
>> http://docs.racket-lang.org/guide/performance.html):
>>
>> #lang racket
>>
>> (struct foo ())
>>
>> (define box #f)
>>
>> (let ([f (foo)])
>>   (set! box (make-weak-box f))
>>   (weak-box-value box))
>> (weak-box-value box)
>> (collect-garbage)
>> (weak-box-value box)
>>
>> (let ([f (λ () 0)])
>>   (set! box (make-weak-box f))
>>   (weak-box-value box))
>> (weak-box-value box)
>> (collect-garbage)
>> (weak-box-value box)
>>
>> I expect the output of this program to be:
>>
>> #
>> #
>> #f
>> #
>> #
>> #f
>>
>> Curiously, I do get this answer if I paste the program to pasterack.org. If
>> instead I run the program in DrRacket, or at the command line (both compiled
>> and not compiled), I get this output:
>>
>> #
>> #
>> #f
>> #
>> #
>> #
>>
>> Any idea what is happening here? As far as I can tell, the reachability of 
>> “f”
>> in both code blocks should be identical, despite the difference in the type 
>> of
>> value. Maybe some sort of compiler transformation or a subtlety in the
>> reachability analysis? Or a bug?
>>
>> Thanks,
>> Scott
>>
>> --
>> 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.

-- 
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] R7RS (small) in Racket

2015-10-25 Thread Stephen Chang
This paper is not about Racket but reports on an r7rs implementation
experience and so may have some helpful hints:

http://www.schemeworkshop.org/2014/papers/Kato2014.pdf
On Oct 25, 2015 5:18 PM, "Alexis King"  wrote:

> I have built a very small, very incomplete implementation of R7RS in
> Racket. You can install the “r7rs” package, or you can find it on GitHub
> here:
> https://github.com/lexi-lambda/racket-r7rs
>
> Most of the standard seems fairly straightforward, but there are two
> questions I have. First of all, do there exist any R7RS libraries or
> programs out there that could be used as test cases? The standard is not
> always 100% clear, so having real code to test against would be ideal. This
> is probably more productive than hopelessly guessing at the meaning behind
> the fuzzier areas of the spec.
>
> Second of all, the only non-trivial problem is how to handle the R7RS
> library system and how to integrate it with Racket’s modules. I’ve been
> thinking about how to handle this, and I’m not sure which path I should
> take. I think there are two different use-cases to having an R7RS
> implementation inside of Racket, and each presents its own needs:
>
>1. Maintaining full source compatibility with R7RS-compliant programs.
>2. Implementing R7RS as a module language and requiring “#lang r7rs”.
>
> These are not necessarily mutually exclusive. It seems that Racket’s R5RS
> support manages to provide both options by having the “r5rs” lang and
> module language while also including a mode that works by evaluating
> expressions at the top-level. The question becomes: what is the value
> behind an R7RS implementation? I’ve mostly been implementing it as an
> exercise, and because it’s irked me a little that we have R{5,6}RS
> implementations but not R7RS, but it probably isn’t very useful within the
> Racket ecosystem.
>
> With this context in mind, I ask those have been involved in the Racket
> R5RS or R6RS support to share their experiences regarding these problems.
> Also, if anyone is aware of usages of R7RS (or would be interested in R7RS
> support in Racket, for whatever reason), I’d appreciate thoughts on that as
> well.
>
> If interest is low, I’ll probably just take option 2 for now and build a
> mostly-compliant implementation that accommodates Racket in a few places,
> but I do have some potential ideas for how to handle source compatibility.
> Still, I’m sure I’d be tackling many of the same problems other people have
> already considered, which is why I ask for information about any prior art.
>
> Thanks,
> Alexis
>
> --
> 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] begin-for-syntax causes syntax objects to expand to a different #'quote

2015-12-16 Thread Stephen Chang
There's a #:phase option available when specifying literals:

http://docs.racket-lang.org/syntax/Parsing_Syntax.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._syntax-parse%29%29

On Wed, Dec 16, 2015 at 9:55 PM, Leif Andersen  wrote:
> Okay, that makes sense, thanks.
>
> So out of curiosity, when doing a `syntax-parse`, is there any way I
> can pass in phase level 1 quote as a literal?
>
> ~Leif Andersen
>
>
> On Wed, Dec 16, 2015 at 6:44 PM, Sam Tobin-Hochstadt
>  wrote:
>> That depends on what you're trying to do, but probably not. Going under a
>> `quote-syntax` doesn't change things, it's just that those identifiers are
>> usually used in a macro somewhere else. But it would depend on your
>> application.
>>
>> Note the handling of submodules, though, in particular the call to
>> `syntax-shift-phase-level`.
>>
>> Sam
>>
>> On Wed, Dec 16, 2015 at 6:41 PM Leif Andersen  wrote:
>>>
>>> Ah, cool. Thanks.
>>>
>>> Does that also mean that if I see a `syntax` form inside of a
>>> `begin-for-syntax` it goes back to phase 0?
>>>
>>> Thanks.
>>>
>>> ~Leif Andersen
>>>
>>>
>>> On Wed, Dec 16, 2015 at 6:25 PM, Sam Tobin-Hochstadt
>>>  wrote:
>>> > The identifiers are the same, but only when comparing their phase-1
>>> > bindings. When doing traversal of syntax objects, you need to keep track
>>> > of
>>> > the phase that identifiers are meaningful at.
>>> >
>>> > Here's a version of your paste comparing at the right phase:
>>> > http://pasterack.org/pastes/95574
>>> >
>>> > Here's some quite complex code that walks fully-expanded syntax, and (I
>>> > think) handles phases right as of yesterday:
>>> >
>>> > https://github.com/samth/pycket/blob/master/pycket/pycket-lang/expand.rkt 
>>> > .
>>> > See the `current-phase` parameter.
>>> >
>>> > Sam
>>> >
>>> > On Wed, Dec 16, 2015 at 6:22 PM Leif Andersen 
>>> > wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I am finding that when I have a syntax object:
>>> >>
>>> >> #'(begin-for-syntax (define-values (x) 5), when I expand it it becomes:
>>> >> #'(begin-for-syntax (define-values (x) '5). However, the quote in that
>>> >> expansion will not be free-identifier=? to the one if I were to type
>>> >> it out by hand:
>>> >> #'(begin-for-syntax (define-values (x) '5), and expand that.
>>> >>
>>> >> If however, I have a `begin` rather than a `begin-for-syntax`, giving
>>> >> me:
>>> >> #'(begin (define-values (x) 5) it works as expected. (The quote it
>>> >> expands into is free-identifier=? to the one that I am using.)
>>> >>
>>> >> I am calling expand (or expand-syntax) directly, and not really using
>>> >> any phase levels outside of whatever `expand` may use.
>>> >>
>>> >> Here is my code: http://pasterack.org/pastes/78711
>>> >>
>>> >> #lang racket
>>> >>
>>> >> (define x (expand #'(begin-for-syntax
>>> >>   (define-values (x) '5
>>> >> (define y (expand #'(begin-for-syntax
>>> >>   (define-values (x) 5
>>> >>
>>> >> (define (ident=? stx)
>>> >>   (syntax-case stx ()
>>> >> [(_ (_ (_) (var _)))
>>> >>  (free-identifier=? #'var #'quote)]))
>>> >>
>>> >> (syntax->datum x)
>>> >> (syntax->datum y)
>>> >> (ident=? x)
>>> >> (ident=? y)
>>> >>
>>> >> Is this expected behavior? If so, can you give me some intuition as to
>>> >> why?
>>> >>
>>> >> Thank you.
>>> >>
>>> >> ~Leif Andersen
>>> >>
>>> >> --
>>> >> 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.
>
> --
> 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] begin-for-syntax causes syntax objects to expand to a different #'quote

2015-12-16 Thread Stephen Chang
I'm not sure. I would guess that it corresponds to the label phase?

On Wed, Dec 16, 2015 at 10:37 PM, Leif Andersen  wrote:
> Ah, okay, thanks. One question, I notice that you can pass in #f to
> #:phase, I presume that is similar to for-label, can I use that to
> indicate I would like it to match on all phases?
>
> ~Leif Andersen
>
>
> On Wed, Dec 16, 2015 at 10:02 PM, Stephen Chang  wrote:
>> There's a #:phase option available when specifying literals:
>>
>> http://docs.racket-lang.org/syntax/Parsing_Syntax.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._syntax-parse%29%29
>>
>> On Wed, Dec 16, 2015 at 9:55 PM, Leif Andersen  wrote:
>>> Okay, that makes sense, thanks.
>>>
>>> So out of curiosity, when doing a `syntax-parse`, is there any way I
>>> can pass in phase level 1 quote as a literal?
>>>
>>> ~Leif Andersen
>>>
>>>
>>> On Wed, Dec 16, 2015 at 6:44 PM, Sam Tobin-Hochstadt
>>>  wrote:
>>>> That depends on what you're trying to do, but probably not. Going under a
>>>> `quote-syntax` doesn't change things, it's just that those identifiers are
>>>> usually used in a macro somewhere else. But it would depend on your
>>>> application.
>>>>
>>>> Note the handling of submodules, though, in particular the call to
>>>> `syntax-shift-phase-level`.
>>>>
>>>> Sam
>>>>
>>>> On Wed, Dec 16, 2015 at 6:41 PM Leif Andersen  
>>>> wrote:
>>>>>
>>>>> Ah, cool. Thanks.
>>>>>
>>>>> Does that also mean that if I see a `syntax` form inside of a
>>>>> `begin-for-syntax` it goes back to phase 0?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> ~Leif Andersen
>>>>>
>>>>>
>>>>> On Wed, Dec 16, 2015 at 6:25 PM, Sam Tobin-Hochstadt
>>>>>  wrote:
>>>>> > The identifiers are the same, but only when comparing their phase-1
>>>>> > bindings. When doing traversal of syntax objects, you need to keep track
>>>>> > of
>>>>> > the phase that identifiers are meaningful at.
>>>>> >
>>>>> > Here's a version of your paste comparing at the right phase:
>>>>> > http://pasterack.org/pastes/95574
>>>>> >
>>>>> > Here's some quite complex code that walks fully-expanded syntax, and (I
>>>>> > think) handles phases right as of yesterday:
>>>>> >
>>>>> > https://github.com/samth/pycket/blob/master/pycket/pycket-lang/expand.rkt
>>>>> >  .
>>>>> > See the `current-phase` parameter.
>>>>> >
>>>>> > Sam
>>>>> >
>>>>> > On Wed, Dec 16, 2015 at 6:22 PM Leif Andersen 
>>>>> > wrote:
>>>>> >>
>>>>> >> Hello,
>>>>> >>
>>>>> >> I am finding that when I have a syntax object:
>>>>> >>
>>>>> >> #'(begin-for-syntax (define-values (x) 5), when I expand it it becomes:
>>>>> >> #'(begin-for-syntax (define-values (x) '5). However, the quote in that
>>>>> >> expansion will not be free-identifier=? to the one if I were to type
>>>>> >> it out by hand:
>>>>> >> #'(begin-for-syntax (define-values (x) '5), and expand that.
>>>>> >>
>>>>> >> If however, I have a `begin` rather than a `begin-for-syntax`, giving
>>>>> >> me:
>>>>> >> #'(begin (define-values (x) 5) it works as expected. (The quote it
>>>>> >> expands into is free-identifier=? to the one that I am using.)
>>>>> >>
>>>>> >> I am calling expand (or expand-syntax) directly, and not really using
>>>>> >> any phase levels outside of whatever `expand` may use.
>>>>> >>
>>>>> >> Here is my code: http://pasterack.org/pastes/78711
>>>>> >>
>>>>> >> #lang racket
>>>>> >>
>>>>> >> (define x (expand #'(begin-for-syntax
>>>>> >>   (define-values (x) '5
>>>>> >> (define y (expand #'(begin-for-syntax
>>>>> >>   (define-values (x) 5)

[racket-users] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
I'm fixing pr 15227 but I would like to do so in a backwards-incompatible way.

Right now an out-of-range index is sometimes allowed as an argument to
in-vector, leading to the bug:

$ racket
Welcome to Racket v6.4.0.4.
-> (for/sum ([x (in-vector (vector 10 20) 2 -1 -1)]) x)
SIGSEGV MAPERR si_code 1 fault on addr 0x180
Aborted

>From what I can tell, the out-of-range index is allowed to enable this program:

(in-vector (vector) 0 0)

I want to change in-vector so that the starting index is always a
valid vector-ref. The above program would become illegal.

>From what I gather, the above program is allowed so that in-vector
mimics in-range but I don't think this makes sense either if it means
allowing out-of-range indices for the former.

Any objections?

-- 
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] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
Yes, or course it's possible, at the expense of more unreadable code.

But the zero special case doesnt make sense. And is inconsistent with
other out-of-range cases, eg (in-vector (vector) 1 1) errors

To be clear, empty traversals with valid indices would still be legal,
eg (in-vector (vector 1 2) 1 1)

On Tue, Jan 19, 2016 at 2:06 PM, Vincent St-Amour
 wrote:
> Would it be possible to special-case `(in-vector (vector) 0 0)`
> directly, and fix the bug while keeping backwards compatibility?
>
> Vincent
>
>
> On Tue, 19 Jan 2016 12:19:12 -0600,
> Stephen Chang wrote:
>>
>> I'm fixing pr 15227 but I would like to do so in a backwards-incompatible 
>> way.
>>
>> Right now an out-of-range index is sometimes allowed as an argument to
>> in-vector, leading to the bug:
>>
>> $ racket
>> Welcome to Racket v6.4.0.4.
>> -> (for/sum ([x (in-vector (vector 10 20) 2 -1 -1)]) x)
>> SIGSEGV MAPERR si_code 1 fault on addr 0x180
>> Aborted
>>
>> From what I can tell, the out-of-range index is allowed to enable this 
>> program:
>>
>> (in-vector (vector) 0 0)
>>
>> I want to change in-vector so that the starting index is always a
>> valid vector-ref. The above program would become illegal.
>>
>> From what I gather, the above program is allowed so that in-vector
>> mimics in-range but I don't think this makes sense either if it means
>> allowing out-of-range indices for the former.
>>
>> Any objections?
>>
>> --
>> 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.

-- 
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] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
> I think you should not change this backwards compatibility unless you
> really know it isn't used (and even then it is hard to know such
> things).

Well I still think these programs would be relying on a bug, since
they are referencing a non-existent vector element.

But since there's no agreement, I'll leave it for now.

I'll just add a special case for empty vectors and 0,0.

It's probably not worth it to add yet-another new special case, as in
Matthew's email, right?




>
> Robby
>
> On Tue, Jan 19, 2016 at 1:16 PM, Stephen Chang  wrote:
>> Yes, or course it's possible, at the expense of more unreadable code.
>>
>> But the zero special case doesnt make sense. And is inconsistent with
>> other out-of-range cases, eg (in-vector (vector) 1 1) errors
>>
>> To be clear, empty traversals with valid indices would still be legal,
>> eg (in-vector (vector 1 2) 1 1)
>>
>> On Tue, Jan 19, 2016 at 2:06 PM, Vincent St-Amour
>>  wrote:
>>> Would it be possible to special-case `(in-vector (vector) 0 0)`
>>> directly, and fix the bug while keeping backwards compatibility?
>>>
>>> Vincent
>>>
>>>
>>> On Tue, 19 Jan 2016 12:19:12 -0600,
>>> Stephen Chang wrote:
>>>>
>>>> I'm fixing pr 15227 but I would like to do so in a backwards-incompatible 
>>>> way.
>>>>
>>>> Right now an out-of-range index is sometimes allowed as an argument to
>>>> in-vector, leading to the bug:
>>>>
>>>> $ racket
>>>> Welcome to Racket v6.4.0.4.
>>>> -> (for/sum ([x (in-vector (vector 10 20) 2 -1 -1)]) x)
>>>> SIGSEGV MAPERR si_code 1 fault on addr 0x180
>>>> Aborted
>>>>
>>>> From what I can tell, the out-of-range index is allowed to enable this 
>>>> program:
>>>>
>>>> (in-vector (vector) 0 0)
>>>>
>>>> I want to change in-vector so that the starting index is always a
>>>> valid vector-ref. The above program would become illegal.
>>>>
>>>> From what I gather, the above program is allowed so that in-vector
>>>> mimics in-range but I don't think this makes sense either if it means
>>>> allowing out-of-range indices for the former.
>>>>
>>>> Any objections?
>>>>
>>>> --
>>>> 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.
>>
>> --
>> 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.

-- 
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] Chaperone of immutable hash

2016-02-13 Thread Stephen Chang
I added similar basic tests here.

https://github.com/racket/racket/blob/master/pkgs/racket-test-core/tests/racket/hash.rktl
On Feb 13, 2016 4:12 PM, "Robby Findler" 
wrote:

> I think this is what you want?
>
> (chaperone-hash
>  (hash)
>  (λ (h key) (values key (λ (h key val) val)))
>  (λ (h key val) (values key val))
>  (λ (h key) key)
>  (λ (h key) key)
>  (λ (hash) 'okay)
>  (λ (hash key) key))
>
>
>
>
> On Sat, Feb 13, 2016 at 3:02 PM, Gustavo Massaccesi 
> wrote:
> > I want to make a test with a chaperone of an immutable hash, but the
> > signature of make-chaperone-hash has too many parts.
> >
> > Do anyone have an example of use of make-chaperone-hash. If possible,
> > the chaperone that does nothing, only forward the values.
> >
> > Gustavo
> >
> > --
> > 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.
>

-- 
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] Strange Output from check-expect ???

2016-02-24 Thread Stephen Chang
Thanks for the report. Which version are you using? I'm seeing that
the behavior appears in 6.3 but is fixed in 6.4.

On Wed, Feb 24, 2016 at 4:22 PM, Jeffrey Edgington  wrote:
> I am getting an unexpected message from check-expect when I try the following:
>
> #lang racket
> (require test-engine/racket-tests)
>
> (struct element (x y) #:transparent)
>
> (define (make-element-list n)
>   (for*/list ([i n][j n]) (element (+ i 1) (+ j 1
>
> (check-expect (make-element-list 1) 0)
>
> (test)
>
>
> The result is:
>
> Ran 1 check.
> 0 checks passed.
> Actual value differs from the expected value.
> Actual value: ))1 1 tnemele( tsil(
>   Expected value: 0
>
>
>
> but for example if I type the following into the interactions pane:
>
>> (make-element-list 1)
> (list (element 1 1))
>
> Which is what I want… Why is the message from check-expect reversed?
>
> Thanks!
>
> Jeffrey Edgington
>
>
> --
> 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] Writing a blank to a file

2016-03-02 Thread Stephen Chang
Use display? or set read-accept-bar-quote to #f

On Wed, Mar 2, 2016 at 1:12 PM, Marco Morazan  wrote:
>
> Hi All,
>
> I seem to recall I knew how to do this once, but can't recall the details.
>
> How do we write a blank to a text file without the parallel bars appearing?
>
> So, (write '| | outfile) produces | | in the file. I want to eliminate the 
> vertical bars.
>
> Thanks,
>
> Marco
>
> --
> 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] Re: Racket 6.4 very slow

2016-03-02 Thread Stephen Chang
In general, times reported in DrRacket are unreliable.

See: 
https://docs.racket-lang.org/guide/performance.html#%28part._.Dr.Racket-perf%29

Try the command line. Here's what I get on my machine:

$ ~/racket61/bin/racket
Welcome to Racket v6.1.
-> (define (total n)
 (for/sum ([x (in-range (+ 1 n))]) x))
-> (time (total 10))
cpu time: 3044 real time: 3051 gc time: 0
55

$ ~/racket62/bin/racket
Welcome to Racket v6.2.
-> (define (total n)
 (for/sum ([x (in-range (+ 1 n))]) x))
-> (time (total 10))
cpu time: 3036 real time: 3046 gc time: 0
55

$ ~/racket63/bin/racket
Welcome to Racket v6.3.
-> (define (total n)
 (for/sum ([x (in-range (+ 1 n))]) x))
-> (time (total 10))
cpu time: 3040 real time: 3045 gc time: 0
55

$ ~/racket64/bin/racket
Welcome to Racket v6.4.
-> (define (total n)
(for/sum ([x (in-range (+ 1 n))]) x))
-> (time (total 10))
cpu time: 3036 real time: 3041 gc time: 0
55



On Wed, Mar 2, 2016 at 1:31 PM, Matthias Felleisen  wrote:
>
> It sounds like your files are not compiled. Try
>
>  raco setup
>
> in a shell. You may need to supply some command line flags if your files are 
> half way compiled.
>
> (Your examples runs in 3200 ms on my Mac in Racket 6.4.1)
>
>
>
> On Mar 2, 2016, at 1:26 PM, vkelmenson via Racket Users 
>  wrote:
>
>> On Tuesday, March 1, 2016 at 10:51:58 PM UTC-5, vkelm...@aol.com wrote:
>>> I recently downloaded Racket version 6.4. I have previously been using 
>>> version 6.1. It is much slower than version 6.1. Several short functions 
>>> run approx 20 times slower on 6.4 than 6.1. These were run at the same time 
>>> on the sam matine in succession.
>>> I am using Mac osX version 10.8.5
>>> Has anyone else noticed this?
>>
>> (define (total n)
>>  (for/sum ([x (in-range (+ 1 n))]) x))
>> (time (total 10))
>> in Racket 6.1 just now 5287 milliseconds. In Racket 6.4 102384 milliseconds.
>> Also: When I am typing in the interactions pane of 6.4 there is often a 1-2 
>> second delay before my
>> keystrokes show up.
>>
>> --
>> 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.

-- 
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] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Stephen Chang
Do you mean something like?

#lang racket
(require rackunit)
(require rackunit/gui)
(define tests
  (test-suite
   "my tests"
   (test-equal? "check 1" 1 1)
   (test-equal? "check 2" 2 2)))
(test/gui tests)

But that will pop a window. Alternatively,

#lang racket
(require rackunit)
(require rackunit/text-ui)

(define tests
  (test-suite
   "my tests"
   (test-equal? "check 1" 1 1)
   (test-equal? "check 2" 2 2)))
(run-tests tests)

produces:

2 success(es) 0 failure(s) 0 error(s) 2 test(s) run
0

where 0 is the number of unsuccessful tests.



On Sat, Mar 5, 2016 at 11:43 PM, Daniel Prager
 wrote:
> Is there a way to get a successful run of RackUnit tests to give a bit of
> encouragement?
>
> E.g. 12 out of 12 tests passed.
>
> The regular set-up seems to follow the "no news is good news" philosophy.
>
> Also, I couldn't figure out how to summon the rackunit/gui test runner
> (which may be what I want). What does a minimal example look like?
>
> Many thanks
>
> Dan
>
> --
> 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] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Stephen Chang
You can also submit the code to pasterack.org, which uses the scribble
css. Each paste page also gives the html source of the code and output
on the side, which you can copy to anywhere you want.

On Tue, Mar 15, 2016 at 7:11 PM, Sanjeev Sharma  wrote:
> is there a quick & dirty way to use scribble or the drracket GUI to generate 
> html for random code snippets?
>
> --
> 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] IO in racket is painful

2016-03-22 Thread Stephen Chang
A "read" variant that works with format strings would be a useful
addition I think.

Matthew, your solution is clever :) (but with symbols instead of strings).

Another alternative could be to use match:

#lang racket

(define (trim-brackets str)
  (string-trim str #rx"\\[|\\]|,"))

(define (pad n w)
  (~r n #:pad-string "0" #:min-width w))

(parameterize ([current-input-port (open-input-file "file.txt")])
  (for ([ln (in-lines)])
(match (string-split (trim-brackets ln) ", ")
  [(list (app string->number x)) (displayln x)]
  [(list (app string->number x) y (app string->number z))
   (printf "[~a, ~a, ~a]\n" (pad x 2) y (pad z 4))])))

or if you are willing to write a macro:

#lang racket

(define (trim-brackets str)
  (string-trim str #rx"\\[|\\]|,"))

(define (pad n w)
  (~r n #:pad-string "0" #:min-width w))

(define-match-expander numstr
  (syntax-rules () [(_ x) (app string->number x)]))

(parameterize ([current-input-port (open-input-file "file.txt")])
  (for ([ln (in-lines)])
(match (string-split (trim-brackets ln) ", ")
  [(list (numstr x)) (displayln x)]
  [(list (numstr x) y (numstr z))
   (printf "[~a, ~a, ~a]\n" (pad x 2) y (pad z 4))])))



(yes, I didnt close the port)

On Tue, Mar 22, 2016 at 6:34 PM, Matthew Butterick  wrote:
>> Then, for all rows, read and split the string. The best that i have found to 
>> do that is using regular expressions.
>>
>>   (define split-row (regexp-match #rx"\\[(.+), (.+), (.+)\\]" (read-line)))
>>
>> Then you have to manually convert the substrings into values
>>
>>   (define a (string->number (second split-row)))
>>   (define b (third split-row))
>>   (define c (string->number (fourth split-row)))
>
> This kind of destructuring & conversion from strings to values can sometimes 
> be more conveniently handled by converting your source data into something 
> that looks like Racket S-expressions (in this case, by removing the commas) 
> and then calling `read` to do the rest, e.g.
>
> #lang racket
> (with-input-from-file "data.txt"
>   (λ _ (for/list ([ln (in-lines)])
>  (read (open-input-string (string-replace ln "," ""))
>
> --
> 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] IO in racket is painful

2016-03-22 Thread Stephen Chang
> It may be overkill for this use case, but I would probably use the
> parsack package, since I think its interface is pretty intuitive.

:) I had started writing up a parsack example, and I was all set to
admonish the OP for not creating a parser when you want a parser but
then I saw it was for a programming contest where I guess this sort of
scanf/regexp hackery is ok?

> Should it throw an exception, or should it
> return #f? I’m not sure there is great precedent set here, though
> throwing seems to be the Racket way in other places.

printf throws an exception when there's a type mismatch, eg (printf "~b" "1")

(thanks for the example Ben)


>
> --
> 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] a little macro exercise

2010-10-09 Thread Stephen Chang
I've been feeling pretty good about my macro-fu recently so I gave it a shot
(I havent looked at anyone's solutions yet). This seems to pass all the test
cases but I dont think it passes the "linear" requirement yet.

(define-syntax (cas-cad-e stx)
 (syntax-case stx ()
   [(_ e ((v) exp ...))
(with-syntax ([break (datum->syntax stx 'break)])
  #'(call/cc
 (λ (break)
   (if (equal? e v)
   (begin exp ...)
   (void)]
   [(_ e ((v1) exp1 ...) ((v2) exp2 ...) ...)
(with-syntax ([break (datum->syntax stx 'break)])
  #'(call/cc
 (λ (break)
   (if (equal? e v1)
   (begin exp1 ... exp2 ... ...)
   (cas-cad-e e ((v2) exp2 ...) ...)]))





On Fri, Oct 8, 2010 at 9:04 PM, Shriram Krishnamurthi 
wrote:
> One of my students recently sent me this needless email message:
>
>> Well, how would you do switch fall-through in Scheme? Could you
>> write a version of the case statement that does that?
>
> Since the honor of Racket was at stake (yes, we can have all the same
> stupid features the scripting languages have!), I wrote down the code
> for this, and realized it would make a cute little macro exercise.
>
> Spec: define a case construct syntactically just like that of Racket.
> In terms of semantics:
>
> - each branch automatically falls through to the next,
>
> - the last one returns its answer since it has no next clause, and
>
> - any branch can contain (break ), which evaluates  and
> returns its value as that of the entire case.
>
> In honor of its behavor, we'll call this cas-cad-e.  Thus,
>
> (define (cas1 v)
>   (cas-cad-e v
>((1) (display "1"))
>((2) (display "2") (break 2)
>((3) 3
>
> (cas1 1) ==> 2   (and prints "12")
> (cas1 2) ==> 2   (and prints "2")
> (cas1 3) ==> 3   (and prints nothing)
> (cas1 4) ==>   (and prints nothing)
>
> If anyone wants to look at my solution, here it is:
>
>  http://github.com/shriram/cas-cad-e
>
> Of course, those who know how to do this don't need to peek, and those
> who don't shouldn't.
>
> Shriram
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Key Shortcuts

2011-01-03 Thread Stephen Chang
In Windows,

esc-ctrl-; comments

and

esc-ctrl-= uncomments

This is for emacs keybindings mode. I dont know if it works when emacs
keybindings are off.




On Mon, Jan 3, 2011 at 10:30 AM, Greg Hendershott
 wrote:
> In other words there aren't shortcut keys ("accelerators") per se
> bound to these commands. But you can use the keyboard to choose an
> item from a menu, as usual in Windows. (This is the one biggest thing
> I miss when I'm using OS X. (No, pressing C+F2 arrow arrow arrow arrow
> ... isn't the same :) )).
>
> So ALT+C opens the Ra_c_ket menu and C (or ALT+C is fine if you still
> have the ALT key held down) chooses the _C_omment Out with Semicolons
> command.
>
> On Sun, Jan 2, 2011 at 4:48 PM, Robby Findler
>  wrote:
>> On Sun, Jan 2, 2011 at 11:42 AM, Miguel Villaverde
>>  wrote:
>>> On Sun, Jan 2, 2011 at 6:49 AM, Sayth Renshaw 
>>> wrote:
 Are there any key shortcuts in racket to comment and uncomment a block of
 code?
>>>
>>> These ones, at least, are in the Racket menu (and so have shortcuts).
>
>>>
>>> Are you sure? I don't see them. I'm using the Windows version of DrRacket
>>> and the only commands that have keybindings under the Racket menu are Run,
>>> Ask the Program to Quit, Force the Program to Quit and Reindent All.
>>
>> Try alt-c and then c for comment out and alt-c u for uncomment.
>>
>> Robby
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Am I Missing Something? [HtDP 31.3.1]

2011-01-04 Thread Stephen Chang
I get results similar to Carl.

Welcome to DrRacket, version 5.0.1.7 [3m].
Language: Intermediate Student.
#i-0.49746596003269394
#i-0.4974659600326953
#i-4974659600326939.0
#i-4974659600326953.0
> (equal? (sum (g-series #i1000)) (accu-sum (g-series #i1000)))
false
> (equal? (* 10e15 (sum (g-series #i1000))) (* 10e15 (accu-sum (g-series 
> #i1000
false
>


Luke, can you post the output you get?




On Tue, Jan 4, 2011 at 10:57 AM, Carl Eastlund  wrote:
>
> On Tue, Jan 4, 2011 at 9:38 AM, Luke Jordan  wrote:
> > All that code came straight out of the text, except that I used if instead
> > of cond.  The sum, accu-sum, and g-series defs are all given.  In your
>
> Ah, yes, now I see where the accumulator-based sum is.  Sorry, my mistake.
>
> > results I see a difference.  When I run it at home it's the same.  I can
> > even (equal? (sum (listof number)) (accu-sum (listof number))) and get true.
>
> No idea what's going on.  Maybe someone else will have an idea.
>
> --Carl
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Couldn't find a step matching that criterion

2011-01-09 Thread Stephen Chang
Oh sorry, I didnt look at what the function was expected to do, just
at the code provided, which the stepper displays correctly.




On Sun, Jan 9, 2011 at 10:48 PM, Ken Hegeland  wrote:
> Does (check-color 'red 'red 'red 'green) seem like a perfect match?
> Now check
> (check-color 'green 'red 'red 'red)
> it's a very minor coding error I wanted to point out to sayth
>
> 
> From: Stephen Chang 
> To: Ken Hegeland 
> Cc: us...@lists.racket-lang.org
> Sent: Sun, January 9, 2011 9:54:08 PM
> Subject: Re: [racket] Couldn't find a step matching that criterion
>
> I get the following steps, which is what I would expect. Are you
> getting something different? What version are you using?
>
>
>
>
> On Sun, Jan 9, 2011 at 9:11 PM, Ken Hegeland  wrote:
>> I apologize, meant to say check:
>> (check-color 'red 'red 'red 'green)
>>
>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Basic Question

2011-01-25 Thread Stephen Chang
Can you be more specific? What specific problems are you running into
during installation? Is there an error message? What operating system
are you using?

It would probably be better for you to get help from your course
staff. Often, different schools require different configurations or
program versions, and your course staff would know about these things
better than we would.




On Sat, Jan 22, 2011 at 12:45 PM, Diana Maali  wrote:
> Hello,
>
> I am new to programming. I have an assignment which requires using your
> tool. I have downloaded the program but am having a hard time installing it?
> Where can I find instructions? I do not see any type of installer or
> executable. Please let me know!
>
> Thanks,
>
> Diana
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Exercise 3.1 HTDP Help

2011-01-25 Thread Stephen Chang
> 1st Question: Without the functions already defined how am I
> suppose to work through examples?!?!

The goal is to come up with examples before you write code. That way,
you can verify that you implemented your code correctly.


> 2nd Question: When it says "use the examples to formulate a
> general rule that shows the how to compute the number of
> attendees from the ticket price" I don't understand at all how
> to do this

Pretend the problem was given to you in an algebra course and try to
come up with the solution independent of any code.


> 3rd Question:

Doing the above should answer this question.
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Lazy take is the identity?

2011-01-26 Thread Stephen Chang
> P.S. I was surprised to see that list-ref in #lang lazy takes the args in
> opposite order than in #lang racket (which takes the list first).

I'm seeing the same behavior:

Welcome to DrRacket, version 5.0.99.6 [3m].
Language: Lazy Racket [custom].
> (list-ref '(1 2 3) 1)
2
> (list-ref 1 '(1 2 3))
. . C:\plt\collects\lazy\lazy.rkt:43:24: list-ref: expects type
 as 2nd argument, given: (1 2 3); other
arguments were: 1




On Wed, Jan 26, 2011 at 3:40 AM, Mark Engelberg
 wrote:
> I get an error in 5.0.2, rather than 0.
>
> --Mark
>
> P.S. I was surprised to see that list-ref in #lang lazy takes the args in
> opposite order than in #lang racket (which takes the list first).
>
> On Tue, Jan 25, 2011 at 11:27 PM, John Clements 
> wrote:
>>
>> I would expect this program to signal an error:
>>
>> #lang lazy
>>
>> (define zeros (cons 0 zeros))
>>
>> (define should-be-error (list-ref (take 15 zeros) 1324))
>>
>>
>> ... but instead should-be-error is bound to zero.  How can I take the
>> 1000th element of a list with only 15 elements?  I'm tempted to make snide
>> comments about laziness, but I'm sure it'll backfire when it turns out that
>> somehow that's the right answer after all.
>>
>> Bug report?
>>
>> John
>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Lazy take is the identity?

2011-01-26 Thread Stephen Chang
I meant to say, I'm seeing that list-ref behaves the same in #lang
lazy and #lang racket.


On Wed, Jan 26, 2011 at 11:12 AM, Stephen Chang  wrote:
>> P.S. I was surprised to see that list-ref in #lang lazy takes the args in
>> opposite order than in #lang racket (which takes the list first).
>
> I'm seeing the same behavior:
>
> Welcome to DrRacket, version 5.0.99.6 [3m].
> Language: Lazy Racket [custom].
>> (list-ref '(1 2 3) 1)
> 2
>> (list-ref 1 '(1 2 3))
> . . C:\plt\collects\lazy\lazy.rkt:43:24: list-ref: expects type
>  as 2nd argument, given: (1 2 3); other
> arguments were: 1
>
>
>
>
> On Wed, Jan 26, 2011 at 3:40 AM, Mark Engelberg
>  wrote:
>> I get an error in 5.0.2, rather than 0.
>>
>> --Mark
>>
>> P.S. I was surprised to see that list-ref in #lang lazy takes the args in
>> opposite order than in #lang racket (which takes the list first).
>>
>> On Tue, Jan 25, 2011 at 11:27 PM, John Clements 
>> wrote:
>>>
>>> I would expect this program to signal an error:
>>>
>>> #lang lazy
>>>
>>> (define zeros (cons 0 zeros))
>>>
>>> (define should-be-error (list-ref (take 15 zeros) 1324))
>>>
>>>
>>> ... but instead should-be-error is bound to zero.  How can I take the
>>> 1000th element of a list with only 15 elements?  I'm tempted to make snide
>>> comments about laziness, but I'm sure it'll backfire when it turns out that
>>> somehow that's the right answer after all.
>>>
>>> Bug report?
>>>
>>> John
>>>
>>>
>>> _
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/users
>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Lazy take is the identity?

2011-01-26 Thread Stephen Chang
On Wed, Jan 26, 2011 at 2:41 PM, John Clements
 wrote:
> Correct me if I'm wrong, but this appears to be a different issue.  The 
> question here is not laziness, but the length of the resulting list.  Here's 
> another example:
>
> #lang lazy
>
> (define zeros (cons 0 zeros))
>
> (define lazy-list-of-length-one (take 1 zeros))
>
> (define should-be-null (rest lazy-list-of-length-one))
>
> =>
>
> Welcome to DrRacket, version 5.0.99.6--2011-01-20(d675c7b/g) [3m].
> Language: lazy [custom]; memory limit: 256 MB.
>> (! should-be-null)
> '(0 . #)

Yes, I believe you've found a bug. When lazy-take was updated to fix
the bug pointed out by Casey, one of the legitimate combination of
arguments (n = 0, lst = non-null) was accidentally dropped. I just
tested an older version and your code works. I'm fixing it now.

Welcome to DrRacket, version 5.0.0.6 [3m].
Language: Lazy Racket [custom].
> should-be-null
()
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] HTDP 5.1.5

2011-01-31 Thread Stephen Chang
> can someone explain what I did wrong and how to correct this.

The error message you are getting seems like it's explaining your
problem pretty clearly. I dont know if it's possible to explain it any
other way. Re-read chapter 5 to see how strings are compared for
equality if you are still confused.




On Mon, Jan 31, 2011 at 11:25 AM, Jeremy Duenas  wrote:
> Ok so I wrote and compiled my code:
> [code]
> ;;check-color: symbol symbol symbol symbol -> symbol
> ;;consumes four colors. 1 player picks two colors, the 2nd player guesses
> the colors. check-color simulates the 1st players checking action. It
> consumes four colors. The 1st two arguments to check-color are "targets" and
> the latter two are "guesses". the function produces one of the four
> answers.
> ;;example: (master check-color) = 'Perfect
> ;;         (masster check-color) = 'OneColorCorrectPosition
> ;;         (master check-color) = 'OneColorOccurs
> ;;         (master cheeck-color) = NothingCorrect
> (define t1 'red)
> (define t2 'green)
> (define (check-color t1 t2 g1 g2)
>   (cond
>     [(and (= t1 g1)(= t2 g2)) 'Perfect]
>     [(or (= t1 g1)(= t2 g2)) 'OneColorOccurs]
>     [(or (or (= t1 g1)(= t1 g2))(or (= t2 g1)(= t2 g2))) 'OneColorOccurs]
>     [else 'NothingCorrect]))
> [/code]
> It compiles correctly, but then when I run it using the master.ss  teachpack
> as told (master check-color) and choose two colors, I get the error:
>  =: expects type  as 1st argument, given: 'green; other arguments
> were: 'red
> can someone explain what I did wrong and how to correct this.
>
> Jeremy D. Duenas
> 714.864.9686
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] shared and immutable structures

2011-02-01 Thread Stephen Chang
So why wouldnt using a mutable struct work?

> (struct kons (first rest) #:transparent #:mutable)
> (shared ([a (kons 1 a)]) a)
#0=(kons 1 #0#)




On Tue, Feb 1, 2011 at 10:33 AM, Matthew Flatt  wrote:
> At Tue, 01 Feb 2011 10:14:57 -0500, David Van Horn wrote:
>>  > (shared ([a (cons 1 a)])
>>      a)
>> #0='(1 . #0#)
>>
>>  > (struct kons (first rest) #:transparent)
>>  > (shared ([a (kons 1 a)])
>>      a)
>> (kons 1 #)
>>
>> Is there a way to get the kons structure to behave like cons?
>
> No. The `shared' form can only create cycles with mutable structures.
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] HTDP 5.1.5

2011-02-02 Thread Stephen Chang
Nice! Also, it's been pointed out that I made a typo in my previous
email. I meant symbols where I said strings, as you figured out.



On Mon, Jan 31, 2011 at 12:20 PM, Jeremy Duenas  wrote:
> Thank you so much. I was able to figure it out. I don't know why I didn't
> think of utilizing the symbol=?
> After re-reading the error and not over thinking it I was able to see what I
> needed to do
> Jeremy D. Duenas
> 714.864.9686
>
>
>
> On Mon, Jan 31, 2011 at 8:25 AM, Jeremy Duenas  wrote:
>>
>> Ok so I wrote and compiled my code:
>> [code]
>> ;;check-color: symbol symbol symbol symbol -> symbol
>> ;;consumes four colors. 1 player picks two colors, the 2nd player guesses
>> the colors. check-color simulates the 1st players checking action. It
>> consumes four colors. The 1st two arguments to check-color are "targets" and
>> the latter two are "guesses". the function produces one of the four
>> answers.
>> ;;example: (master check-color) = 'Perfect
>> ;;         (masster check-color) = 'OneColorCorrectPosition
>> ;;         (master check-color) = 'OneColorOccurs
>> ;;         (master cheeck-color) = NothingCorrect
>> (define t1 'red)
>> (define t2 'green)
>> (define (check-color t1 t2 g1 g2)
>>   (cond
>>     [(and (= t1 g1)(= t2 g2)) 'Perfect]
>>     [(or (= t1 g1)(= t2 g2)) 'OneColorOccurs]
>>     [(or (or (= t1 g1)(= t1 g2))(or (= t2 g1)(= t2 g2))) 'OneColorOccurs]
>>     [else 'NothingCorrect]))
>> [/code]
>> It compiles correctly, but then when I run it using the master.ss
>>  teachpack as told (master check-color) and choose two colors, I get the
>> error:
>>  =: expects type  as 1st argument, given: 'green; other arguments
>> were: 'red
>> can someone explain what I did wrong and how to correct this.
>>
>> Jeremy D. Duenas
>> 714.864.9686
>>
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Setting background color in slideshow

2011-02-02 Thread Stephen Chang
Check out current-slide-assembler

http://docs.racket-lang.org/slideshow/Configuration.html?q=current-slide-assembler&q=slide#%28def._%28%28lib._slideshow/base..rkt%29._current-slide-assembler%29%29




On Wed, Feb 2, 2011 at 11:30 AM, Laurent  wrote:
> Why not create an rectangle the size of the viewport and colorize it?
> There are also some functions to modify the slide template (can't remember
> their names right now).
>
> Laurent
>
> On Wed, Feb 2, 2011 at 17:25, Evan Farrer  wrote:
>>
>> I'm attempting to use slideshow for a presentation and I really want to
>> use white text on a black background. I can see how to change the color of
>> the text, but I don't see how to manipulate the color of the blackground.
>> I'm currently using v5.1.0.2 from git.
>>
>> Evan
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] FTP strange behavior

2011-02-08 Thread Stephen Chang
The ftp.datasus server returns the 125 code when a user tries to get
something while connected using passive mode, which is what net/ftp
does. But the code errors because it is only expecting 150 return
codes from the server. I'm inclined to believe it's a bug with
net/ftp, since the transfer completes successfully (the file in the
example code is no longer available but i tried with another site).
I've checked in a fix allowing the 125 return code, but I'm not
familiar enough with ftp protocol to know if there are other cases
that are missing.





On Mon, Feb 7, 2011 at 2:02 PM, Jay McCarthy  wrote:
> I can tell you what it means, but I don't know why it would do it...
>
> 2011/2/7 Eduardo Bellani :
>> Hello list
>>
>> I am getting an error out of this snippet that I think I should not be
>> getting:
>>
>> (require net/ftp)
>>
>>
>> (define conn (ftp-establish-connection "ftp.datasus.gov.br" 21
>> "anonymous" ""))
>>
>> (ftp-cd conn "siasus/Documentos")
>>
>> (ftp-download-file conn "./" "APAC.xls")
>
> This establishes a connection on the side to receive the data. There
> is normally just one per transfer. Maybe the server is sending the
> message multiple times? And so it is trying to open two? Can you use
> WireShark to get a transcript of the session?
>
> Jay
>
>>
>> (ftp-close-connection conn)
>>
>>
>> the error is
>> ftp: exected result code 150, got 125 Data connection already open;
>> Transfer starting.
>>
>> My version is 5.0.2/linux
>>
>> Could anyone tell me what could be wrong?
>>
>> --
>> Eduardo Bellani
>>
>> omnia mutantur, nihil interit.
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
>
>
> --
> Jay McCarthy 
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
>
> "The glory of God is Intelligence" - D&C 93
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] FTP strange behavior

2011-02-16 Thread Stephen Chang
Yes, it seems correct. Does it not work?


On Wed, Feb 16, 2011 at 2:32 PM, Eduardo Bellani  wrote:
> Am I using this correctly?
>
> #lang racket
>
> ;; wget ftp://download.intel.com/research/silicon/moorespaper.pdf #works
>
> (require net/ftp)
>
> (define conn (ftp-establish-connection "download.intel.com" 21
> "anonymous" ""))
>
> (ftp-cd conn "/research/silicon")
>
> (ftp-download-file conn "/home/X" "moorespaper.pdf")
>
>
> Thanks
> On 02/16/2011 01:36 PM, Jay McCarthy wrote:
>> I'm pretty sure it was committed in time.
>>
>> Jay
>>
>> 2011/2/16 Eduardo Bellani :
>>> Is that fix available in the new 5.1 distribution? Or should I compile
>>> from source?
>>>
>>> Thanks a lot for the fix btw.
>>>
>>> On 02/08/2011 04:17 PM, Stephen Chang wrote:
>>>> The ftp.datasus server returns the 125 code when a user tries to get
>>>> something while connected using passive mode, which is what net/ftp
>>>> does. But the code errors because it is only expecting 150 return
>>>> codes from the server. I'm inclined to believe it's a bug with
>>>> net/ftp, since the transfer completes successfully (the file in the
>>>> example code is no longer available but i tried with another site).
>>>> I've checked in a fix allowing the 125 return code, but I'm not
>>>> familiar enough with ftp protocol to know if there are other cases
>>>> that are missing.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Feb 7, 2011 at 2:02 PM, Jay McCarthy  
>>>> wrote:
>>>>> I can tell you what it means, but I don't know why it would do it...
>>>>>
>>>>> 2011/2/7 Eduardo Bellani :
>>>>>> Hello list
>>>>>>
>>>>>> I am getting an error out of this snippet that I think I should not be
>>>>>> getting:
>>>>>>
>>>>>> (require net/ftp)
>>>>>>
>>>>>>
>>>>>> (define conn (ftp-establish-connection "ftp.datasus.gov.br" 21
>>>>>> "anonymous" ""))
>>>>>>
>>>>>> (ftp-cd conn "siasus/Documentos")
>>>>>>
>>>>>> (ftp-download-file conn "./" "APAC.xls")
>>>>>
>>>>> This establishes a connection on the side to receive the data. There
>>>>> is normally just one per transfer. Maybe the server is sending the
>>>>> message multiple times? And so it is trying to open two? Can you use
>>>>> WireShark to get a transcript of the session?
>>>>>
>>>>> Jay
>>>>>
>>>>>>
>>>>>> (ftp-close-connection conn)
>>>>>>
>>>>>>
>>>>>> the error is
>>>>>> ftp: exected result code 150, got 125 Data connection already open;
>>>>>> Transfer starting.
>>>>>>
>>>>>> My version is 5.0.2/linux
>>>>>>
>>>>>> Could anyone tell me what could be wrong?
>>>>>>
>>>>>> --
>>>>>> Eduardo Bellani
>>>>>>
>>>>>> omnia mutantur, nihil interit.
>>>>>> _
>>>>>>  For list-related administrative tasks:
>>>>>>  http://lists.racket-lang.org/listinfo/users
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Jay McCarthy 
>>>>> Assistant Professor / Brigham Young University
>>>>> http://faculty.cs.byu.edu/~jay
>>>>>
>>>>> "The glory of God is Intelligence" - D&C 93
>>>>>
>>>>> _
>>>>>  For list-related administrative tasks:
>>>>>  http://lists.racket-lang.org/listinfo/users
>>>
>>>
>>> --
>>> Eduardo Bellani
>>>
>>> omnia mutantur, nihil interit.
>>>
>>
>>
>>
>
>
> --
> Eduardo Bellani
>
> omnia mutantur, nihil interit.
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] FTP strange behavior

2011-02-16 Thread Stephen Chang
I ran the code in your email and it successfully downloaded the file.



On Wed, Feb 16, 2011 at 2:32 PM, Eduardo Bellani  wrote:
> Am I using this correctly?
>
> #lang racket
>
> ;; wget ftp://download.intel.com/research/silicon/moorespaper.pdf #works
>
> (require net/ftp)
>
> (define conn (ftp-establish-connection "download.intel.com" 21
> "anonymous" ""))
>
> (ftp-cd conn "/research/silicon")
>
> (ftp-download-file conn "/home/X" "moorespaper.pdf")
>
>
> Thanks
> On 02/16/2011 01:36 PM, Jay McCarthy wrote:
>> I'm pretty sure it was committed in time.
>>
>> Jay
>>
>> 2011/2/16 Eduardo Bellani :
>>> Is that fix available in the new 5.1 distribution? Or should I compile
>>> from source?
>>>
>>> Thanks a lot for the fix btw.
>>>
>>> On 02/08/2011 04:17 PM, Stephen Chang wrote:
>>>> The ftp.datasus server returns the 125 code when a user tries to get
>>>> something while connected using passive mode, which is what net/ftp
>>>> does. But the code errors because it is only expecting 150 return
>>>> codes from the server. I'm inclined to believe it's a bug with
>>>> net/ftp, since the transfer completes successfully (the file in the
>>>> example code is no longer available but i tried with another site).
>>>> I've checked in a fix allowing the 125 return code, but I'm not
>>>> familiar enough with ftp protocol to know if there are other cases
>>>> that are missing.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Feb 7, 2011 at 2:02 PM, Jay McCarthy  
>>>> wrote:
>>>>> I can tell you what it means, but I don't know why it would do it...
>>>>>
>>>>> 2011/2/7 Eduardo Bellani :
>>>>>> Hello list
>>>>>>
>>>>>> I am getting an error out of this snippet that I think I should not be
>>>>>> getting:
>>>>>>
>>>>>> (require net/ftp)
>>>>>>
>>>>>>
>>>>>> (define conn (ftp-establish-connection "ftp.datasus.gov.br" 21
>>>>>> "anonymous" ""))
>>>>>>
>>>>>> (ftp-cd conn "siasus/Documentos")
>>>>>>
>>>>>> (ftp-download-file conn "./" "APAC.xls")
>>>>>
>>>>> This establishes a connection on the side to receive the data. There
>>>>> is normally just one per transfer. Maybe the server is sending the
>>>>> message multiple times? And so it is trying to open two? Can you use
>>>>> WireShark to get a transcript of the session?
>>>>>
>>>>> Jay
>>>>>
>>>>>>
>>>>>> (ftp-close-connection conn)
>>>>>>
>>>>>>
>>>>>> the error is
>>>>>> ftp: exected result code 150, got 125 Data connection already open;
>>>>>> Transfer starting.
>>>>>>
>>>>>> My version is 5.0.2/linux
>>>>>>
>>>>>> Could anyone tell me what could be wrong?
>>>>>>
>>>>>> --
>>>>>> Eduardo Bellani
>>>>>>
>>>>>> omnia mutantur, nihil interit.
>>>>>> _
>>>>>>  For list-related administrative tasks:
>>>>>>  http://lists.racket-lang.org/listinfo/users
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Jay McCarthy 
>>>>> Assistant Professor / Brigham Young University
>>>>> http://faculty.cs.byu.edu/~jay
>>>>>
>>>>> "The glory of God is Intelligence" - D&C 93
>>>>>
>>>>> _
>>>>>  For list-related administrative tasks:
>>>>>  http://lists.racket-lang.org/listinfo/users
>>>
>>>
>>> --
>>> Eduardo Bellani
>>>
>>> omnia mutantur, nihil interit.
>>>
>>
>>
>>
>
>
> --
> Eduardo Bellani
>
> omnia mutantur, nihil interit.
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] FTP strange behavior

2011-02-16 Thread Stephen Chang
> If this is re c52b702, then it's not in.  (It was not indicated that
> it should be merged, and it was done late enough that I didn't ask.)

Yes, that is the commit.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] My PLT->Racket porting experience

2011-03-03 Thread Stephen Chang
> This particular problem of occluded dialog boxes occurred on occasion
> in my Bootstrap classes, too, using DrScheme from PLT 4.2.x, so it
> was independently reproducible on different Macs, in different schools,
> running various versions of Mac OS X. Have you tried adding a teachpack
> that already exists while in Beginner mode, prompting the overwrite
> warning dialog? That's when I encountered it with Racket 5.1 on Mac
> OS X 10.6.

I've never seen a dialog box appear behind another window in drracket,
but I have on occasion, due to my own doing, lost a dialog box behind
another window, and subsequently gotten frustrated when the buttons in
drracket become unresponsive, like what Drew described.

One possible solution could be to make certain dialog boxes "always on
top" so that they cant be lost. A quick search shows that the windows
api has a SetWindowPos function that allows this behavior if the right
parameter is specified.

http://msdn.microsoft.com/en-us/library/ms633545%28v=vs.85%29.aspx

I have no idea if racket even uses this call or if this can be done in
bootstrap and I was unable to find anything similar for mac or linux,
but it's just a thought.




>> And from the 'tone' of your message, I am sure you understand
>> that v5 is a major change/step from v4.
>
> Yes, in particular I'm aware of the GUI changes, so while the slower
> scrolling performance is annoying, it's understandable.
>
>> So thanks again. Could you do us a favor and submit future
>> bugs via the drracket bug report system? -- Matthias
>
> I considered it this time, but decided to post to the list with
> the hope that the problems I encountered, and their resolutions,
> will be useful to others in the future. I cursorily searched the
> "users" list for solutions to the play-sound problems (and to
> a problem I'm having with threads on Windows, more on that when
> I can write a simple test case to demonstrate the problem), but
> didn't find much help.
>
> Would you prefer that I file bugs for the problems I reported
> in my earlier message?
>
> thanks
> d
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] preference: 32-bit or 64-bit racket?

2011-03-09 Thread Stephen Chang
You can build on Windows with VC Express. You just cant use the
build.bat script bc there's no devenv. If you use the vcbuild command
line tool that comes with VC express, you get some errors.






On Wed, Mar 9, 2011 at 5:37 PM, Greg Hendershott
 wrote:
> Oh I didn't realize that, I thought it still experimental-ish. That's great.
>
> Building Racket on Windows has seemed daunting. For the same reasons
> I'm using Racket I don't have full MSVC installed these days (IIUC you
> can't build with Express). And gcc has felt like more Cygwin than I've
> really wanted on my laptop. But when I get some time to try I will
> give it a shot.
>
> It would also be positive to have an official build someday. Vista 64
> was otaku. Windows 7 64-bit is quite mainstream.
>
> On Wed, Mar 9, 2011 at 2:09 PM, Matthew Flatt  wrote:
>> We don't yet have a 64-bit build for Windows on the download pages, but
>> Racket builds, runs, and is supported for 64-bit mode in Windows (Vista
>> and up).
>>
>> At Wed, 9 Mar 2011 13:56:56 -0500, Greg Hendershott wrote:
>>> On Windows 7 I would if I could. A 64-bit build of Racket for Windows
>>> could utilize more than 2 GB.
>>>
>>> On Wed, Mar 9, 2011 at 9:46 AM, Noel Welsh  wrote:
>>> > Increased memory bandwidth and more registers are the main benefits
>>> > I'm aware of. I'm not sure if Racket exploits the later, but it should
>>> > benefit from the former.
>>> >
>>> > N.
>>> >
>>> > On Wed, Mar 9, 2011 at 2:35 PM, John Clements 
>>> wrote:
>>> > ...
>>> >>
>>> >> In any case, I thought I'd just ask: how many of you are using 64-bit
>>> builds, and how many are using 32-bit builds? Are there compelling 
>>> advantages
>>> to the 64-bit build that aren't occurring to me?
>>> >>
>>> >> John
>>> > _
>>> >  For list-related administrative tasks:
>>> >  http://lists.racket-lang.org/listinfo/users
>>> >
>>>
>>> _
>>>   For list-related administrative tasks:
>>>   http://lists.racket-lang.org/listinfo/users
>>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] preference: 32-bit or 64-bit racket?

2011-03-09 Thread Stephen Chang
Here's how to compile on windows with vc express. It's obviously more
tedious than using the build script, but it's not too bad.

COMPILING Racket from source in Windows with Visual C++ Express 2008:
(*NOTE: I'm using "plt" as the base directory for the repository)
(basically following the appropriate steps of plt\src\worksp\build.bat
but doing it manually bc VS Express doesnt have devenv.exe)
(these steps are also outlined in plt\src\worksp\README but less succinctly)


1) open plt\src\worksp\racket\racket.sln with VC Express
2) Build -> Build Solution (Release Win32 version)
3) open plt\src\worksp\gracket\gracket.sln
4) Build -> Build Solution (Release Win32 version)
5) from a cmd prompt, run vsvars32.bat (should be in \program
files\Microsoft Visual Studio 9.0\Common7\Tools\) to "Set environment
for using Microsoft Visual Studio 2008 x86 tools."
6) from plt\src\worksp\gc2, run ..\..\..\racketcgc.exe -c make.rkt
7) you may or may not need this step to get some necessary libs:
from plt\src\worksp\,
run ..\..\racket -cu ..\get-libs.rkt core ..\..\lib
and ..\..\racket -cu ..\get-libs.rkt gui  ..\..\lib
8) open plt\src\worksp\mrstart\mrstart.sln with Visual C++ Express and
compile like previous steps
9) open plt\src\worksp\mzstart\mzstart.sln with Visual C++ Express and
compile like previous steps
10) from plt\, run racket -l setup -N "raco setup" to build other exe's







On Wed, Mar 9, 2011 at 6:18 PM, Stephen Chang  wrote:
> You can build on Windows with VC Express. You just cant use the
> build.bat script bc there's no devenv. If you use the vcbuild command
> line tool that comes with VC express, you get some errors.
>
>
>
>
>
>
> On Wed, Mar 9, 2011 at 5:37 PM, Greg Hendershott
>  wrote:
>> Oh I didn't realize that, I thought it still experimental-ish. That's great.
>>
>> Building Racket on Windows has seemed daunting. For the same reasons
>> I'm using Racket I don't have full MSVC installed these days (IIUC you
>> can't build with Express). And gcc has felt like more Cygwin than I've
>> really wanted on my laptop. But when I get some time to try I will
>> give it a shot.
>>
>> It would also be positive to have an official build someday. Vista 64
>> was otaku. Windows 7 64-bit is quite mainstream.
>>
>> On Wed, Mar 9, 2011 at 2:09 PM, Matthew Flatt  wrote:
>>> We don't yet have a 64-bit build for Windows on the download pages, but
>>> Racket builds, runs, and is supported for 64-bit mode in Windows (Vista
>>> and up).
>>>
>>> At Wed, 9 Mar 2011 13:56:56 -0500, Greg Hendershott wrote:
>>>> On Windows 7 I would if I could. A 64-bit build of Racket for Windows
>>>> could utilize more than 2 GB.
>>>>
>>>> On Wed, Mar 9, 2011 at 9:46 AM, Noel Welsh  wrote:
>>>> > Increased memory bandwidth and more registers are the main benefits
>>>> > I'm aware of. I'm not sure if Racket exploits the later, but it should
>>>> > benefit from the former.
>>>> >
>>>> > N.
>>>> >
>>>> > On Wed, Mar 9, 2011 at 2:35 PM, John Clements 
>>>> wrote:
>>>> > ...
>>>> >>
>>>> >> In any case, I thought I'd just ask: how many of you are using 64-bit
>>>> builds, and how many are using 32-bit builds? Are there compelling 
>>>> advantages
>>>> to the 64-bit build that aren't occurring to me?
>>>> >>
>>>> >> John
>>>> > _
>>>> >  For list-related administrative tasks:
>>>> >  http://lists.racket-lang.org/listinfo/users
>>>> >
>>>>
>>>> _
>>>>   For list-related administrative tasks:
>>>>   http://lists.racket-lang.org/listinfo/users
>>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] preference: 32-bit or 64-bit racket?

2011-03-09 Thread Stephen Chang
> Forgive me, but this could stand to be mentioned at least once a year, as a
> reminder... PC hardware tends to become more useful for most technical work
> if one erases Windows and installs GNU/Linux.

I dont disagree but linux still has some mild annoyances with my
laptop, so i run windows.


> (Nowadays, with GNU/Linux being the technical and server platform, and most
> things being doable in a Web browser or on a phone, Windows is mostly useful
> for two purposes: as a program loader for FPS video games, and for
> secretaries who still like to email around .doc files that only work with
> the latest version of MS Word.)




> Stephen Chang wrote at 03/09/2011 06:18 PM:
>>
>> You can build on Windows with VC Express. You just cant use the build.bat
>> script bc there's no devenv. If you use the vcbuild command line tool that
>> comes with VC express, you get some errors.
>
> --
> http://www.neilvandyke.org/
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Increasing the font size of slideshow's commentary window

2011-03-11 Thread Stephen Chang
I've never tried this, but it looks like "comment" can take a pict, so
you can use "text" to create something of the size you want and then
give that to "comment".

http://docs.racket-lang.org/slideshow/Basic_Pict_Constructors.html?q=test#%28def._%28%28lib._slideshow/pict..rkt%29._text%29%29
http://docs.racket-lang.org/slideshow/Primary_Slide_Functions.html#%28def._%28%28lib._slideshow/base..rkt%29._comment%29%29




On Fri, Mar 11, 2011 at 12:10 AM, Evan Farrer  wrote:
>
> I'm using the slideshow program to make some slides and I was wondering if it 
> was possible to increase the font size that is used in the commentary window. 
> I must be getting old because I have a hard time seeing my comments when I'm 
> a few feet away from my laptop. I'm using version 
> 5.1.0.2--2011-02-01(aed0980/g) [3m], from git but can up/down grade if needed.
>
> Thanks,
>
> Evan Farrer
>
> P.S. Thanks for saving me from PowerPoint death.
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Simply Scheme in Racket

2011-04-26 Thread Stephen Chang
Works for me. Do you get an error message?




On Tue, Apr 26, 2011 at 7:52 AM, Matthias Felleisen
 wrote:
>
> On Apr 25, 2011, at 8:25 PM, joseph alicandro wrote:
>
> how to run "Simply Scheme" in racket. With the old PLT Scheme it was just a
> matter of adding  (require(planet "simply-scheme.ss" ("dyoo"
> "simply-scheme.plt" 1 1))) and it worked beautifully.
>
> Are you sure it doesn't work now?
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket] different text colors in Redex traces nodes?

2011-05-03 Thread Stephen Chang
When using Redex, for the traces nodes, is there any way to specify
how to color the text in each node? For example, I want to be able to
quickly identify the redex in each step by giving it a different
color. I looked in the docs and it seems like there are ways to color
the background and the arrows and the arrow labels, but not the actual
text of each node. Is that right?
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] stop IE8 on Win7 blocking Help Desk search

2011-05-06 Thread Stephen Chang
> I've started using Racket on win7 and it is being blocked by from doing some
> javascript with the following message in the 'information bar':
>>
>> 'To help protect your security, Internet Explorer has restricted this
>> webpage from running scripts or ActiveX controls that could access your
>> computer. Click here for options...'
>
>
> I can 'allow blocked content' but I was wondering if anyone has a solution
> that doesn't require me to authorise help desk every time I hit F1.

Isnt there a permanent "allowed" list?
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] disable garbage collection

2011-06-02 Thread Stephen Chang
>> Good points.  For my list of reasons, I was thinking only of disabling GC 
>> for the lifetime of a process, but there are additional reasons that one 
>> might want to temporarily inhibit GC for a shorter duration.
>
> An even simpler thing to do, which won't give you hard-real-time guarantees 
> but will work most of the time, is to allow the programmer to say "Please 
> garbage-collect NOW" just BEFORE a time-critical section of code.  I could 
> have sworn there used to be a (gc) function that did this, but it doesn't 
> seem to work in 5.1.

Are you referring to collect-garbage?

http://docs.racket-lang.org/reference/garbagecollection.html?q=collect#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Periodic calls to collect-garbage?

2011-07-15 Thread Stephen Chang
> This sounds like a bug. Explicit calls to `collect-garbage' shouldn't
> be needed for the garage collector to do its job.
>
> Does anyone know an easy way for me to make the problem happen, so I
> can see what is going on?

I dont know if this is related but the virtual machine runs out of
memory every time I run raco setup when compiling Racket (32 bit) from
scratch on my Windows 7 (64 bit) machine.
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] what kind of Racket editor operations would you like to see?

2011-07-16 Thread Stephen Chang
>> Also would be nice to be able to have
>> visibility to all defined modules, requires, provides, functions, classes,
>> structs etc. in a whole project and quick navigation within it.
>
> I also would like to vote for these.
> - Project view. Yes, please.

Somewhat related to this. I would like better code navigation
features. In DrRacket, there is a "jump to definition" which is
awesome but then there is no way to go back to where you were.
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Slideshow on secondary monitor

2011-07-18 Thread Stephen Chang
> Does anybody know of a way to tell Slideshow to run fullscreen on a
> secondary monitor?
> I couldn't find help in the Help Desk nor slideshow --help.
> For now I could workaround by setting the projector as the main monitor and
> then dragging the comments window to my netbook's monitor.

shift-right/leftarrow or alt-right/leftarrow moves the presentation
window. Is that insufficient?
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Slideshow on secondary monitor

2011-07-18 Thread Stephen Chang
>> > Does anybody know of a way to tell Slideshow to run fullscreen on a
>> > secondary monitor?
>>
>> shift-right/leftarrow or alt-right/leftarrow moves the presentation
>> window. Is that insufficient?
>
> AFAICT that doesn't move across monitors.
> I guess this feature is not trivial to get right, as it may be a different
> story depending on the underlying OS.

Strange, for me the presentation just slides right over to my second
monitor. I'm on Windows though. What OS are you using?
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Cross-compilation

2011-07-21 Thread Stephen Chang
I created a very basic exe with racket 32bit on windows 7 (64bit) and
it ran fine on winxp.

I used raco exe and not raco distribute though. Also, I'm not sure
what it means to have gracket as a base. Which option is that? Mark,
can you provide some more details about what you are trying to
compile?



On Thu, Jul 21, 2011 at 1:24 PM, Eli Barzilay  wrote:
> It should work fine if the distribution was made on the 32 bit
> version, which is the only released Windows version for 5.1.1.  If
> that's what was used, then I think that there's some unknown problem.
>
>
> An hour and a half ago, Robby Findler wrote:
>> I think our intention is that a windows-created distribution should
>> run on all windows platforms, tho, so maybe there is something fixable
>> here.
>>
>> Robby
>>
>> On Thu, Jul 21, 2011 at 10:35 AM, Matthias Felleisen
>>  wrote:
>> >
>> > This is unfortunately true at the moment.
>> > It is a topic of discussion and will certainly come up in our next design
>> > meeting.
>> >
>> >
>> > On Jul 21, 2011, at 11:30 AM, Mark Carter wrote:
>> >
>> > I'm using Racket 5.1.1. on win 7. I created an executable of type
>> > "distribution" and base "gracket". A zip file is created.
>> > It runs fine on my machine. I have had a report that it doesn;t run on Win
>> > XP, and when it was tried on Win Vista, the user obtained an error 'can't
>> > load dll libracket3m_8aa6ug.dll'.
>> > What gives? Does that mean that a compiled executable can only be run on 
>> > the
>> > platform for which it was compiled?
>
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


  1   2   3   >