Re: [racket-users] convert to/from Sribble

2015-04-22 Thread Matthias Felleisen

No need for that. You can write your own renderer :-) 


On Apr 22, 2015, at 1:02 AM, Gour g...@atmarama.net wrote:

 
 Matthias Felleisen matth...@ccs.neu.edu writes:
 
 We'd love to have an additional renderer for Scribble. 
 
 Good.
 
 Btw, is there something like Scribble-2 planned?
 
 
 Sincerely,
 Gour
 
 -- 
 A person is considered still further advanced when he regards honest 
 well-wishers, affectionate benefactors, the neutral, mediators, the envious, 
 friends and enemies, the pious and the sinners all with an equal mind.
 
 -- 
 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] web server: database result paging

2015-04-22 Thread David Vanderson



On 04/20/2015 05:54 AM, George Neuner wrote:


I know I need a different response function.  The question was 
whether  embed/url  is tied to HTML or can be used in a different 
context.  The documentation (6.1.1) says:


When used inside page 
mailbox:///C:/Users/GW/Documents/Eudora/local/Mail/Local%20Folders/Drafts?number=0part=1.2.2filename=page.html 
syntactically, a rename transformer for the procedure embedding 
function; otherwise, a syntax error.


That suggests  embed/url  can be used only in (X)HTML responses and 
that I need to use something else to create dispatch URLs in regular code.


I think I see why that's confusing.  The syntax parameter embed/url, 
is not being used in the code I sent.  In that code, embed/url is the 
name of a regular parameter to the lambda function being supplied to 
send/suspend/dispatch.  I probably should have used a different 
parameter name.  Does that make sense?


The final problem is how to ensure that I eventually get to 
send/finishand clean up my thread. This particular function is 
expected to be executed quite often.  Does the browser app have to 
invoke a URL that deliberately ends the thread or will the thread 
end if/whenits continuations timeout?
What do you need to clean up?  To be clear, there isn't a thread that 
keeps running - the continuation is just some data, and like Jay 
said, it will eventually be cleaned up.  If you want to remove the 
continuations manually, call send/forward or send/finish.  See the 
attached code.  In particular, try running it, and then copying the 
url to a second browser window.  You'll see how two users have 
different continuations.


My understanding is that serve/servlet executes dispatched functions 
in separate threads.  And I do see server multi-threading in practice 
- e.g., a quick sequence of XHR calls made by the browser finishing in 
different order.  Timestamped in my application log as well as seen at 
the browser.


So when I send/suspend* there will be a thread left suspended. Will 
that thread context be cleaned up if the continuation expires?   And 
can I get a notification of which thread is involved?  Or better yet, 
get the thread restarted at yet another point so I can log that it has 
finished processing.  Are the threads just nuked invisibly or are they 
terminated by an exception that I can catch?


My understanding is that when you do send/suspend*, the continuation is 
saved, and the thread finishes.  The continuation and thread are not 
bound together.  So when a request comes in to continue that 
continuation, it will be a different (new?) thread that runs it.


Can you give an example of the processing that you want to know has been 
finished?  Do you want the thread serving the request to do some 
processing after sending the response?


Thanks,
Dave

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


Re: [racket-users] DrRacket internal error

2015-04-22 Thread Robby Findler
Does restarting help? How about re-running 'raco setup'?

Robby

On Wed, Apr 22, 2015 at 6:21 PM, Alexander D. Knauth
alexan...@knauth.org wrote:
 I’m not sure how it got into this state, but now every time I start typing 
 something or anything like that I get a DrRacket internal error window saying:
 hash-ref: contract violation
   expected: hash?
   given: #f
   argument position: 1st
   other arguments...:
'configure-runtime
'()
   context...:
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:450:4:
  compute-tag+rng method in ...ck/blueboxes-gui.rkt:175:2
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:47:20
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:56:0: 
 coroutine-run
/Applications/Racket/April-16/Racket 
 v6.2.0.2/collects/racket/contract/private/arrow-val-first.rkt:265:18
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:414:4:
  update-the-strs method in ...ck/blueboxes-gui.rkt:175:2
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/logging-timer.rkt:41:0: 
 log-timeline/proc
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/timer.rkt:34:38
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:454:6
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:505:32
/Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:653:3

 --
 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] DrRacket internal error

2015-04-22 Thread Robby Findler
I'm glad to hear that helped.

