Re: [racket-users] Value printing in REPL and for students

2015-11-27 Thread Robby Findler
I've added "check over/improve handin support" to my teaching
languages list of things to fix. :)

You should be able to get close pretty easily if you first do
print-convert and then do pretty-write. You will want to tweak the
parameters that control print-convert based on which language level
you're using. Or, it may be better to run the test, discover it fails,
and then print out the source code of the test to send back to the
students instead of sending back the result (well, you could send back
"wrong answer", "got an error", or "timed out" or something granular
like that).

hth,
Robby


On Fri, Nov 27, 2015 at 6:57 AM, Paolo Giarrusso  wrote:
> On 27 November 2015 at 03:48, Robby Findler  
> wrote:
>> DrRacket pulls some shenanigans with the language dialog-based
>> teaching languages and it needs some adjust to make things work the
>> way you want with printing in 'raco test' and 'racket'.
>
> I fear I've seen that — but this goes beyond teaching languages. I've
> opened a separate thread for that.
>
>> Probably there
>> isn't a simple path to that precise goal, but maybe there is a way to
>> another goal?
>
>> Is it the case that you're trying to get things set up so that output
>> that you produce running inside the handin server is suitable to be
>> presented to students so that you can tell them that their submission
>> failed somehow?
>
> Yeah. With the complication that I'm also running tests of my own. And
> that we're perfectionist PhD students, so we're trying to have
> checkers with the same quality as the other HtDP material, without
> being Racket experts. Mid-semester.
>
>> (In which case, I might just prefix the error message
>> with "This is not exactly the error that you will see in DrRacket,
>> where you'll get a clearer message. Please run your program there.")
>
> Yeah, I'm afraid we'll have to do something like that. But then, I
> also need to reimplement `!test` because of different requirements:
> our checkers have tests that users don't have, and must pretty-print
> results to report errso
>
> Luckily, I can still copy more of it :-). Meanwhile, I've rediscovered
> the libraries in the handin-server which try to do that. There's code
> using mzlib/pconvert which gives me more hope, however legacy that
> library is declared.
>
>> My hope is to find time to get the #lang htdp/bsl (etc) languages up
>> to stuff so that my advice would switch to "use #lang htdp/bsl and all
>> will be fine" but I'm not there yet.
>
> That'd be... cool! At least Racket-generated errors would be better.
> Still, that doesn't help when implementing `!test` — unless I managed
> to do (!eval `(print ,v)). Should try that.
>
> Cheers,
> Paolo
>
>> On Thu, Nov 26, 2015 at 6:16 PM, Paolo Giarrusso  
>> wrote:
>>> Hi all!
>>>
>>> How does the REPL print values? In some circumstances I see graph printing 
>>> markers, even though `(print-graph)` is disabled. Because these are error 
>>> messages for students using teaching languages, cycle printing is not an 
>>> option.
>>>
>>> messages.rkt> (print-graph)
>>> #f
>>> messages.rkt> (list (game-state p p p))
>>> (list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))
>>> messages.rkt> (~v (list (game-state p p p)))
>>> "(list (game-state #0=(posn 150 100) #0# #0#))"
>>>
>>> Funnily, that doesn't happen in DrRacket, but it does happen both in 
>>> racket-mode, in my actual production environment, and under raco test. In 
>>> particular, test results in DrRacket are the ones I'd want, but are 
>>> inconsistent with the ones everywhere else.
>>>
>>> Apart from being frustrated at parameters, how do I gain control over this?
>>>
>>> PS: I've just found that `global-port-print-handler` is customized by 
>>> DrRacket. That seems incompatible with using `print` and relying on it 
>>> producing certain results. I understand that's the point of `print`, but 
>>> neither `write` nor `display` does what I want.
>>>
>>> HTDP code itself uses `~e` (also in htdp/error), but finding the 
>>> appropriate handler to install isn't trivial either; and that's not enough, 
>>> because sometimes I need to show the source code we evaluated.
>>>
>>> Sorry for how chaotic is this message — I guess that reflects my confusion 
>>> at Racket printing. (I've taken some looks at the relevant documentation, 
>>> but not at all of it).
>>>
>>> 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.
>
>
>
> --
> Paolo G. Giarrusso - Ph.D. Student, Tübingen University
> http://ps.informatik.uni-tuebingen.de/team/giarrusso/
>
> --
> 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 
> ema

Re: [racket-users] Value printing in REPL and for students

2015-11-27 Thread Paolo Giarrusso
On 27 November 2015 at 03:48, Robby Findler  wrote:
> DrRacket pulls some shenanigans with the language dialog-based
> teaching languages and it needs some adjust to make things work the
> way you want with printing in 'raco test' and 'racket'.

I fear I've seen that — but this goes beyond teaching languages. I've
opened a separate thread for that.

> Probably there
> isn't a simple path to that precise goal, but maybe there is a way to
> another goal?

> Is it the case that you're trying to get things set up so that output
> that you produce running inside the handin server is suitable to be
> presented to students so that you can tell them that their submission
> failed somehow?

Yeah. With the complication that I'm also running tests of my own. And
that we're perfectionist PhD students, so we're trying to have
checkers with the same quality as the other HtDP material, without
being Racket experts. Mid-semester.

> (In which case, I might just prefix the error message
> with "This is not exactly the error that you will see in DrRacket,
> where you'll get a clearer message. Please run your program there.")

Yeah, I'm afraid we'll have to do something like that. But then, I
also need to reimplement `!test` because of different requirements:
our checkers have tests that users don't have, and must pretty-print
results to report errso

Luckily, I can still copy more of it :-). Meanwhile, I've rediscovered
the libraries in the handin-server which try to do that. There's code
using mzlib/pconvert which gives me more hope, however legacy that
library is declared.

> My hope is to find time to get the #lang htdp/bsl (etc) languages up
> to stuff so that my advice would switch to "use #lang htdp/bsl and all
> will be fine" but I'm not there yet.

That'd be... cool! At least Racket-generated errors would be better.
Still, that doesn't help when implementing `!test` — unless I managed
to do (!eval `(print ,v)). Should try that.

