Re: [racket-users] dynamic-require

2021-02-03 Thread jon stenerson

Very good! Thank you.


On 2/2/2021 8:31 PM, jon stenerson wrote:

The previous message here prompts this ...

I have some modules with paths "A1.rkt" ... "An.rkt". In the 
interaction window of DrRacket I can require any or all of them and I 
believe them to be correct.


Now suppose I have a function (F) that produces one of those paths. I 
try  (dynamic-require (F) #f) and there are no errors but where do the 
imports go? I don't seem able to access them.


However, I can do (define quux (dynamic-require (F) 'quux) )  and then 
use quux. Is there a way to bring in all the exports of (F) without 
knowing the names ahead of time?


Thanks,

Jon



--
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/892365dc-d491-bb4f-d18c-e8eb93484be4%40comcast.net.


[racket-users] dynamic-require

2021-02-02 Thread jon stenerson

The previous message here prompts this ...

I have some modules with paths "A1.rkt" ... "An.rkt". In the interaction 
window of DrRacket I can require any or all of them and I believe them 
to be correct.


Now suppose I have a function (F) that produces one of those paths. I 
try  (dynamic-require (F) #f) and there are no errors but where do the 
imports go? I don't seem able to access them.


However, I can do (define quux (dynamic-require (F) 'quux) )  and then 
use quux. Is there a way to bring in all the exports of (F) without 
knowing the names ahead of time?


Thanks,

Jon

--
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/333a9191-ae5e-6dd8-cebf-30bd00d87b9f%40comcast.net.


[racket-users] #lang support for menu bar?

2020-06-13 Thread jon stenerson
Some #lang like scribble cause buttons to be added to DrRacket toolbar. 
Can they also add menus or menu items? There is a quickscript example 
that does this so it doesn't seem unreasonable. But I don't know.


Jon

--
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/7a1629d6-11c9-6896-2466-01b891cb0c2d%40comcast.net.


Re: [racket-users] br-parser-tools question

2020-06-09 Thread jon stenerson
I don't think you should assume I have a *good* reason for using yacc 
over brag. I just thought that in my case it would be easier to put some 
code in the productions rather than build a full parse tree and then 
process that. I seem to have been wrong about that. I will take another 
look at brag.


On 6/8/2020 11:00 PM, Matthew Butterick wrote:
`br-parser-tools` has some patches needed to make `brag` work, e.g., 
using the srcloc structure. I forked rather than patch the underlying 
`parser-tools` package because I didn't want to destroy the fragile 
ancient artifact. I fixed a few bugs; the others persist. I notice, 
for example, that your program fails to work regardless of whether it 
uses `br-parser-tools` or `parser-tools`. (I'm assuming here you have 
a good reason to use good old `yacc` and not `brag`, which does mostly 
the same thing, less painfully)


On 08 Jun 20, at 9:29 PM, Jon Stenerson <mailto:jonstener...@comcast.net>> wrote:


Thanks for confirming. I had actually started with the lexer-src-pos 
version but had other problems like exn:fail:read wanting a list of 
srclocs and the lexer only having positions. So I switched to 
lexer-srcpos which fixed the exception but broke the parse. Maybe I 
should do a conversion between positions and srclocs at some point? 
Seems awkward.




--
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/f4279184-e314-6016-cbb8-ce4f212dfb46%40comcast.net.


Re: [racket-users] br-parser-tools question

2020-06-08 Thread Jon Stenerson
Thanks for confirming. I had actually started with the lexer-src-pos version 
but had other problems like exn:fail:read wanting a list of srclocs and the 
lexer only having positions. So I switched to lexer-srcpos which fixed the 
exception but broke the parse. Maybe I should do a conversion between positions 
and srclocs at some point? Seems awkward.

On June 8, 2020, at 6:49 PM, Jon Zeppieri  wrote:

On Mon, Jun 8, 2020 at 8:36 PM jon stenerson  wrote:
>
> Hi all,
>
> I don't understand the error message here. The parser seems to be
> looking for a position-token but the lexer is sending srcloc-tokens? Is
> there a simple fix? Using Racket 7.7 on WIn 10.

Hi Jon,

Yes, you're right, and there is a simple fix. Instead of using
`lexer-srcloc`, you can use `lexer-src-pos`. The former seems to be an
addition to the `br-` variant of parser-tools, but I don't see any
indication that the lexers it generates can be used with the yacc
tools. (I could be wrong about that.)

- Jon

-- 
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/1gkb5qug6ffe8copwx6u8cc1.1591676950009%40email.android.com.


[racket-users] br-parser-tools question

2020-06-08 Thread jon stenerson

Hi all,

I don't understand the error message here. The parser seems to be 
looking for a position-token but the lexer is sending srcloc-tokens? Is 
there a simple fix? Using Racket 7.7 on WIn 10.


I am also confused about whether to use br-parser-tools or parser-tools 
package. br-* is the more recent?


Thanks,

Jon


#lang racket

(require br-parser-tools/lex)
(require br-parser-tools/yacc)

(define-empty-tokens etoks (ZERO ONE EOF))

(define simple-lex
  (lexer-srcloc
   ["0" (token-ZERO)]
   ["1" (token-ONE)]
   [(eof) (token-EOF)]
   ))


(define (err-proc tok-ok? tok-name tok-value start-pos end-pos)
  (display "Ugghh!"))

(define simple-parse
  (parser
   (tokens etoks)
   (start S)
   (end EOF)
   (src-pos)
   (error err-proc)
   (grammar
    (S [(ONE ZERO) 'OK])
    )))


(define (make-scanner ip [path #f])
  (λ () (simple-lex ip)))

(simple-parse (make-scanner (open-input-string "01")))

--
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/6a0f7471-86f2-b889-0c8c-fdc400dfeb87%40comcast.net.


Re: [racket-users] link: bad variable linkage

2017-01-30 Thread jon stenerson
Sorry I missed this. Apparently I'm several months behind on the racket 
list.  The problem does seem fixed however. Thank you!


Jon


On 10/23/2016 11:34 AM, Laurent wrote:
As of now, I haven't experienced any more problem of this sort since 
then. Admittedly I haven't tried hard either to reproduce this behavior.


So thank you so much for the time you took to look into this! Very 
appreciated.



On Sat, Mar 26, 2016 at 11:53 PM, Robby Findler 
<ro...@eecs.northwestern.edu <mailto:ro...@eecs.northwestern.edu>> wrote:


Matthew and I have figured out one way in which DrRacket could go
wrong here and implemented a better strategy. The problem we
identified doesn't explain the symptoms expressed here in this thread
exactly, but it is a complex system and maybe there was some piece
missing from the explanations that I didn't think to ask about.
Finger's crossed that it helps!

In any case, if you are still experiencing the bad symptom after you
get the latest code, please let me know.

Thanks,
Robby

On Mon, Feb 1, 2016 at 9:03 AM, Laurent <laurent.ors...@gmail.com
<mailto:laurent.ors...@gmail.com>> wrote:
> I would be so happy if this kind of error could be resolved!
(even when all
> files are compiled by DrRacket)
> Usually, I just turn off "populate 'compiled' directories", but then
> DrRacket needs to compile the file on each F5, which can take
some precious
> time.
> Thank you both then :)
>
> On Sun, Jan 31, 2016 at 11:19 PM, jon stenerson
<jonstener...@comcast.net <mailto:jonstener...@comcast.net>>
> wrote:
>>
>>
>> The simplest thing I can find: I have three files in two
directories.
>> The first directory, called junk, contains a.rkt and b.rkt.
>> The second directory is a sibling to junk called local-libs and
contains
>> c.rkt. (local-libs is known to the package manager; it was
installed via the
>> DrRacket interface).
>> If I open all three files in DrRacket and try running a.rkt,
sometimes it
>> works, sometimes not. By modifiying a, b, c in some order (in
the DrRacket
>> editor) I can toggle the work/not work flag. As you say, it's a
little
>> non-deterministic.
>>
>> Thanks,
>> Jon
>>
>>
>> a.rkt:
>> #lang racket
>> (require "b.rkt")
>>
>> b.rkt
>> #lang racket
>> (require "../local-libs/c.rkt")
>> (s 1)
>>
>> c.rkt
>> #lang racket
>> (provide (struct-out s) )
>> (struct s (p))
>>
>>
>>
>>
>> On 1/31/2016 4:03 PM, Robby Findler wrote:
>>>
>>> Then it would be helpful to us if you could provide some
(hopefully
>>> small) program and instructions to reproduce the problem.
>>>
>>> Thanks,
>>> Robby
>>>
>>>
>>> On Sun, Jan 31, 2016 at 4:51 PM, jon stenerson
<jonstener...@comcast.net <mailto:jonstener...@comcast.net>>
>>> wrote:
>>>>
>>>> Just using DrRacket 6.3 on Win 10.
>>>>
>>>> Jon
>>>>
>>>>
>>>> On 1/31/2016 3:22 PM, Robby Findler wrote:
>>>>>
>>>>> The compilation of racket is (not yet) deterministic so
things like
>>>>> that can throw off internal tables in the .zo files (and a
.zo files
>>>>> is loaded without checking dependencies, optimistically
hoping that
>>>>> the files are not changed).
>>>>>
>>>>> So: are you using "raco make" or somehow mangaging .zo files
yourself,
>>>>> or are you seeing this with the .zo files that DrRacket
maintains for
>>>>> your automatically? If the former, then you need to adapt your
>>>>> workflow to either not use .zo files or to keep them up to
date. If
>>>>> the latter, then it is a bug.
>>>>>
>>>>> Robby
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Jan 31, 2016 at 4:17 PM, jon stenerson
>>>>> <jonstener...@comcast.net <mailto:jonstener...@comcast.net>>
>>>>> wrote:
>>>>>>
>>>>>> I have some .rkt files and, depending on which file was
edited most
>>>>>> recently, either it works fine or it give

Re: [racket-users] reading html

2016-02-25 Thread jon stenerson
Thanks Neil.  Jay, it seems to me that the html spec at w3.org says that 
 and  can be used as inline elements so that may be a 
reasonable change to html-spec.rkt.


On 2/25/2016 11:30 AM, Neil Van Dyke wrote:

Jay McCarthy wrote on 02/25/2016 01:21 PM:

Since you mention "in the wild", I think you probably don't want to
use the html library but instead want to use

http://docs.racket-lang.org/html-parsing/index.html


BTW, `html-parsing` package uses SXML, and you'll want to read this 
brand-new document: http://www.neilvandyke.org/racket/sxml-intro/


Neil V.



--
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] reading html

2016-02-25 Thread jon stenerson

Thank you! I wasn't aware of the html-parsing library.

Jon


On 2/25/2016 11:21 AM, Jay McCarthy wrote:

You should double check against the HTML 4.01 spec

https://www.w3.org/TR/html4/

Since you mention "in the wild", I think you probably don't want to
use the html library but instead want to use

http://docs.racket-lang.org/html-parsing/index.html

Jay

On Thu, Feb 25, 2016 at 1:13 PM, jon stenerson <jonstener...@comcast.net> wrote:

I find that when I use the html library I have to make a few simple changes
to html-spec.rkt. It seems that  and  are not treated like  and
 . You can see in this example that while  remains in the enclosing
,  does not. I also find that I have to allow pcdata as a child of
 and . I don't know whether pcdata is "supposed to" appear there but
it often does in the wild.

Jon



#lang racket

(require (prefix-in h: html)  (prefix-in x: xml))

(define (xml->list x)
   (cond
 [(x:pcdata? x) (x:pcdata-string x)]
 [(x:entity? x) (list)]
 [(x:element? x)
  (list (x:element-name x)
(map xml->list (x:element-content x)))]
 [(list? x) (map xml->list x)]))

(printf "~s\n" (xml->list (h:read-html-as-xml (open-input-string "Hello
world Testing!"
(printf "~s\n" (xml->list (h:read-html-as-xml (open-input-string "Hello
world Testing!"

--
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] reading html

2016-02-25 Thread jon stenerson
I find that when I use the html library I have to make a few simple 
changes to html-spec.rkt. It seems that  and  are not treated 
like  and  . You can see in this example that while  remains in 
the enclosing ,  does not. I also find that I have to allow 
pcdata as a child of  and . I don't know whether pcdata is 
"supposed to" appear there but it often does in the wild.


Jon



#lang racket

(require (prefix-in h: html)  (prefix-in x: xml))

(define (xml->list x)
  (cond
[(x:pcdata? x) (x:pcdata-string x)]
[(x:entity? x) (list)]
[(x:element? x)
 (list (x:element-name x)
   (map xml->list (x:element-content x)))]
[(list? x) (map xml->list x)]))

(printf "~s\n" (xml->list (h:read-html-as-xml (open-input-string 
"Hello world Testing!"
(printf "~s\n" (xml->list (h:read-html-as-xml (open-input-string 
"Hello world Testing!"


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


Re: [racket-users] a little bug

2016-02-05 Thread jon stenerson

Thanks for the explanation. I appreciate it.

On 2/5/2016 1:55 PM, Robby Findler wrote:

In general, DrRacket does not promise to avoid this situation. Let me
explain a little bit. This program is effectively equivalent to this
one:

#lang racket/base
(define (run l)
   (run (cons 'x l)))
(run '())

(but running at compile time, which is why things happen
automatically, but lets leave that aside for now).

So when you run that program, DrRacket is asking the operating system
for all of its memory. At some point, the operating system says
"sorry, no, we're out of memory" and since the program running inside
DrRacket doesn't really care that we're out of memory, the operating
system responds with "die!". And so DrRacket dies.

There are two ways we try to do better. First: we can set limits on
the memory. But if the limit is set to be higher than the amount of
memory available on the machine, then it is as if the memory limit
isn't set. Also worth noting at this point: the way that DrRacket's
counting of "how much memory" is only loosely related to the way that
your machine's vendor or the OS counts. There are some constant
factors of difference there that depend on things like how the garbage
collector is configured and how many other programs are running on
your system and what they are doing (like the OS itself likes to have
some of the memory and it (quite reasonably) doesn't want to share
that memory).

The second way is that the OS will sometimes say "you are about to
cause me to exhaust all of the system's memory and if you do that, I
will kill you" at which point the GC inside Racket responds with
"okay, I'll just die first". The main advantage of this is that you
get an error message saying "out of memory" from Racket instead of an
error message saying "I killed your program" from the OS (which is the
message you're getting). It turns out to be remarkably difficult to
get this error message to work in all situations. We're better than we
used to be at it, but at some level, the best we can do in that case
is really just to change the text of the error message. When we're out
of memory like that, it's very very hard to recover if the limits are
not set up ahead of time (i.e. back to the previous paragraph).

I hope this clears up the issue somewhat.

In the meantime, I suggest you lower the memory limit for your machine.

Robby



On Fri, Feb 5, 2016 at 10:53 AM, jon stenerson <jonstener...@comcast.net> wrote:

Actually you don't even have to run the program. With memory limit set to
1024, just open a file containing the expression and wait. After a minute or
two DrRacket puts up a MSVC runtime error dialog.


On 2/5/2016 9:39 AM, jon stenerson wrote:

Setting the limit lower helped. Thanks. I did not see that message about
Background Expansion Terminated before. Now I do.

Jon

On 2/5/2016 6:55 AM, Robby Findler wrote:

It took a while for mine for the custodian limit to be reached and for
the expansion to run out of memory. It may be that the threshhold for
the memory use is too high on some systems. Maybe the right thing is
to set the default a bit lower?

Jon: if you open the "Racket" menu you should see a "Limit Memory..."
menu item. How does DrRacket do if you change the number in there to
256 and then paste the program into the definitions window? Do you see
the red message at the bottom of the screen or does DrRacket still run
out of memory?

Anthony: I don' thave a good solution for you, but I find that the
menu key short cut (control-k for you?) for killing is more likely to
get thru, because it requires a lot less event handling than the
others.

Robby


On Fri, Feb 5, 2016 at 7:41 AM, Pierpaolo Bernardi <olopie...@gmail.com>
wrote:

On my system it behaves almost exactly as described by Jon (6.3,
windows).

The one difference is that DrRacket hasn't crashed yet, but the Task
manager reports one processor at 100% and memory use slowly growing.
Currently is at 7.5 GB.





On Fri, Feb 5, 2016 at 2:29 PM, Anthony Carrico <acarr...@memebeam.org>
wrote:

On 02/05/2016 08:01 AM, Robby Findler wrote:

When I run this, I see a message at the bottom of the DrRacket window
(in red):

Background expansion terminated abnormally (out of memory)

do you see this message?

I tried too, and it stops fine with the same message as Robby. No
phantom CPU usage apparent.

However, I did have a run away DrRacket recently that didn't respond to
stop and took a few minutes to kill because my UI was extremely
sluggish
(partially because X11 and/or the window manager sucks, and my CPU
probably throttled, but still...). I don't have any good data for you
about the circumstances of the issue though.

--
Anthony Carrico

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

Re: [racket-users] a little bug

2016-02-05 Thread jon stenerson
Setting the limit lower helped. Thanks. I did not see that message about 
Background Expansion Terminated before. Now I do.


Jon

On 2/5/2016 6:55 AM, Robby Findler wrote:

It took a while for mine for the custodian limit to be reached and for
the expansion to run out of memory. It may be that the threshhold for
the memory use is too high on some systems. Maybe the right thing is
to set the default a bit lower?

Jon: if you open the "Racket" menu you should see a "Limit Memory..."
menu item. How does DrRacket do if you change the number in there to
256 and then paste the program into the definitions window? Do you see
the red message at the bottom of the screen or does DrRacket still run
out of memory?

Anthony: I don' thave a good solution for you, but I find that the
menu key short cut (control-k for you?) for killing is more likely to
get thru, because it requires a lot less event handling than the
others.

Robby


On Fri, Feb 5, 2016 at 7:41 AM, Pierpaolo Bernardi  wrote:

On my system it behaves almost exactly as described by Jon (6.3, windows).

The one difference is that DrRacket hasn't crashed yet, but the Task
manager reports one processor at 100% and memory use slowly growing.
Currently is at 7.5 GB.





On Fri, Feb 5, 2016 at 2:29 PM, Anthony Carrico  wrote:

On 02/05/2016 08:01 AM, Robby Findler wrote:

When I run this, I see a message at the bottom of the DrRacket window (in red):

   Background expansion terminated abnormally (out of memory)

do you see this message?

I tried too, and it stops fine with the same message as Robby. No
phantom CPU usage apparent.

However, I did have a run away DrRacket recently that didn't respond to
stop and took a few minutes to kill because my UI was extremely sluggish
(partially because X11 and/or the window manager sucks, and my CPU
probably throttled, but still...). I don't have any good data for you
about the circumstances of the issue though.

--
Anthony Carrico

--
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] a little bug

2016-02-05 Thread jon stenerson
Actually you don't even have to run the program. With memory limit set 
to 1024, just open a file containing the expression and wait. After a 
minute or two DrRacket puts up a MSVC runtime error dialog.


On 2/5/2016 9:39 AM, jon stenerson wrote:
Setting the limit lower helped. Thanks. I did not see that message 
about Background Expansion Terminated before. Now I do.


Jon

On 2/5/2016 6:55 AM, Robby Findler wrote:

It took a while for mine for the custodian limit to be reached and for
the expansion to run out of memory. It may be that the threshhold for
the memory use is too high on some systems. Maybe the right thing is
to set the default a bit lower?

Jon: if you open the "Racket" menu you should see a "Limit Memory..."
menu item. How does DrRacket do if you change the number in there to
256 and then paste the program into the definitions window? Do you see
the red message at the bottom of the screen or does DrRacket still run
out of memory?

Anthony: I don' thave a good solution for you, but I find that the
menu key short cut (control-k for you?) for killing is more likely to
get thru, because it requires a lot less event handling than the
others.

Robby


On Fri, Feb 5, 2016 at 7:41 AM, Pierpaolo Bernardi 
<olopie...@gmail.com> wrote:
On my system it behaves almost exactly as described by Jon (6.3, 
windows).


The one difference is that DrRacket hasn't crashed yet, but the Task
manager reports one processor at 100% and memory use slowly growing.
Currently is at 7.5 GB.





On Fri, Feb 5, 2016 at 2:29 PM, Anthony Carrico 
<acarr...@memebeam.org> wrote:

On 02/05/2016 08:01 AM, Robby Findler wrote:
When I run this, I see a message at the bottom of the DrRacket 
window (in red):


   Background expansion terminated abnormally (out of memory)

do you see this message?

I tried too, and it stops fine with the same message as Robby. No
phantom CPU usage apparent.

However, I did have a run away DrRacket recently that didn't 
respond to
stop and took a few minutes to kill because my UI was extremely 
sluggish

(partially because X11 and/or the window manager sucks, and my CPU
probably throttled, but still...). I don't have any good data for you
about the circumstances of the issue though.

--
Anthony Carrico

--
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] a little bug

2016-02-05 Thread jon stenerson
lol. Don't be sorry.  Speaking of anthropomorphization, I really love Dr 
Racket and hope I didn't hurt his feelings (Or is Dr Racket a she?). I 
employ his services whenever I can. I don't mean to be a whiner; he 
deserves better than that!


Jon

On 2/5/2016 3:44 PM, Robby Findler wrote:

Sorry we can't do better. And it is really amazing how I actually
think so anthropomorphically about these things. :) That really was a
literal brain dump.

Robby

On Fri, Feb 5, 2016 at 3:53 PM, jon stenerson <jonstener...@comcast.net> wrote:

Thanks for the explanation. I appreciate it.


On 2/5/2016 1:55 PM, Robby Findler wrote:

In general, DrRacket does not promise to avoid this situation. Let me
explain a little bit. This program is effectively equivalent to this
one:

#lang racket/base
(define (run l)
(run (cons 'x l)))
(run '())

(but running at compile time, which is why things happen
automatically, but lets leave that aside for now).

So when you run that program, DrRacket is asking the operating system
for all of its memory. At some point, the operating system says
"sorry, no, we're out of memory" and since the program running inside
DrRacket doesn't really care that we're out of memory, the operating
system responds with "die!". And so DrRacket dies.

There are two ways we try to do better. First: we can set limits on
the memory. But if the limit is set to be higher than the amount of
memory available on the machine, then it is as if the memory limit
isn't set. Also worth noting at this point: the way that DrRacket's
counting of "how much memory" is only loosely related to the way that
your machine's vendor or the OS counts. There are some constant
factors of difference there that depend on things like how the garbage
collector is configured and how many other programs are running on
your system and what they are doing (like the OS itself likes to have
some of the memory and it (quite reasonably) doesn't want to share
that memory).

The second way is that the OS will sometimes say "you are about to
cause me to exhaust all of the system's memory and if you do that, I
will kill you" at which point the GC inside Racket responds with
"okay, I'll just die first". The main advantage of this is that you
get an error message saying "out of memory" from Racket instead of an
error message saying "I killed your program" from the OS (which is the
message you're getting). It turns out to be remarkably difficult to
get this error message to work in all situations. We're better than we
used to be at it, but at some level, the best we can do in that case
is really just to change the text of the error message. When we're out
of memory like that, it's very very hard to recover if the limits are
not set up ahead of time (i.e. back to the previous paragraph).

I hope this clears up the issue somewhat.

In the meantime, I suggest you lower the memory limit for your machine.

Robby



On Fri, Feb 5, 2016 at 10:53 AM, jon stenerson <jonstener...@comcast.net>
wrote:

Actually you don't even have to run the program. With memory limit set to
1024, just open a file containing the expression and wait. After a minute
or
two DrRacket puts up a MSVC runtime error dialog.


On 2/5/2016 9:39 AM, jon stenerson wrote:

Setting the limit lower helped. Thanks. I did not see that message about
Background Expansion Terminated before. Now I do.

Jon

On 2/5/2016 6:55 AM, Robby Findler wrote:

It took a while for mine for the custodian limit to be reached and for
the expansion to run out of memory. It may be that the threshhold for
the memory use is too high on some systems. Maybe the right thing is
to set the default a bit lower?

Jon: if you open the "Racket" menu you should see a "Limit Memory..."
menu item. How does DrRacket do if you change the number in there to
256 and then paste the program into the definitions window? Do you see
the red message at the bottom of the screen or does DrRacket still run
out of memory?

Anthony: I don' thave a good solution for you, but I find that the
menu key short cut (control-k for you?) for killing is more likely to
get thru, because it requires a lot less event handling than the
others.

Robby


On Fri, Feb 5, 2016 at 7:41 AM, Pierpaolo Bernardi
<olopie...@gmail.com>
wrote:

On my system it behaves almost exactly as described by Jon (6.3,
windows).

The one difference is that DrRacket hasn't crashed yet, but the Task
manager reports one processor at 100% and memory use slowly growing.
Currently is at 7.5 GB.





On Fri, Feb 5, 2016 at 2:29 PM, Anthony Carrico
<acarr...@memebeam.org>
wrote:

On 02/05/2016 08:01 AM, Robby Findler wrote:

When I run this, I see a message at the bottom of the DrRacket
window
(in red):

 Background expansion terminated abnormally (out of memory)

do you see this message?

I tried too, and it stops fine with the same message as Robby. No
phantom CPU us

[racket-users] a little bug

2016-02-04 Thread jon stenerson


#lang racket
(let ((x 1))
  (letrec-syntax ((m (lambda (t) (syntax (m)
(m)))

When I run this in DrRacket 6.3 on Win 10 it starts looping. I hit the 
stop button. The interaction window says "user break" and is ready for 
another command.


However, the windows task manager shows DrRacket being very active and 
eating more and more memory. After a minute DrRacket crashes. I guess 
the bug is that the stop button doesn't stop the expander?


Jon

--
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] link: bad variable linkage

2016-01-31 Thread jon stenerson


The simplest thing I can find: I have three files in two directories.
The first directory, called junk, contains a.rkt and b.rkt.
The second directory is a sibling to junk called local-libs and contains 
c.rkt. (local-libs is known to the package manager; it was installed via 
the DrRacket interface).
If I open all three files in DrRacket and try running a.rkt, sometimes 
it works, sometimes not. By modifiying a, b, c in some order (in the 
DrRacket editor) I can toggle the work/not work flag. As you say, it's a 
little non-deterministic.


Thanks,
Jon


a.rkt:
#lang racket
(require "b.rkt")

b.rkt
#lang racket
(require "../local-libs/c.rkt")
(s 1)

c.rkt
#lang racket
(provide (struct-out s) )
(struct s (p))



On 1/31/2016 4:03 PM, Robby Findler wrote:

Then it would be helpful to us if you could provide some (hopefully
small) program and instructions to reproduce the problem.

Thanks,
Robby


On Sun, Jan 31, 2016 at 4:51 PM, jon stenerson <jonstener...@comcast.net> wrote:

Just using DrRacket 6.3 on Win 10.

Jon


On 1/31/2016 3:22 PM, Robby Findler wrote:

The compilation of racket is (not yet) deterministic so things like
that can throw off internal tables in the .zo files (and a .zo files
is loaded without checking dependencies, optimistically hoping that
the files are not changed).

So: are you using "raco make" or somehow mangaging .zo files yourself,
or are you seeing this with the .zo files that DrRacket maintains for
your automatically? If the former, then you need to adapt your
workflow to either not use .zo files or to keep them up to date. If
the latter, then it is a bug.

Robby



On Sun, Jan 31, 2016 at 4:17 PM, jon stenerson <jonstener...@comcast.net>
wrote:

I have some .rkt files and, depending on which file was edited most
recently, either it works fine or it gives a compilation error. (By
"edited"
I mean just adding or subtracting a blank line to change the timestamp).
I
can submit a simplified example if nobody else has seen this problem.  If
this is well-known, what is the fix?

link: bad variable linkage;
   reference to a variable that is not a procedure or structure-type
constant
across all instantiations
reference phase level: 0
variable module: 
variable phase: 0
reference in module:  in: 

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


[racket-users] link: bad variable linkage

2016-01-31 Thread jon stenerson
I have some .rkt files and, depending on which file was edited most 
recently, either it works fine or it gives a compilation error. (By 
"edited" I mean just adding or subtracting a blank line to change the 
timestamp). I can submit a simplified example if nobody else has seen 
this problem.  If this is well-known, what is the fix?


link: bad variable linkage;
 reference to a variable that is not a procedure or structure-type 
constant across all instantiations

  reference phase level: 0
  variable module: 
  variable phase: 0
  reference in module:  in: 

--
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] link: bad variable linkage

2016-01-31 Thread jon stenerson

Just using DrRacket 6.3 on Win 10.

Jon

On 1/31/2016 3:22 PM, Robby Findler wrote:

The compilation of racket is (not yet) deterministic so things like
that can throw off internal tables in the .zo files (and a .zo files
is loaded without checking dependencies, optimistically hoping that
the files are not changed).

So: are you using "raco make" or somehow mangaging .zo files yourself,
or are you seeing this with the .zo files that DrRacket maintains for
your automatically? If the former, then you need to adapt your
workflow to either not use .zo files or to keep them up to date. If
the latter, then it is a bug.

Robby



On Sun, Jan 31, 2016 at 4:17 PM, jon stenerson <jonstener...@comcast.net> wrote:

I have some .rkt files and, depending on which file was edited most
recently, either it works fine or it gives a compilation error. (By "edited"
I mean just adding or subtracting a blank line to change the timestamp). I
can submit a simplified example if nobody else has seen this problem.  If
this is well-known, what is the fix?

link: bad variable linkage;
  reference to a variable that is not a procedure or structure-type constant
across all instantiations
   reference phase level: 0
   variable module: 
   variable phase: 0
   reference in module:  in: 

--
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] unread-char

2016-01-28 Thread jon stenerson
Some languages have stream libraries with a function to put stuff back 
into an input stream, like Common Lisp's unread-char, or C++ 
istream::putback. Is there anything like that in Racket?


--
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] Calling a procedure without allowing it to permanently alter parameters.

2016-01-12 Thread jon stenerson
I see. Then, I'm sorry to say, I have no idea other than what you 
already suggested.


On 1/12/2016 6:08 PM, Jos Koot wrote:

Your suggestion works,
but only for explicitly parameterized parameters.
There may be parameters that I don't know of,
but nevertheless may affect my protected-caller.
Therefore I want ALL parameters protected.
Thanks, Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com]
On Behalf Of jon stenerson
Sent: miércoles, 13 de enero de 2016 0:50
To: racket-users@googlegroups.com
Subject: Re: [racket-users] Calling a procedure without allowing it to
permanently alter parameters.

Can you use this instead?

(define (protected-caller thunk)
(parameterize ([p 'anything])
  (thunk)))

Works for me

Jon



--
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] Calling a procedure without allowing it to permanently alter parameters.

2016-01-12 Thread jon stenerson

Can you use this instead?

(define (protected-caller thunk)
  (parameterize ([p 'anything])
(thunk)))

Works for me

Jon

--
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] net/url question

2015-10-16 Thread Jon Stenerson

Thanks Greg. Here's a variation that gives a little more insight.

#lang racket

(require net/url)

(with-handlers ([(lambda (x)  #t)
 (lambda (x) (printf "Oops!"))])
  (purify-port (head-impure-port (string->url 
"http://www.racket-lang.org;))) )



I repeatedly run this. In all cases a header string is returned from the 
server. Sometimes it's a 505 error. Sometimes it's "HTTP/1.1 400 Bad 
Request ..." and that's when I also see the contract violation. However 
no exception is ever caught by the with-handlers. Since I can't catch 
the exception I guess it is being logged from a separate thread?


As you say, some sort of error message is appropriate, at least from the 
server. But the contract violation makes no sense to me. That must be a 
bug I think.




On 10/16/2015 10:17 AM, Greg Hendershott wrote:

The URL needs to get split into parts, and the HTTP request will go
"on the wire" as something like:

 HEAD  HTTP/1.0
 Host: www.racket-lang.org
 

When you have the trailing / it will be:

 HEAD / HTTP/1.0

Which makes sense.

When the trailing slash is missing, i.e. "no path", I'm guessing that
http-conn-send! is sending

 HEAD HTTP/1.0

The server thinks the path is "HTTP/1.0" and the HTTP/ part is...
missing. The server doesn't think blank is a valid version of HTTP. It
may have a point. :)

TL;DR1: It's probably good form to use the trailing slash in your
URLs, anyway. (What you can type in a browser address bar is a lot
looser than what you can/should use in code.)  This will work even
with the currently shipping Racket.

TL;DR2: Jay, http-conn-send! might want to supply "/" when the path is
missing?  Or at least something like (error 'http-conn-send! "URL is
missing a path") so it fails more understandably?



On Fri, Oct 16, 2015 at 6:18 AM, Jon Stenerson <jonstener...@comcast.net> wrote:

This works:


(define p (head-impure-port (string->url "http://www.racket-lang.org/;)))
(read-line p)

"HTTP/1.1 200 OK\r"

But, leaving off trailing /, I usually see


(define p (head-impure-port (string->url "http://www.racket-lang.org;)))

string-trim: contract violation
   expected: string?
   given: #

Sometimes I get a port with status line "HTTP/1.1 505 HTTP Version not
supported\r".

Can anyone explain? Thanks.

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


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


[racket-users] net/url question

2015-10-16 Thread Jon Stenerson

This works:

> (define p (head-impure-port (string->url "http://www.racket-lang.org/;)))
> (read-line p)
"HTTP/1.1 200 OK\r"

But, leaving off trailing /, I usually see

> (define p (head-impure-port (string->url "http://www.racket-lang.org;)))

string-trim: contract violation
  expected: string?
  given: #

Sometimes I get a port with status line "HTTP/1.1 505 HTTP Version not 
supported\r".


Can anyone explain? Thanks.

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