Looking at the code, I'm puzzled because I don't see how
configure-runtime can show up in the code that is in that stacktrace.
I'd expect configure-runtime to show up in code that was initializing
an environment for running a language, but that code is the new
blueboxes code. It's possible it is using a function that is somehow
doing that, I guess? It calls path-module-path and
xref-binding-definition-tag (that does some stuff with module paths).
I'm stumped.

Robby


On Wed, Apr 22, 2015 at 8:36 PM, Alexander D. Knauth
alexan...@knauth.org wrote:
 Restarting didn’t help, but then raco setup hanged because of an infinite 
 loop in a package of mine, which I then fixed, and then I tried raco setup 
 again, and then it was working again.  So the problem, for me, right now, is 
 fixed.

 On Apr 22, 2015, at 9:23 PM, Robby Findler ro...@eecs.northwestern.edu 
 wrote:

 Does restarting help? How about re-running 'raco setup'?

 Robby

 On Wed, Apr 22, 2015 at 6:21 PM, Alexander D. Knauth
 alexan...@knauth.org wrote:
 I’m not sure how it got into this state, but now every time I start typing 
 something or anything like that I get a DrRacket internal error window 
 saying:
 hash-ref: contract violation
  expected: hash?
  given: #f
  argument position: 1st
  other arguments...:
   'configure-runtime
   '()
  context...:
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:450:4:
  compute-tag+rng method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:47:20
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:56:0: 
 coroutine-run
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/collects/racket/contract/private/arrow-val-first.rkt:265:18
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:414:4:
  update-the-strs method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/logging-timer.rkt:41:0: 
 log-timeline/proc
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/timer.rkt:34:38
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:454:6
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:505:32
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:653:3

 --
 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] web server: database result paging

2015-04-22 Thread George Neuner

On 4/22/2015 8:12 PM, David Vanderson wrote:

On 04/20/2015 05:54 AM, George Neuner wrote:


I know I need a different response function.  The question was 
whether  embed/url  is tied to HTML or can be used in a different 
context.  The documentation (6.1.1) says:


When used inside page 
mailbox:///C:/Users/GW/Documents/Eudora/local/Mail/Local%20Folders/Drafts?number=0part=1.2.2filename=page.html 
syntactically, a rename transformer for the procedure embedding 
function; otherwise, a syntax error.


That suggests  embed/url  can be used only in (X)HTML responses and 
that I need to use something else to create dispatch URLs in regular 
code.


I think I see why that's confusing.  The syntax parameter embed/url, 
is not being used in the code I sent.  In that code, embed/url is 
the name of a regular parameter to the lambda function being supplied 
to send/suspend/dispatch.  I probably should have used a different 
parameter name.  Does that make sense?


Ok.  I guess then an example would be helpful:  how to generate 2 
continuation URLs in Scheme code and stick them into a hash.


My code now looks like:

create a hash representing the return object
- data to return
convert the hash to a jsexpr
send/back the jsexpr

What I want to do is:

create a hash representing the return object
- data to return
- URL for next page function (if applicable)
- URL for prev page function (if applicable)
convert the hash to a jsexpr
send/suspend/dispatch  the jsexpr


My understanding is that when you do send/suspend*, the continuation 
is saved, and the thread finishes.  The continuation and thread are 
not bound together.  So when a request comes in to continue that 
continuation, it will be a different (new?) thread that runs it.