Cheers,
Paolo

> On Thu, Nov 26, 2015 at 6:16 PM, Paolo Giarrusso  
> wrote:
>> Hi all!
>>
>> How does the REPL print values? In some circumstances I see graph printing 
>> markers, even though `(print-graph)` is disabled. Because these are error 
>> messages for students using teaching languages, cycle printing is not an 
>> option.
>>
>> messages.rkt> (print-graph)
>> #f
>> messages.rkt> (list (game-state p p p))
>> (list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))
>> messages.rkt> (~v (list (game-state p p p)))
>> "(list (game-state #0=(posn 150 100) #0# #0#))"
>>
>> Funnily, that doesn't happen in DrRacket, but it does happen both in 
>> racket-mode, in my actual production environment, and under raco test. In 
>> particular, test results in DrRacket are the ones I'd want, but are 
>> inconsistent with the ones everywhere else.
>>
>> Apart from being frustrated at parameters, how do I gain control over this?
>>
>> PS: I've just found that `global-port-print-handler` is customized by 
>> DrRacket. That seems incompatible with using `print` and relying on it 
>> producing certain results. I understand that's the point of `print`, but 
>> neither `write` nor `display` does what I want.
>>
>> HTDP code itself uses `~e` (also in htdp/error), but finding the appropriate 
>> handler to install isn't trivial either; and that's not enough, because 
>> sometimes I need to show the source code we evaluated.
>>
>> Sorry for how chaotic is this message — I guess that reflects my confusion 
>> at Racket printing. (I've taken some looks at the relevant documentation, 
>> but not at all of it).
>>
>> 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.



-- 
Paolo G. Giarrusso - Ph.D. Student, Tübingen University
http://ps.informatik.uni-tuebingen.de/team/giarrusso/

-- 
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] Value printing in REPL and for students

2015-11-26 Thread Robby Findler
DrRacket pulls some shenanigans with the language dialog-based
teaching languages and it needs some adjust to make things work the
way you want with printing in 'raco test' and 'racket'. Probably there
isn't a simple path to that precise goal, but maybe there is a way to
another goal?