That's fine:  the term thread is overloaded.  I understand that Racket 
threads are user-land scheduler activations [I think that's the term] 
... i.e. just multiplexed continuations.   My point was that there is 
some execution context hanging around when the thread is suspended and 
it wasn't clear that it would be GC'd if/when  all the thread's 
send/suspend continuations expire.


There's nothing that says definitively that the servlet continuation 
manager is holding the *only* references to the thread context  [or the 
only strong references if that's more applicable] - somewhere I recall 
Jay explaining the structure being something like:

server-custodian-custodian(s)-thread(s)-user-stuff ???
and it is not clear where the continuation manager lives in the 
hierarchy [ though I can guess ].



Can you give an example of the processing that you want to know has 
been finished?  Do you want the thread serving the request to do some 
processing after sending the response?


The thread can be suspended after sending a response.  What I'd like, 
though, is for it to wake up again and log some exit data when all 
continuations expire.


That could - with difficulty - be done from an exception handler if the 
thread is terminated by exception as opposed to simply evaporating, and 
also provided that I know what exception(s) to catch or events to wait 
on.   One of the issues I've had with real-world Racket programming is 
determining what exactly happens when things go wrong.  A catch-all  exn 
or exn:fail  handler doesn't cut it when you need more detail, and, of 
course, the hierarchy is extensible so things may be thrown that aren't 
documented.  read the code is fine for research, but it isn't a 
realistic real-world answer - there's too much code and not enough 
time.  As I said to Jay recently, I wouldn't know where to look even if 
I had the source.




Thanks,
Dave


Thank you,
George

--
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] DrRacket internal error

2015-04-22 Thread Alexander D. Knauth
Restarting didn’t help, but then raco setup hanged because of an infinite loop 
in a package of mine, which I then fixed, and then I tried raco setup again, 
and then it was working again.  So the problem, for me, right now, is fixed.  

On Apr 22, 2015, at 9:23 PM, Robby Findler ro...@eecs.northwestern.edu wrote:

 Does restarting help? How about re-running 'raco setup'?
 
 Robby
 
 On Wed, Apr 22, 2015 at 6:21 PM, Alexander D. Knauth
 alexan...@knauth.org wrote:
 I’m not sure how it got into this state, but now every time I start typing 
 something or anything like that I get a DrRacket internal error window 
 saying:
 hash-ref: contract violation
  expected: hash?
  given: #f
  argument position: 1st
  other arguments...:
   'configure-runtime
   '()
  context...:
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:450:4:
  compute-tag+rng method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:47:20
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:56:0: 
 coroutine-run
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/collects/racket/contract/private/arrow-val-first.rkt:265:18
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:414:4:
  update-the-strs method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/framework/private/logging-timer.rkt:41:0: 
 log-timeline/proc
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/timer.rkt:34:38
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:454:6
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:505:32
   /Applications/Racket/April-16/Racket 
 v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:653:3
 
 --
 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] DrRacket internal error

2015-04-22 Thread Alexander D. Knauth
I’m not sure how it got into this state, but now every time I start typing 
something or anything like that I get a DrRacket internal error window saying:
hash-ref: contract violation
  expected: hash?
  given: #f
  argument position: 1st
  other arguments...:
   'configure-runtime
   '()
  context...:
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:450:4: 
compute-tag+rng method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:47:20
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/framework/private/coroutine.rkt:56:0: coroutine-run
   /Applications/Racket/April-16/Racket 
v6.2.0.2/collects/racket/contract/private/arrow-val-first.rkt:265:18
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/drracket/drracket/private/syncheck/blueboxes-gui.rkt:414:4: 
update-the-strs method in ...ck/blueboxes-gui.rkt:175:2
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/framework/private/logging-timer.rkt:41:0: 
log-timeline/proc
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/timer.rkt:34:38
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:454:6
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:505:32
   /Applications/Racket/April-16/Racket 
v6.2.0.2/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:653:3

-- 
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] Debugging Library

2015-04-22 Thread s . jiang
I was wondering if Racket, or any other Scheme interpreter, had a debugging 
library similar to bdb/pdb for Python.

There is an environment diagram visualizer at http://www.pythontutor.com/ which 
uses BDB/PDB to generate a JSON trace which it feeds to the frontend. I see 
that there is a rudimentary trace, and something more fully featured in 
DrRacket, but is there any library that can be used by a trace generating 
program? I want to write a Scheme backend for OPT.

Best,

Tony

-- 
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] Scribble abstraction to attach styles

2015-04-22 Thread Shriram Krishnamurthi
I'm having trouble with the type structure of Scribble and hoping someone can 
help me get this right.

Let's say I want to write content like this:

=

@exercise{
@question{The expression @code{1 + 2} evaluates to}
@answer{
@itemlist[
@item{@code{2}}
@item{@code{3}}
@item{@code{4}}
]
}
}

=

That is, an `exercise` contains within it a `question` and an `answer` (and 
maybe other parts). Each of those can contain compound content (text, code, 
itemlists...). In my (HTML) output I would like each of these to have their own 
class tags, so the structure looks like

  div class=exercise
...
div class=question
  ...
/div
...
div class=answer
  ...
/div
...
  /div

I have set up styles as follows:

  (define exercise-style (make-style exercise null))
  (define question-style (make-style question null))
  (define answer-style (make-style answer null))

What I'm trying to do is create the correct form of pass-through abstraction 
for the `exercise`, `question`, and `answer` functions that just attach the 
style and leave everything else alone: e.g.,

  (define (exercise . t) (nested-flow exercise-style t))
  (define (question . t) (nested #:style question-style t))

I have tried a whole bunch of things (`nested`, `nested-flow`, etc.) and cannot 
get anything to work correctly, consistently: each thing I try eventually 
results in a contract violation such as

  make-nested-flow: contract violation
expected: block?
given: \n

TIA,
Shriram

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