Is it the case that you're trying to get things set up so that output
that you produce running inside the handin server is suitable to be
presented to students so that you can tell them that their submission
failed somehow? (In which case, I might just prefix the error message
with "This is not exactly the error that you will see in DrRacket,
where you'll get a clearer message. Please run your program there.")

My hope is to find time to get the #lang htdp/bsl (etc) languages up
to stuff so that my advice would switch to "use #lang htdp/bsl and all
will be fine" but I'm not there yet.

Robby


On Thu, Nov 26, 2015 at 6:16 PM, Paolo Giarrusso  wrote:
> Hi all!
>
> How does the REPL print values? In some circumstances I see graph printing 
> markers, even though `(print-graph)` is disabled. Because these are error 
> messages for students using teaching languages, cycle printing is not an 
> option.
>
> messages.rkt> (print-graph)
> #f
> messages.rkt> (list (game-state p p p))
> (list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))
> messages.rkt> (~v (list (game-state p p p)))
> "(list (game-state #0=(posn 150 100) #0# #0#))"
>
> Funnily, that doesn't happen in DrRacket, but it does happen both in 
> racket-mode, in my actual production environment, and under raco test. In 
> particular, test results in DrRacket are the ones I'd want, but are 
> inconsistent with the ones everywhere else.
>
> Apart from being frustrated at parameters, how do I gain control over this?
>
> PS: I've just found that `global-port-print-handler` is customized by 
> DrRacket. That seems incompatible with using `print` and relying on it 
> producing certain results. I understand that's the point of `print`, but 
> neither `write` nor `display` does what I want.
>
> HTDP code itself uses `~e` (also in htdp/error), but finding the appropriate 
> handler to install isn't trivial either; and that's not enough, because 
> sometimes I need to show the source code we evaluated.
>
> Sorry for how chaotic is this message — I guess that reflects my confusion at 
> Racket printing. (I've taken some looks at the relevant documentation, but 
> not at all of it).
>
> 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] Value printing in REPL and for students

2015-11-26 Thread Benjamin Greenman
I think you'll want to override the current-print

 parameter.

On Thu, Nov 26, 2015 at 7:16 PM, Paolo Giarrusso 
wrote:

> Hi all!
>
> How does the REPL print values? In some circumstances I see graph printing
> markers, even though `(print-graph)` is disabled. Because these are error
> messages for students using teaching languages, cycle printing is not an
> option.
>
> messages.rkt> (print-graph)
> #f
> messages.rkt> (list (game-state p p p))
> (list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))
> messages.rkt> (~v (list (game-state p p p)))
> "(list (game-state #0=(posn 150 100) #0# #0#))"
>
> Funnily, that doesn't happen in DrRacket, but it does happen both in
> racket-mode, in my actual production environment, and under raco test. In
> particular, test results in DrRacket are the ones I'd want, but are
> inconsistent with the ones everywhere else.
>
> Apart from being frustrated at parameters, how do I gain control over this?
>
> PS: I've just found that `global-port-print-handler` is customized by
> DrRacket. That seems incompatible with using `print` and relying on it
> producing certain results. I understand that's the point of `print`, but
> neither `write` nor `display` does what I want.
>
> HTDP code itself uses `~e` (also in htdp/error), but finding the
> appropriate handler to install isn't trivial either; and that's not enough,
> because sometimes I need to show the source code we evaluated.
>
> Sorry for how chaotic is this message — I guess that reflects my confusion
> at Racket printing. (I've taken some looks at the relevant documentation,
> but not at all of it).
>
> 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.


[racket-users] Value printing in REPL and for students

2015-11-26 Thread Paolo Giarrusso
Hi all!

How does the REPL print values? In some circumstances I see graph printing 
markers, even though `(print-graph)` is disabled. Because these are error 
messages for students using teaching languages, cycle printing is not an option.

messages.rkt> (print-graph)
#f
messages.rkt> (list (game-state p p p))
(list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))
messages.rkt> (~v (list (game-state p p p)))
"(list (game-state #0=(posn 150 100) #0# #0#))"

Funnily, that doesn't happen in DrRacket, but it does happen both in 
racket-mode, in my actual production environment, and under raco test. In 
particular, test results in DrRacket are the ones I'd want, but are 
inconsistent with the ones everywhere else.

Apart from being frustrated at parameters, how do I gain control over this?

PS: I've just found that `global-port-print-handler` is customized by DrRacket. 
That seems incompatible with using `print` and relying on it producing certain 
results. I understand that's the point of `print`, but neither `write` nor 
`display` does what I want.

HTDP code itself uses `~e` (also in htdp/error), but finding the appropriate 
handler to install isn't trivial either; and that's not enough, because 
sometimes I need to show the source code we evaluated.

Sorry for how chaotic is this message — I guess that reflects my confusion at 
Racket printing. (I've taken some looks at the relevant documentation, but not 
at all of it).

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.