[racket-users] cross-module `error` changed?

2020-11-06 Thread Shriram Krishnamurthi
Has something changed in how `error` works across modules? This code that I 
used last year without trouble seems to run into trouble now.

Here's the code all in one module:

#lang racket

(provide yield resume)

(define resumer #f)

(define (yield)
  (let/cc k
(set! resumer k)
(error 'yield "yielding computation")))

(define (resume)
  (resumer 'dummy))

(define (fact n)
  (if (= n 0)
  1
  (begin
(when (= (remainder n 10) 0)
  (yield))
(* n (fact (- n 1))

It results in the following (desired) interaction:

> (fact 10)
. . yield: yielding computation
> (resume)
3628800

But now I'm going to remove the definition of `fact` and put it in another 
module, saving the remainder as `yielder.rkt`:

#lang racket

(require "yielder.rkt")

(define (fact n)
  (if (= n 0)
  1
  (begin
(when (= (remainder n 10) 0)
  (yield))
(* n (fact (- n 1))

Now I get the following error. What should I be doing instead?

> (fact 10)
-- #(struct:exn:fail:contract "vector-ref: contract violation\n  expected: 
vector?\n  given: '((error 'yield \"yielding computation\") 
# 10 4 113 37)\n  argument position: 
1st\n  other arguments...:\n   0" #)
  (errortrace-stack-item->srcloc . #(struct:srcloc 
# 168 0 6297 
203))
  (pick-first-defs . #(struct:srcloc # 331 0 13000 
425))
  (get-exn-source-locs . #(struct:srcloc # 585 0 23184 
391))
  (#f . #(struct:srcloc # 486 18 20735 32))
  (error-display-handler/stacktrace . #(struct:srcloc 
# 362 2 15076 2612))
  (call-with-exception-handler . #(struct:srcloc 
# 
266 2 9251 256))
  (fact . #(struct:srcloc # 5 0 40 139))
  (eval-one-top . #f)
  (call-with-exception-handler . #(struct:srcloc 
# 
266 2 9251 256))
  (loop . #(struct:srcloc # 1210 24 50804 979))
  (call-with-break-parameterization . #(struct:srcloc 
# 
148 2 4909 517))
  (#f . #(struct:srcloc # 1180 9 49153 5062))
  (#f . #(struct:srcloc # 1493 15 64385 1548))
  (#f . #(struct:srcloc # 435 6 19067 1056))
  (#f . #(struct:srcloc # 486 32 21054 120))
  (call-with-break-parameterization . #(struct:srcloc 
# 
148 2 4909 517))
  (eventspace-handler-thread-proc . #(struct:srcloc 
# 370 11 16515 690))
exception raised by error display handler: vector-ref: contract violation
  expected: vector?
  given: '((error 'yield "yielding computation") 
# 10 4 113 37)
  argument position: 1st
  other arguments...:
   0; original exception raised: yield: yielding computation

-- 
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/6aa1ad8a-9f1a-4c11-8b75-5ed3ca09797dn%40googlegroups.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
Apologies, I left in some debugging code. All we need is

@(define (markdown-inline file)
   (xexprs->scribble-pres
 (with-input-from-file file read-markdown)))

This will do you job, Jos Koot. For instance:

@title{Hello}
@(markdown-inline "new.md")


combined with (as "new.md")

This is a

* list
* mind-mapping
* points

written in a style that isn't too wordy.


produces

[image: image.png]

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


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
>
> In that case, does it work if you simply remove the call to `decode-flow`
> from the definition of `markdown-inline`? Then the function would
> just return a list of pre-parts to be spliced into the enclosing document.
>

Doh. It appears to indeed!


> If you want to make the Markdown sections properly nest under the current
> section, you would probably need to adjust the depths of all `part-start`
> instances in the result. For example, if you use `markdown-inline` within a
> subsection, you would probably want to increase the depth of all
> part-starts by 2. I don't know if it's possible to find the current depth
> automatically, so you might need to make it an extra argument to
> `markdown-inline`.
>

Thanks.


>
> I also would have expected calling `decode` and then extracting and
> appending the blocks and parts to work, although it would have different
> behavior wrt the trailing text. Your original message said that didn't
> work, but how did it fail?
>

Yeah, I can't even remember all the things I tried.

I think there's value to figuring out a good set of abstractions here.
There's real value to being able to have, e.g., co-authors who can only
handle Markdown incorporate their work into Scribble pages. For now, with
my semester under way, I think I'll pass on that task (-:. Hopefully this
thread is useful to someone else who comes along and needs to do this.
Short and final version:

@(define (markdown-inline file)
   (pr
 (xexprs->scribble-pres
   (with-input-from-file file read-markdown

Shriram

Shriram


>
> Ryan
>
>
> On Sun, Sep 13, 2020 at 1:50 PM Shriram Krishnamurthi 
> wrote:
>
>> It's useful to have this behave like a `#include`. There are settings
>> where you want to have a non-Scribble person author things that go "in the
>> middle"; you want to think of this as just a more convenient way of writing
>> what you'd have written in Scribble.
>>
>> I realize there's presumably a closure issue (`section` isn't going to
>> come from the including file), and for that you probably want a different
>> include form as well.
>>
>

-- 
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/CAJUf2ySAir23z0uPYsZunszhoUqdH7HOv7RihCA3tHYSGxq4Jg%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
It's useful to have this behave like a `#include`. There are settings where
you want to have a non-Scribble person author things that go "in the
middle"; you want to think of this as just a more convenient way of writing
what you'd have written in Scribble.

I realize there's presumably a closure issue (`section` isn't going to come
from the including file), and for that you probably want a different
include form as well.

-- 
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/CAJUf2yRcPq3-Gvxy3F95PJhBmiebquEvU3Sz6-y%3D98LFb_Wnvw%40mail.gmail.com.


[racket-users] Incorporating Markdown documents into Scribble

2020-09-12 Thread Shriram Krishnamurthi
I need a little help with `decode` vs `decode-flow` in Scribble. (Also, 
this thread is about a question I wasn't able to find answered anywhere, so 
hopefully it will lead to a solution that others can also use.)

Sometimes it's really useful to incorporate Markdown-formatted content into 
the middle of a Scribble document. (Let's not argue about this, please!) My 
assumption is that the Markdown document lives in a separate file (I'm not 
trying to do any clever textual inlining). Thanks to Greg Hendershott, I'm 
almost there! I use

https://github.com/greghendershott/markdown

Here are two versions of the inlining function:

@(require markdown markdown/scrib scribble/decode)

@(define (markdown-inline file)
   (decode-flow
   (xexprs->scribble-pres
 (with-input-from-file file read-markdown

@(define (markdown-part file)
   (decode
   (xexprs->scribble-pres
 (with-input-from-file file read-markdown

As a practical matter, `markdown-part` needs to take lots of extra 
arguments to create the appropriate part instead of just producing a 
title-less section. More importantly, you often don't want a separate 
section: you just want to "splice" the content into the current context.

`markdown-inline` works great for this purpose, *except* if the included 
Markdown file contains any sections of its own, e.g.,

This is text.

> Lorem ipsum

# Section

## Subsection

Then I get this error:

decode-flow: contract violation

  expected: pre-flow?

  given: (part-start 0 #f '((part "section")) (style #f '()) '("Section"))
Any recommendations on how to create a "splicing" version that also 
respects having sub-sections, or is that impossible? (I've tried pulling 
out parts of the `part`, etc., but without success.)

Thanks!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3f0b1012-783d-464a-a0ed-66d3f29f8893n%40googlegroups.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Shriram Krishnamurthi
I asked students to go to File | Install Package (not the DWIM box). From
there, I too get this "inferred package name includes disallowed
characters" message as Robby. But that isn't what my student got… So it
seems a bit unlikely this is the issue?

There is the possibility this is somehow different on Windows due to CR+LF
issues. Maybe one of the characters is being treated as a line-terminator
while the other is getting appended to the repo-name, causing the "might
not refer to" error? Perhaps someone with a Windows box could test out
John's "multiple paste" conjecture and see whether they get my student's
error message (see top posting of this thread) instead?

For what it's worth, I had to try quite hard to copy the newline off
github…so it would be impressive if two students in my class did just that.
(And it would be a remarkable piece of sleuthing by 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2yTs0iC4rT8mbaU1BrWq08FRQrCFqWL9YqbFWUHmqr1CXQ%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Shriram Krishnamurthi
It's not me doing this, it's a student. I agree this is always a
possibility. But note that it also happened to a TA. I suppose they could
all have been making the same mistake.

-- 
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/CAJUf2ySBo9pwA4oyr62%3D-1MxiFLY-F0YL_kA4x-eXXqsbHqQDQ%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Shriram Krishnamurthi
The original student (on Windows 10) has confirmed they were able to
install with raco on the shell, which further lends credence to the
likelihood that the PM and raco are doing something differently.

(I have some other issues w/ the caching and how clearing out the trash
doesn't seem to affect the cache, but I'll put that off for another day.
<-;)

On Thu, Sep 10, 2020 at 10:06 AM Philip McGrath 
wrote:

> Also, this is happening over encrypted HTTPS: no one is sniffing the
> User-Agent header.
>
> My initial attempt to reproduce in the GUI package manager was foiled
> because I’d first tried installing at the command line, and the package
> manager used a cached copy of the repository. From Shriram’s update
> last night, it sounds like the GUI package manager and “raco pkg” are doing
> something differently.
>
>
> --
> -Philip
>

-- 
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/CAJUf2yQTO5dN7yKjvGu_mR13cD2BdkAHLGj2DU7Xdyeo5Ww-RQ%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-10 Thread Shriram Krishnamurthi
Please note that, per my message last night, this is also happening (my TA
claims he saw the *identical* text: multiple red lines, etc.) on macOS 11.
So it's not just for Windows any more.

On Thu, Sep 10, 2020 at 9:20 AM George Neuner  wrote:

>
> On 9/10/2020 7:37 AM, Hendrik Boom wrote:
> > On Thu, Sep 10, 2020 at 12:49:25AM -0400, George Neuner wrote:
> > >
> > > I don't know if DrRacket even sends a "user agent" string.
> >
> > If DrRacket can send a user agent string, so can malware.
> >
> > So it's not really reliable to filter on the user agent string.
> >
> > -- hendrik
>
> Of course ... any HTTP request can forge a user agent string:  most
> browsers allow you to change it, and so do some HTTP aware
> applications.  E.g., there is a plugin for Firefox that changes it on
> the fly based on the URL - use cases involve things like Google image
> search behaving differently for Chrome vs non-Chrome users, and
> Microsoft sites behaving differently for non-Windows users.
>
> My point is that there may be something unseen - probably a firewall -
> blocking the DrRacket request but not blocking requests from the known
> browser.  If it isn't some software installed on the machine itself, it
> likely is an IT appliance guarding the whole network. Firewall
> appliances are NAT routers: they can look inside even encrypted
> connections to examine protocols being used and the raw data passing
> through.
>
> Based on the error from Shriram's message, it looks like DrRacket is
> successfully calling out but doesn't like/understand the response ...
> which would tend to eliminate Windows built-in firewall as a suspect [it
> doesn't do protocol inspection].  It still could be other AV/firewall
> software on the machine, or something upstream in the network that his
> student is unaware of.
>
> YMMV,
> George
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Racket Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/racket-users/7rMAEma8Xkg/unsubscribe.
> To unsubscribe from this group and all its topics, 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/8a1628af-b647-5272-1c9a-da347b604091%40comcast.net
> .
>

-- 
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/CAJUf2yQcbB98opH%3D%2BYs0R6XTFAY14hphTnQejnvPRf%3D03o12qQ%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-09 Thread Shriram Krishnamurthi
For what it's worth, one of my TAs now informs me he got the same
error on macOS
11.0 Beta.

He says he just has the standard macOS firewall. He whitelisted DrRacket
and it persists.

I asked him to try installing Racket 7.7 and installing the package through
that; same issue.

He was only able to get it working from the command-line.

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


Re: [racket-users] package manager woes on Windows 10?

2020-09-09 Thread Shriram Krishnamurthi
Thank you. Can you imagine why the proxy would affect DrRacket but not the
Web browser?

-- 
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/CAJUf2yQiPVrCNa8THaAnw5cbycYqjukSD6pgpUU5Kqt-xfehig%40mail.gmail.com.


Re: [racket-users] locally linked package name doesn't match info collection name

2020-09-09 Thread Shriram Krishnamurthi
I'm curious why the Package Manager doesn't also show the collection name
(or plural)? Wouldn't I need that to trace backwards? "This program in
#lang foo is behaving oddly, I wonder what foo's source is" — find the
collection in the PM, trace back to the package, locate the source…?

-- 
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/CAJUf2yQqHiryeTsn8Az2PqWPbXV2YwLxGxtNPK_UEVJyGPcJpw%40mail.gmail.com.


[racket-users] locally linked package name doesn't match info collection name

2020-09-09 Thread Shriram Krishnamurthi
This is almost certainly intended and/or I may have totally misunderstood 
the semantics of the info file, but this feels a bit confusing:

I have a package on my filesystem in the directory 
mystery-languages-uploader. The "-uploader" part is a local name that's not 
intended for public consumption, so its info.rkt contains this:

(define collection "mystery-languages")

Sure enough, I am able to use the content of that directory using, e.g.,

#lang mystery-languages/…

However, the Package Manager only shows an entry (in the "Name" column) for 
"mystery-languages-uploader", not "mystery-languages". (The "Source" column 
shows the right folder, and the search box under "Currently Installed" does 
not show any other package of similar name.)

I would have expected the collection setting to cause the Name showing in 
the Package Manager to be just "mystery-languages", which would also help 
me understand where that #lang is coming from.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f99c0426-cb6e-478b-a794-dec114f8cef7n%40googlegroups.com.


Re: [racket-users] Re: provide-if-not-defined

2020-09-03 Thread Shriram Krishnamurthi
Ah, I see, that's a nice idea!

One problem is have well over a dozen of these that I want to pass-through,
but I suppose I could write a

(rename-prefix   ...)

that turns into a bunch of define's. I'd have to be careful to not miss any.

Another issue is that I have to redefine some of the language-definition
primitives (like #%app), which will definitely make the module far more
tricky.

-- 
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/CAJUf2yQY-RVM%2BsH8%2BnHzFJFPwm5p5%3DGq%2BHGj42Ao7QQ0wJqnrQ%40mail.gmail.com.


Re: [racket-users] provide-if-not-defined

2020-09-03 Thread Shriram Krishnamurthi
Thank you both.

What I want is something closer to what Oak wrote, but that addresses only
*checking*, whereas I also want the convenience of defining the module.

So to use Oak's example, I want to be able to write

#lang racket/base

(provide-if-not-defined + - *)

at the top of *all three files*, but in test-b.rkt, also write

(provide [rename-out (my-+ +)])

So yes, if it turns out, say, `*` is not in racket/base, then all three
files will indeed give me an error (at definition), like Oak's checker
would. But this also reduces error by letting me duplicate the interface
across files, while still being able to override parts of it, like in
test-b.rkt, without producing an error that + is being exported twice.

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


[racket-users] Re: consistent interfaces from multiple files

2020-09-02 Thread Shriram Krishnamurthi
I realize I could have used `define-language` and 
`define-extended-language` and friends from Redex, except … `redex-match` 
works over terms, not over syntax objects. 

Of course I also can't write

(redex-match LANG NON-TERM (term (syntax->datum S)))

because TERM is a special form, so it doesn't evaluate.

-- 
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/e8c0fa47-1860-48a1-b67a-a586af41e614n%40googlegroups.com.


[racket-users] provide-if-not-defined

2020-09-02 Thread Shriram Krishnamurthi
Related to my previous post [
https://groups.google.com/g/racket-users/c/OqyqDFxwhf0], I have several 
cases where I have this kind of pattern:

V1:

#lang racket
(provide +)

V2:

#lang racket
(provide [rename-out (my-+ +)])
(define my-+ …)

Each variant provides some/all primitives directly from the module's lang, 
while a sibling variant changes their behavior.

Since there are a lot of names, it gets tiresome to remember which things 
have and haven't been exported. Duplicates are of course caught statically, 
but missing names are not "caught" at all at module definition time.

It'd be nice to be able to write, say a block like

#lang racket
(provide-if-not-defined +)

at the top of BOTH files. In V1, this turns into provide; in V2 I'd still 
write the rename-out, but would only need to do this for the (usually) 
small number of operations that I am overriding. Having a common block at 
the top of each variant would ensure that the variants provide the same 
language.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/46a4bed5-1839-4482-b8f2-7b54076fbb7dn%40googlegroups.com.


[racket-users] consistent interfaces from multiple files

2020-09-02 Thread Shriram Krishnamurthi
This may be a somewhat niche request, but hopefully it's just a special 
case of a common need.

I have multiple files, say V1 and V2, that each provide the same surface 
language constructs – e.g., #%app, some macros, some functions — but of 
course implemented in different ways. I also have additional files, say V21 
and V22, that need to extend the common language of V1/2 in a consistent 
way (e.g., add a few more macros and functions that both V21 and V22 
provide).

By default, I can only identify missing things through tests. I would like 
to statically ensure that I have provided the same interfaces, and ideally 
describe the delta between V21/22 and V1/2 (rather than copy the 
description of V1/2 into V21/22).

Essentially, I want to describe the grammar in one place, à la BNF, 
including the names of primitives and such. Note that I want a 
*specification* of the language, separate from its implementation (since 
I'd also like to generate a Web page giving that spec).

There's define-syntax-class for creating new classes for use in a 
syntax-parser. I suppose I could create a rather complex syntax class that 
represents the whole language; presumably I would then apply to this to the 
entire body through module-begin (and to REPL instructions via 
top-interaction)?

Has anyone done something like this and would care to share an example?

Thanks!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ad36eb34-24a0-4b87-8466-1e01fb1d5396n%40googlegroups.com.


[racket-users] abstraction suggestion?

2020-08-31 Thread Shriram Krishnamurthi
I'm having some trouble abstracting over this code. Any suggestions?

I have numerous files that follow this boilerplate:

#lang racket

(require )

(provide (rename-out [mod-begin #%module-begin]
 [ti#%top-interaction]))

(define-values (namespaces lang-print-names)
  )

(define-syntax (multi-runner stx)
  (syntax-case stx (TEST)
[(_ (TEST e r ...))
 #`(test-output 'e (list 'r ...) namespaces)]
[(_ e)
 #`(show-output 'e namespaces lang-print-names)]))

(define-syntax mod-begin
  (λ (stx)
(syntax-case stx ()
  [(_ b ...)
   #'(#%printing-module-begin (multi-runner b) ...)])))

(define-syntax ti
  (λ (stx)
(syntax-case stx ()
  ([_ . e]
   #'(#%top-interaction . (multi-runner e))

I've abstract most of the details into `test-output` and `show-output` into 
. I would ideally like to move as much of what's left as 
possible into the same file. 

The key problem is that the MB and TI depend on `multi-runner`, which in 
turn depends on `namespaces`, which is a name at run time. As long as 
everything is in the same module, no problem. But when I start to move the 
boilerplate out…

Concrete suggestions welcome — I've tried several different things (various 
forms of abstraction, syntax parameters, etc.) without luck.

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/362f807e-3561-4be6-8b4d-937776fea36bn%40googlegroups.com.


Re: [racket-users] printing errors

2020-08-29 Thread Shriram Krishnamurthi
Thank you!

Is there a way of further suppressing info? Right now I get output like

[image: image.png] ../../make-semantics.rkt:37:13: a: undefined


which is a reference to the language implementation file rather than to the
program in the language.

The programs here are so small that suppressing everything but the "a:
undefined" would be great.

-- 
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/CAJUf2yQgBahzMQP-rPOAXM6xWkvAiR0EstzVNLweEYo83A6mEQ%40mail.gmail.com.


Re: [racket-users] printing errors

2020-08-27 Thread Shriram Krishnamurthi
This is perfect, thanks!

Two follow-up questions:

1. The error printer seems to print an extra newline at the end relative to
what the port-display-handler (for instance) shows. Is there a way to
suppress that?

2. The stack trace seems to be extracted automatically. Is there a way to
suppress it entirely?

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


[racket-users] printing errors

2020-08-27 Thread Shriram Krishnamurthi
Given an exception, is there a way to print the error using Racket's 
conventional error printing machinery (e.g., in color in DrRacket, etc.), 
without halting execution?

I would like to be able to integrate this with #%printing-module-begin and 
#%top-interaction. Unfortunately, those by default will halt execution 
after printing the message.

-- 
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/a6277017-9dc8-44d1-8c97-119cb431cf4bn%40googlegroups.com.


[racket-users] namespaces + eval + reader

2020-07-30 Thread Shriram Krishnamurthi
 want to create a namespace for (say) the BSL language in DrRacket. 
Critically, I need the *reader* to be aligned with this language. 
Otherwise, small semantic discrepancies creep in.

Concrete example:

> (define n (make-base-namespace))
> (eval `(require lang/htdp-beginner) n) 
> (eval `(equal? 3 3.0) n) 
#f

However, in BSL,
Language: Beginning Student; memory limit: 128 MB.
> (equal? 3 3.0)
#true

The expressions being `eval`ed are coming from a file, via `read`. I have 
the freedom to change things there.

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/54945d7b-24f2-4225-ade4-924505485c80n%40googlegroups.com.


[racket-users] telling apart files ending with a newline

2020-07-29 Thread Shriram Krishnamurthi
Suppose I have two files that are identical, except one ends in a newline 
and the other does not. If I use `read-line` to read the successive lines 
of this file, because it swallows the line separators, there is no way to 
tell them apart. E.g., these two strings

"a
b"

and

"a
b
"

read using `read-line` and `open-input-string` produce the same result.

This is unfortunate for a program SPDEGabrielle has induced me to write (-:.

Any reasonable ways to work around this that rely, as much as possible, on 
the OS-specific handling `read-line` already provides?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/250c95c9-24b6-467a-ad08-0cd81abded66n%40googlegroups.com.


Re: [racket-users] combining require, build-path, and namespaces

2020-07-21 Thread Shriram Krishnamurthi
Ooh, thank you Oak and Jens Axel! I would never have figured that out.

As Matthew's email from Jan 2020 says, having the documentation say
something (and, in particular, suggesting the use of `parameterize` to get
what many users might expect) would be quite lovely.

(Thanks also, Greg.)

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


Re: [racket-users] combining require, build-path, and namespaces

2020-07-21 Thread Shriram Krishnamurthi
Thank you! Would you know why I might get this error:

; require: unknown module

;   module name:

; #>

(This is from inside a module.)

Trying the same at the REPL, I see the same thing:

> (define n (make-base-namespace))

> (namespace-require `(file ,(path->string (build-path "wheats" "w1.rkt"

[note no optional namespace]
works fine; the name is available at the top-level; but using the same
pathname but with the namespace parameter:

> (namespace-require `(file ,(path->string (build-path "wheats" "w1.rkt")))
n)

; require: unknown module

;   module name:

; #>

(The file in question begins with #lang racket.)

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


[racket-users] combining require, build-path, and namespaces

2020-07-21 Thread Shriram Krishnamurthi
How I can combine these three? I want to do something like this:

(define n (make-base-namespace))
(define p (build-path f))
(eval `(require ,p) n)

Racket doesn't like that: bad syntax for require sub-form because p is a 
path-typed value.

Essentially, I want to inject the module at f into n so that the provided 
identifiers of f are visible inside n. (I haven't been able to get 
dynamic-require working either, nor is it an entirely satisfactory solution 
because I may not always know what names f is providing.)

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/978e4a26-d7fc-4e5d-aabe-6464a3181420n%40googlegroups.com.


Re: [racket-users] Re: Scribble: customizing table borders

2020-07-19 Thread Shriram Krishnamurthi
That did the trick well enough, thank you!!! (I wouldn't mind a cleaner
solution, but it gets the job done for now.)

-- 
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/CAJUf2yS9ypVeqv9uMR_G_Zw3WPaPQpq-Q9TAFWB7ucncWL6VHA%40mail.gmail.com.


[racket-users] Scribble: customizing table borders

2020-07-19 Thread Shriram Krishnamurthi
It *appears* that in Scribble, the color of a table's borders (e.g., 
bottom-border) is fixed: e.g.,

5

generated from a program such as

@tabular[#:sep @hspace[2]
 #:row-properties '(() () bottom-border ())
#:style (style "LongMult" null)

I haven't had any luck coming up with the right CSS incantation that would 
let me override exactly that black and not change anything else.

Yes, I can tag these with a style, as above, which translates into a class 
name. But because the black setting is most deeply nested, I can't seem to 
change it at all. For instance,

.LongMult {
border-bottom: 1px solid red;
}

*adds* a new red bottom border for the whole table while leaving the 
intermediate black one intact, while 

.LongMult td {
border-bottom: 1px solid red;
}

adds a red bottom border to every row *except* the one that is black (since 
the generated code presumably overrides the outer CSS). It feels like 
perhaps this should have been a named and modifiable class in scribble.css 
rather than a hard-coded constant?

(My central problem is I have a site that is in "dark mode", so the black 
essentially disappears against the background. So the need to change this 
color is a functional one, not just aesthetic.)

Any ideas? Thanks!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/09e8a87b-3532-491f-a297-635d07d6ed9dn%40googlegroups.com.


[racket-users] emoji in source code

2020-07-19 Thread Shriram Krishnamurthi
I wrote the following program:

  (define /: ')

which at least on my screen looks like



in Aquamacs and in my browser (modulo dark/light mode).

However, no matter which mode I use in OS X AND which color mode I use in 
DrRacket, the emoji just isn't visible:



Not the most pressing problem in the world, but figured this is probably 
not desirable.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/af814198-b86b-4905-a741-4b59d605ca8co%40googlegroups.com.


[racket-users] nested-flow and inset

2020-07-11 Thread Shriram Krishnamurthi
My reading of the documentation for `nested-flow`

https://docs.racket-lang.org/scribble/core.html#%28def._%28%28lib._scribble%2Fcore..rkt%29._make-nested-flow%29%29

is that I can use 'inset as the first argument. However, when I try to do 
so, I get a contract error:

make-nested-flow: contract violation

  expected: style?

  given: 'inset

  in: the 1st argument of

  (-> style? (listof block?) nested-flow?)

  contract from: 

  /scribble-lib/scribble/core.rkt

This *looks* like it contradicts the documentation, which says that the 
first argument is any/c:



Even if the documentation is wrong, I'm not sure why 'inset is being 
rejected…

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/6b1fd9c4-b3ef-4a3f-a95a-05f913a0afcbo%40googlegroups.com.


[racket-users] Gtk initialization failed for display ":0"

2020-07-11 Thread Shriram Krishnamurthi
I'm running headless Racket from a Docker container for auto-grading 
assignments in Gradescope.

The students are writing BSL programs with 2htdp/image. This does not cause 
any problems for most of them.

Two students, however, get an error in file loading with the error message 
in the subject line («Gtk initialization failed for display ":0"»).

I finally localized the problem: it's because they are using the universe 
Teachpack.

I don't know what in universe is causing this, but it seems rather weird 
that *image*, which is fundamentally graphical, does not cause this problem 
but *universe*, which is it fundamentally not, does.

Furthermore, this dependency means that any program that depends on 
universe would likely not be able to be auto-graded (at least in a 
Gradescope-like headless context), which seems a rather severe restriction. 
(And ironic, given that the design of universe is to enable testing, and 
hence also auto-grading.) I don't know how Northeastern does auto-grading 
of universe that gets around this, but it's clearly in a different setting.

I don't have a "question" because I seem to have identified the base issue 
here. This is mostly here for future reference, since I saw some posts from 
looking for that string that didn't answer my need (but were still useful 
in indicating it might be a dependency), so I'm leaving this here for a 
future person who might be searching.

However, it would also be nice if the universe Teachpack could avoid this 
dependency entirely or refactor it into parts that do and don't need it.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/7e2da814-25e5-4547-b5d9-2c66c087f37eo%40googlegroups.com.


Re: [racket-users] suppressing parts of Scribble (HTML) output

2020-07-02 Thread Shriram Krishnamurthi
Oh my gosh, this is *exactly* what I need! Thank you!!!

-- 
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/CAJUf2yQiH-3E9yDhbb693vc-EUKMf2vG8i4mZ_B7LhWnYtnwOA%40mail.gmail.com.


[racket-users] suppressing scribble-common.js in Scribble output

2020-07-02 Thread Shriram Krishnamurthi
How does one suppress scribble-common.js? I really don't understand why the 
file loads for all Scribble langs — it contains things like search box 
support for documentation! 

In addition, it takes over the window.onload, overriding any previous 
content. About this, it has the following odd remark:

// Note: could make a function that inspects and uses window.onload to 
chain to
// a previous one, but this file needs to be required first anyway, since it
// contains utilities for all other files.

I'm not sure what "all other files" it's referring to, but it actually 
appears *last* in the load sequence. (E.g., loading additional JS through a 
custom prefix means those get loaded before scribble-common.js…is there 
some other way of loading JS files so they are loaded *after*
 scribble-common.js?)

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e219a0cd-7646-4bdf-a620-ac0d70f38cceo%40googlegroups.com.


[racket-users] suppressing parts of Scribble (HTML) output

2020-07-02 Thread Shriram Krishnamurthi
I am trying to use Scribble to generate HTML documents (blog-like, but not 
exactly, so Frog doesn't meet my needs) but would really like to eliminate 
the material in the left gutter (TOC). (Ideally I'd also like to suppress 
the author tag.)

I've spent some time going through the source of Greg Hendershott's Frog 
and Ryan Culpepper's Scriblogify and both seem to use essentially the same 
technique, which is a total hack: call Scribble to generate the HTML, then 
go into it and search for a particular DOM structure to extract the "main 
content". For instance, Scriblogify does this

(define (get-blog-entry file)

  (let* ([doc (call-with-input-file file html->xexp)]

 [title ((sxpath "//title/text()") doc)]

 [title (and (pair? title) (car title))]

 [content

  ((sxpath 
"//div[@class='SAuthorListBox']/following-sibling::node()") doc)]

while Frog does

  ;; Extract the part we care about -- the elements in the "main" div

  ;; after the "versionbox" div.  (The `match` might be too fragile

  ;; way to do this.)

  (match (~> (build-path dir "frog.html")

 (with-input-from-file read-html-as-xexprs)

 cadr)

; HTML produced from #scribble/manual

[`(html

   ()

   (head . ,_)

   ,(list-no-order

 `(div ([class "maincolumn"])

   (div ([class "main"])

(div ([class "versionbox"])

 (span ([class "versionNoNav"]) ,_))

. ,xs))

 _ ...))

 (adjust-scribble-html xs img-uri)]

(it actually has different patterns depending on the Scribble language 
used!).

What's a better, cleaner way of doing this? I *suppose* one could build a 
whole renderer, which seems like an insane amount of work. Hopefully 
there's a way of doing this as a "delta" on the existing renderer, but I 
haven't had any luck finding an example of a custom renderer that, say, 
suppresses the printing of the TOC and/or the author list but leaves the 
rest of the page alone.

[Yes, I could set up the CSS so that the TOC appears hidden, but it would 
still be present in the source and could be found by one of several means. 
I would really like it to not be there. And I hope there's a better way of 
doing it than modifying the JavaScript to, on load, go and delete the 
undesired elements…]

Any ideas/suggestions/pointers? Thanks!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/246966eb-3521-40fe-93c5-b4bf6a81379eo%40googlegroups.com.


[racket-users] Gradescope support

2020-05-23 Thread Shriram Krishnamurthi
If anyone else here is looking for it, the first release of my Gradescope 
autograding support for Racket is here:

https://github.com/shriram/gradescope-racket

It's still a work in progress but sufficient to get off the ground (e.g., 
if I fix nothing it'll still get me through my summer needs).

Thanks all for your help (especially Alex Harsanyi).

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c38d4b07-f8fc-4d12-a9cb-338d5077f74a%40googlegroups.com.


Re: [racket-users] Re: rackunit and logging

2020-05-23 Thread Shriram Krishnamurthi
Thanks to a helpful reply from Matthias I came across this posting

https://github.com/racket/rackunit/pull/107#issuecomment-480808330

which pointed out "The *test* forms are the things that wrap evaluation,
catch errors and continue, etc."

If I rewrite the above as

(define-test-suite hw
  (test-equal? "1" 1 1)
  (test-equal? "2" 1 (/ 1 0))
  (test-equal? "3" 1 (error "raised an error"))
  (test-equal? "4" 1 2))

(foldts-test-suite
 (λ (suite name before after seed) (before) seed)
 (λ (suite name before after seed kid-seed) (after) (append seed kid-seed))
 (λ (case name action seed) (cons (run-test-case name action) seed))
 empty
 hw)

then I don't need the exception handler at all (it appears…). So that may
be most of what I need? Not sure if I'm missing something else, I'll report
back if I am. (-:

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2yRv3zYVZOP%3Dnxwvp1%2Bd9e-CEB5N%3D59fs%2Bjmxfo6fB5Oqg%40mail.gmail.com.


[racket-users] foldts-test-suite

2020-05-23 Thread Shriram Krishnamurthi
The documentation

https://docs.racket-lang.org/rackunit/internals.html?q=run-test-case#%28def._%28%28lib._rackunit%2Fmain..rkt%29._foldts-test-suite%29%29

says that `folds-test-suite` can be implemented in terms of
`fold-test-results` as follows:

(define

 (fold-test-results

 suite-fn case-fn seed test)
  (foldts-test-suite

   (lambda

 (suite name before

 after

 seed)
 (before

)
 (suite-fn name seed))
   (lambda

 (suite name before

 after

 seed kid-seed)
 (after

)
 kid-seed)
   (lambda

 (case

 name action seed)
 (case-fn
   (run-test-case

 name action)
   seed))
   seed
   test))

I'm curious why the value of `seed` in the second argument (the fup
position) — highlighted — is ignored. I was guessing that, since this is a
tree-fold, there are values "from across" and "from down", and we don't
want to throw either one away. Wouldn't we want to take a combinator that
combines the two?

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


Re: [racket-users] Re: rackunit and logging

2020-05-23 Thread Shriram Krishnamurthi
Sorry to be thinking out loud here…

I thought the reason Alex might be using `foldts-test-suite` instead of
`fold-test-results` is because the latter automatically runs each test but
the former leaves that in programmatic control. I thought this would enable
me to catch exceptions, thus (using Alex's really good names for the
pieces). E.g.:

(define-test-suite hw
  (check-equal? 1 1)
  (check-equal? 1 (/ 1 0))
  (check-equal? 1 2))

(foldts-test-suite
 (λ (suite name before after seed) (before) seed)
 (λ (suite name before after seed kid-seed) (after) (append seed kid-seed))
 (λ (case name action seed)
   (let ([outcome (with-handlers ([exn:fail?
   (λ (e)
 (println "got here")
 (cons 'test-failed seed))])
(run-test-case name action))])
 (cons outcome seed)))
 empty
 hw)

Unfortunately, the `with-handers` does not seem to be taking effect at all:
the runner still halts with an error. Can anyone see what I'm missing?

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


Re: [racket-users] rackunit and logging

2020-05-23 Thread Shriram Krishnamurthi
For those reading this later: there's a bunch of useful information in Alex
Harsanyi's blog post and corresponding code:

https://alex-hhh.github.io/2019/11/custom-rackunit-test-runner.html
https://github.com/alex-hhh/ActivityLog2/blob/master/test/custom-test-runner.rkt

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


Re: [racket-users] Re: rackunit and logging

2020-05-23 Thread Shriram Krishnamurthi
Thank you, Alex, this seems to have just the right set of information. I'm
curious why you use `foldts-test-suite` instead of  `fold-test-results`,
whose documentation says "Hence it should be used in preference to
foldts-test-suite
."
(And while David's points about the verbosity are well taken, my TAs are
likely to be used to the rackunit primitives, though I think I'll consider
borrowing some of his aliases for shorter testing primitive names.)

In the success case, the result seems to be `void` (rather than, say, a
value corresponding to the type of test). Are there cases where it's not
void?

In the failure case, is there a procedure to convert the `exn:test:check`
value into a human-readable string? I'm guessing you have some
serialization process for the XML test report.

Sadly, errors during test execution aren't sandboxed, so if there's an
error in a test, the whole suite breaks down. I think this means I'm going
to have to write custom testing procedures anyway.

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


Re: [racket-users] Re: rackunit and logging

2020-05-23 Thread Shriram Krishnamurthi
Thank you all!

*Alexis*, thanks for the explanation.

*Alex*, thanks for that information. I'm going to go investigate that next.

*Dave*, the documentation style is fine, it's sometimes easier to read the
doc right next to the implementation. (-:

However, I'm not quite sure how even your example works. Maybe someone can
check my logic? For instance, you say you want to write tests like

(unless (is os 'windows) (ok test-that-won't-pass-on-windows))

However, `is` seems to return the same value no matter whether the test
passed or failed: it returns the first argument, *irrespective* of the
outcome of the test. So in the above test, the returned value is going to
be that of `os`, which is presumably some non-false value. That means the
guarded test will *never* be run, on any OS.

[Separately, I'm not sure why one would use a testing utility in that
conditional, rather than just a standard conditional, but that's a
different matter.]

In general, this seems to be a property of your underlying function,
`test-more-check`: it returns either the return value sent in through
#:return or the value in the checked position (#:got). But in either case,
this is independent of the success of the test. The only difference is in
the *message*, which is printed as output. I suppose I could parameterize
where it's printed and capture it — but then I have to parse all the
information back out. I'm just not seeing how to compositionally use your
testing primitives?

As an aside, when trying to install the package in a Docker container
running Ubuntu 18.04 with Racket 7.7 installed, I got this error:

raco setup: docs failure: query-exec: unable to open the database file
  error code: 14
  SQL: "ATTACH $1 AS other"
  database: #
  mode: 'read-only
  file permissions: (write read)

which I didn't get on macOS Catalina. The package certainly has a … lot of
stuff! Even links to EDGAR filings. (-:

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2yS7%2B2OSq899U5%2BQrgZwFNwdowQNdByU4AkxxwK%3Dby5wOQ%40mail.gmail.com.


[racket-users] rackunit and logging

2020-05-22 Thread Shriram Krishnamurthi
I'm trying to understand the design of the logging portion of rackunit:

https://docs.racket-lang.org/rackunit/Testing_Utilities.html#%28part._.Logging_.Test_.Results%29

   1. The "log" seems to only be a *count*, not the actual rackunit output 
   (as the term "log" would suggest). Since I want to show a summary of tests 
   — including output — on a different medium, after the test suite has run, 
   it looks like I need to essentially create my own logging support? (Perhaps 
   the "check-info stack" is useful here, but I don't think so.)
   2. Why do the check-… procedures not return any value? It would seem 
   natural for them to return, say, false in case of passing and a failure 
   information structure in case of failing (or a structure in both cases). 
   But they seem to only return void, so I'm not entirely sure how else to 
   extract the information for the log without rewriting the check's.
   3. As an aside, I'm not entirely sure what `test-log!` is there for. 
   Presumably it's to record in the log "tests" run by operations that are not 
   part of rackunit? I'm curious how people have used it.

TL;DR: If I want to record what happened on all the checks for 
post-execution processing, do I need to (a) create my own log and, to do 
so, (b) rewrite all the checking predicates to provide the information that 
the detailed log needs?

Thanks,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e7cafb9d-793d-4f3b-9eb4-308e43df73f2%40googlegroups.com.


[racket-users] Re: What does PLT stand for?

2020-05-19 Thread Shriram Krishnamurthi
Originally it was the Programming Languages Theory group at Rice University.

Then, around the time of creation of Racket, the team branched out beyond 
Theory, so we decided the T might stand also for Technology, Tools, etc.

Eventually we decided it just stood for Programming Languages Team.

Then we branched out of Rice, and created local PLT groups. By then, PLT 
had ceased to mean anything specific at all: all those child PLTs were in 
homage to the original one of that name.

These days, "PLT" seems to be widely used on the interwebs to mean 
"programming language theory" in a generic sense (not tied to any 
particular group), which I still find jarring. But many of us still call 
our groups PLT (https://www2.ccs.neu.edu/racket/, 
https://plt.eecs.northwestern.edu/, https://www.cs.utah.edu/plt/, 
https://cs.brown.edu/research/plt/, etc.).

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/022f8113-2b65-4c0f-b1f1-a058415cda24%40googlegroups.com.


[racket-users] running Racket inside gradescope

2020-05-19 Thread Shriram Krishnamurthi
We expect to use Racket with Gradescope [https://www.gradescope.com/] in 
the fall. Gradescope will run an autograder for programming assignments, 
using this specification:

https://gradescope-autograders.readthedocs.io/en/latest/

(It's manifest as a Docker container.)

Has anyone already set up Gradescope for use in their classes? 

If so, can you share your work with us?

If not, are you a potential user?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/24255ddf-7b2e-4563-a45a-92ff5fa07e6c%40googlegroups.com.


[racket-users] embedding Google Forms/YouTube/… in Scribble

2020-03-22 Thread Shriram Krishnamurthi
It's sometimes useful to embed content like a Google Form (a survey, quiz, 
etc.) or a YouTube video in a Scribble document.

I spent some time searching but couldn't find anything that would do this 
for me.

I've therefore written a little library to help with this:

https://github.com/shriram/scribble-embedding

You can mostly figure it out from this small example file, which uses both 
the provided functions (google-form and youtube), but the documentation 
lists the other parameters (all are optional other than the URL):

https://github.com/shriram/scribble-embedding/blob/master/sample/sample.scrbl

Comments welcome.

Cheers,
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/b421cc8e-fe51-4687-aefd-13b67cad4f27%40googlegroups.com.


Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-08-21 Thread Shriram Krishnamurthi
I agree that struct-copy is almost essential. That's why it's baked into
the syntax of Pyret (where we're very sparing in what we provide syntactic
surface to). It might be better to just import struct-copy and leave the
language-level intact, in the future (if not create a language level that
reflects this).

On Wed, Aug 21, 2019 at 8:21 AM Chris Stephenson 
wrote:

> Hi Shriram
>
> Nice to hear from you!
>
> In a course for 14-18 year olds where we are rigorously enforcing the
> design recipe, the overwhelming majority of errors are, indeed, syntax
> errors. (Except for missiing-else conds, of course)
>
> So that was what I meant. Pyret syntax errors are reported confusingly.
> Infix just messes things up. And in my view prefix does not present a
> problem for students
>
> Conversion: Indeed we did find an old version of Reactive in Racket, by
> which time we had already translated the newer Pyret version into Turkish
> and also introduced some experience based changes of our own. So what we
> had in our hands had diverged in several ways from the old Racket version.
> So we were merging the changes we had made and also translating the Turkish
> langauge documentation from Pyret to Racket.
>
> I understand the critcisms for using lang racket rather than advanced
> student in the second week , after using beginner in the first.   Given
> that advanced student also accepts else-less conds (the worst source of
> hard-to-find errors) and we wanted to use the new Racket struct syntax (and
> struct-copy which can make HtDP universe code much shorter) we were pushed
> in that direction. I dont think we paid any other penalty for using lang
> racket. If we had had struct and struct-copy in advanced student, we would
> have used it. I am sure that is something we could have solved ourselves
> ... but time...
>
> Thanks for your views.
>
>
> Chris
>
>
>
>
> On Wednesday, August 21, 2019 at 2:38:55 PM UTC+3, sk wrote:
>>
>>
>>> Pyret was a pain. Error messages were not clear and the whole change
 confused students.

>>>
>>> Can you elaborate more on this? My personal experience with Pyret is
>>> that it has an exceptionally good error message, except when an internal
>>> error occurs (which should not happen).
>>>
>>
>> IMO, Pyret's *parse* errors are terrible. To some extent they are an
>> unavoidable consequence of infix, but it doesn't matter: parse errors just
>> suck, even for me, even today, even as one of the three longest-running
>> Pyret programmers.
>>
>> The run-time errors are (again IMO) much better than Racket's.
>>
>> Chris, FYI, Bootstrap:Reactive *was* in Racket to begin with, so there
>> may not have been a need to "convert" it…
>>
>> Shriram
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Racket Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/racket-users/ewWuCvbe93k/unsubscribe.
> To unsubscribe from this group and all its topics, 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/bae23873-6837-415c-97ff-d7c0879873ad%40googlegroups.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/CAJUf2yRmHLWccb_TWW0WTcgsEFEK%2BNwn7aK7i49yAD0QfB74ZQ%40mail.gmail.com.


Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-08-21 Thread Shriram Krishnamurthi
>
>
> Pyret was a pain. Error messages were not clear and the whole change
>> confused students.
>>
>
> Can you elaborate more on this? My personal experience with Pyret is that
> it has an exceptionally good error message, except when an internal
> error occurs (which should not happen).
>

IMO, Pyret's *parse* errors are terrible. To some extent they are an
unavoidable consequence of infix, but it doesn't matter: parse errors just
suck, even for me, even today, even as one of the three longest-running
Pyret programmers.

The run-time errors are (again IMO) much better than Racket's.

Chris, FYI, Bootstrap:Reactive *was* in Racket to begin with, so there may
not have been a need to "convert" it…

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


Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-07-24 Thread Shriram Krishnamurthi
To riff on Will's message:

In the Bootstrap:Algebra
 materials,
we use Racket syntax because it's a powerful pedagogic device. Recently,
for various reasons, we've ported this over to another language called
Pyret (while also maintaining the Racket version; it hasn't been
deprecated).

Pyret has an almost-traditional infix syntax. It turns out infix is
actually much worse for the concepts we try to teach in that curriculum. Of
course it can be done, but the irregularity of infix — which is barely
noticed or even appreciated in some contexts — is a real headache there. We
have to work against it, rather than it working for us.

So, especially in education:

(a) the subtleties of syntax are manifold and sometimes unexpected

(b) there's an enduring value to our (beloved) syntax, so it'll never go
away (-:

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


Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2

2019-07-15 Thread Shriram Krishnamurthi
Another Racketeer here who's been in the community since day 0.

We have various views and people in the community. But our commitment to 
making tools and learning available to all, open to all, and catering to 
all — what many of us label diversity — is, I hope, demonstrated by our 
actions.

Several of us work ceaselessly on Bootstrap, easily one of the most diverse 
computing offerings in the US. Our numbers are beyond what programs dream 
of. And yet we keep working on improving our diversity impact 
[https://www.bootstrapworld.org/impact/]. That means not only what most 
people consider — women and underrepresented minorities — but also other 
kinds of underrepresentation in computing: the visually-impaired, those 
with learning disabilities (new project just starting up), etc., etc. And 
Bootstrap is listed right on the box [https://racket-lang.org].

Other things we've done include pioneering free online texts. Matthias et 
al's HtDP was one of the first such books (especially prominent ones, from 
a prominent publisher). Why? Because reaching out across economic divides 
was infinitely more important that royalties. To this day, most prominent 
texts don't follow this policy. Yet HtDP proudly does, as do many other 
books we've written (like PLAI and PAPL).

Mailing lists are not great places for nuance and differences of 
interpretation of words. (Twitter is even worse!) But many long-standing 
Racket folks care very deeply about what I believe others here refer to as 
diversity — perhaps even forms of it *not* initially intended, but 
hopefully also welcome — and have put $ and time where it matters.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e14413c8-9b79-45f9-8fd7-194070354cc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-07-15 Thread Shriram Krishnamurthi
P4P is also very much "current", as far as I'm concerned. (In fact, I'm 
quite likely about to use it in a new setting.) Pyret is a parallel branch 
effort. 

Pyret is "let's just go all out and design a new syntax". Specifically, I 
was tired of dealing with people who wouldn't read *How to Design Programs* 
because 
of the syntax, and wanted to be able to communicate its ideas to them. We 
realized that a new syntax could go a long ways. It has. But I still dream 
in parentheses. (-:

P4P, in contrast, was my attempt at an answer to "how far can we go with 
Racket's existing mechanisms?"

Indeed, the original P4P is flawed in that it seems to take Racket as the 
base language. In retrospect, this isn't what I meant. I meant for P4P to 
be a *syntax* that *layers* atop *whatever* underlying (semantic) language 
you want, as a different *reader*. It wasn't really implemented that way, 
but should have been/should be. Then you could use any existing Racket 
language with P4P syntax as its surface.

Shriram

On Monday, July 15, 2019 at 2:34:31 PM UTC-4, Neil Van Dyke wrote:
>
> Wesley Kerfoot wrote on 7/15/19 2:28 PM: 
> > Has anyone considered http://shriram.github.io/p4p/ as an alternative? 
>
> This might represent Shriram's current thinking (and is what I was 
> alluding to before): https://www.pyret.org/ 
>
> I'll wait for the official community process to commence, before I get 
> deep in discussion. 
>
>

-- 
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/4af85482-fd61-4173-a878-e61b02ab8776%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-13 Thread Shriram Krishnamurthi
Yes, this clarifies everything, thanks!

Some more comments/thoughts.

I would suggest adding a @(table-of-contents) to the top of every page: it
helps the reader know what is coming ahead. For instance, it's good for me
to know up front that I don't have to understand sec 1 all by myself,
because you will explain it to me in sec 2. This is very helpful when you
have biggish sections: e.g.,

http://papl.cs.brown.edu/2017/set-representations.html

[Yes, this is what the gutter at hte left says. Me, somehow, I always
ignore that gutter, because on most Web sites it's irrelevant.]

(Not exclusively, the text could also just have a forward reference in the
prose of sec 1 itself.)

Your (lack of) op precedence I find a little confusing, a bit curiously
given that I'm designing a language with the same op precedence. In Pyret
we have no op precedence, but we allow a sequence of the same binop to not
need parens; everything else needs to be parenthesized. We've used this for
years now with students and it has been received well because it's simple
and consistent. For instance, if I write

fun D1(prey):
  (prey-growth-rate * prey) - predation-rate * predators * prey
end

fun D2(predators):
  (predator-growth-rate * predators * prey) - predator-loss-rate * predators
end

I get the error, in both D1 and D2,

  The * operation is at the same level as the - operation.

  Use parentheses to group the operations and to make the order of
operations clear.

so I'd instead have to write

fun D1(prey):
  (prey-growth-rate * prey) - (predation-rate * predators * prey)
end

fun D2(predators):
  (predator-growth-rate * predators * prey) - (predator-loss-rate *
predators)
end

My concern is that in your case, position really matters, with two
consequences:

1. The reader has to internalize the rule, which (if they're coming from
just having programmed in something else) they may not even realize — these
kinds of rules are a form of mode-switching, and we know from HCI that
humans are really bad at it.

2. Refactoring becomes annoying: if I add something to the left of an
existing expression, suddenly its parsing might have changed. So it's safer
to just parenthesize things.

The last line above drove the design of Pyret. It *is* safer to just
parenthesize, but long chains of the same operator do happen a fair bit,
and they're annoying to fully parenthesize. So we struck a compromise that
has worked very well.

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.


Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-12 Thread Shriram Krishnamurthi
The Lotka-Volterra example is very helpful, thanks. It is still a bit
unclear from the formatting which part is the Leibniz code. Is it the two
lines marked pp1 and pp2? Are they literal code? I guess I prefer to use a
typewriter face to make verbatim code clear, though that may be at odds
with the script-D.

Of more consequence, it would be helpful to know what “happens”. I can
*write* this in Leibniz; that's good. Can I do anything more/else? Maybe
now, or at least perhaps in the future? Can I do a numeric simulation? Will
there be a Runge-Kutta solver? What about discretization issues? Etc. Put
differently, why write it in Leibniz instead of writing it as just a
regular Racket `reactor` program?

Btw, I'm not entirely sure what the notation ℝp means.

-- 
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] RaspberryPi IoT programming with Racket BSL

2017-04-10 Thread Shriram Krishnamurthi
For those who may not know about this: Matthias Felleisen recently heard about 
a really cool piece of work by Daniel Brunner and Stephan Brunner on using 
Racket BSL to program Raspberry Pi systems.

Here is a brief blog post that has a link to the paper:

http://www.dbrunner.de/2017/04/05/10th-european-lisp-symposium/

Enjoy!

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.


Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-10 Thread Shriram Krishnamurthi
Let me ask a few questions that may nudge you a bit:

What is an example of a system you want to model?

For instance:

Do you want to be able to model simple linear motion? Uniform acceleration?

Do you want to be able to model predator-prey? Or epidemic growth?

Are these even in the realm of things you want to model and if not, why not?

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.


Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-09 Thread Shriram Krishnamurthi
Agreed w/ John. I tried reading the Scribble files in the examples directory 
but my eyes started to bug out a bit.

-- 
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] The 2nd Summit oN Advances in Programming Languages- SNAPL '17

2017-04-09 Thread Shriram Krishnamurthi
Come hear, discuss and debate exciting advances, insights and visionary ideas 
in the PL world. A full list of accepted papers can be found at 
http://snapl.org/2017/papers.html . The event is at Asilomar, near Monterey, 
CA, from May 7-10. Space is limited!

The Summit oN Advances in Programming Languages (SNAPL) is a biennial venue for 
discussions about programming languages. SNAPL focuses on experience-based 
insight, innovation, and visionary ideas spanning from foundations to 
applications of programming languages. We welcome perspectives from both 
industry and academia.

SNAPL complements existing conferences by emphasizing discussion. Each SNAPL 
talk will be followed by a two-minute round table discussion leading to a 
plenary Q session. A good SNAPL contribution is thus equal part an insightful 
paper and equal part an engaging talk.

SNAPL 2017 will be held in the Asilomar Conference Grounds on the Pacific Ocean 
just south of Monterey, CA.

Ras Bodík and Shriram Krishnamurthi (co-chairs)

-- 
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] Scribble: unnumbered and unindexed sections

2016-09-05 Thread Shriram Krishnamurthi
Just as a note of warning to other readers. I like being able to use #:tag
for sections to get human-readable file/directory names. Unfortunately,
using the tag prefixes also affects these names. For instance, if you use
#:tag "foo", you get a file named "foo.html". But if you use #:tag-prefixes
"foo" as well, then you end up with "foofoo.html", which can look very
strange.

There's probably another flag to fix this too, but I haven't found it yet.
(-:

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.


Re: [racket-users] Scribble: unnumbered and unindexed sections

2016-09-05 Thread Shriram Krishnamurthi
Thanks all for the help.

To summarize for the benefit of those who find this thread later:

A style of 'unnumbered does the trick. Thus

  @section[#:style 'unnumbered]{My Section}

will list it without giving it a number.

As for avoiding duplicate tags, this doesn't appear to be quite right:


> If you go the latter route, you'll also need to use `#:tag-prefix` in a
> cross-reference to a subsection (if you have any besides "Handin
> Instructions") in one of the N sections.
>

It appears that the actual keyword argument is #:tag-prefixes [note extra
"es"], and it takes a list of tags.

Thus, with only one prefix, a source document with

  @section[#:tag "uniq" #:tag-prefix "uniq"]{My Section}

can be referenced as

  (secref #:tag-prefixes (list "uniq") "uniq")

[But of course there's no reason for the tag and the tag-prefix to be the
same string.]

And of course you can combine these:

  @section[#:style 'unnumbered #:tag "uniq" #:tag-prefix "uniq"]{My Section}

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.


[racket-users] Scribble: unnumbered and unindexed sections

2016-09-04 Thread Shriram Krishnamurthi
Is there a way to have unnumbered and unindexed section? (Yes, these are 
different issues.)

It would be helpful to have unnumbered sections, à la \[sub]section* in LaTeX.

It would be especially helpful to have unindexed sections. The real nuisance 
I'm trying to avoid is, say I have N sections that each have a subsection named 
"Handin Instructions". Then I get a bunch of Scribble warnings due to the 
duplicate section name. Since I have no desire to link to these sections, I 
don't need them indexed at all. And this way I don't have to cons up new names 
for each of them (though I do of course have that option…).

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.


Re: [racket-users] Re: Whalesong instead of Clojurescript

2016-09-03 Thread Shriram Krishnamurthi
There has indeed not been a lot of activity, but that doesn't mean it isn't
functional. I've heard now and then of people using it. It's at least worth
a try — a few minutes will let you know if it's suitable for your needs.

-- 
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] selective --html-tree in Scribble

2016-09-02 Thread Shriram Krishnamurthi
On Friday, September 2, 2016 at 2:19:58 PM UTC-4, Matthew Flatt wrote:
> Use the 'toc style property for the "Assignments" section. It's not a
> great name, but 'toc means "render subsections on separate HTML pages".

This is terrific, thanks. Is there a "callee-determines" equivalent to this 
"caller-determines"? For instance, my Assignments section has some sections of 
general prose and instructions, and I'd very much like those to appear "inline" 
instead of being popped out as its own page. I don't mind having to annotate 
each section I _do_ want popped out with some 'toc-like tag.

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.


[racket-users] Re: Whalesong instead of Clojurescript

2016-09-02 Thread Shriram Krishnamurthi
On Thursday, August 25, 2016 at 9:53:40 AM UTC-4, tbrooke wrote:
> I briefly looked at Whalesong and I was wondering if anyone is using it and 
> if it is mature and ready to use. I use Clojurescript and it seems to me that 
> Whalesong should be equivalent with the advantage of allowing me to work in 
> Racket.

Whalesong has some performance problems, because it tries its best to 
faithfully reproduce the stack behavior we know and love. That is, 
continuations, composable continuations, etc. But even more so, enabling you to 
pause and stop computation, which are things alien to JavaScript. So a lot of 
effort goes to stack management. This is something most transpilers to 
JavaScript ignore, resulting in much better performance.

In addition, Whalesong optimized for the student-facing aspects of Racket, 
rather than the entire language (which is quite large). Therefore, you may run 
into unpleasant surprises when you encounter a feature that is useful to you 
but not supported.

The best I can say is, give it a try, but don't expect too much. Depending on 
your needs, you may be pleasantly satisfied, or deeply unhappy. (-:

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.


[racket-users] selective --html-tree in Scribble

2016-09-02 Thread Shriram Krishnamurthi
I want to unfold an HTML tree selectively. Suppose I have a site.scrbl that 
contains a Web site's information. I want all the top-level sections to be 
split into individual pages (corresponding to --htmls). But in one particular 
section (call it "Assignments"), I want each sub-section to have its own 
directory (so, just there, I want --html-tree 2). Is there a way to do this? Or 
do I have to spin off the Assignments sub-section into its own separate 
document, cross-link, etc.?

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

2015-05-21 Thread Shriram Krishnamurthi
Thanks for these replies. Sorry I'm only now getting to them: Google failed to 
notify me of them.

The problem with using (nested ...) is that it indents its content even when I 
don't use the 'inset style. Therefore, if I have (as I do)

@exercise{@question{...}}

everything in the exercise ends up nested one level, and the question ends up 
nested two levels. That's why I rejected the use of `nested` and was looking 
for alternate solutions.

How can I get `nested` to not indent? I have exactly what you suggested:

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

where

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

and this still leads to the indentation.

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

2015-05-21 Thread Shriram Krishnamurthi
Of course it is. I can certainly hack my way around it using CSS. But
I'm wondering why the behavior doesn't match my reading of the docs:
did I misread, is the code broken, or are the docs broken? That's
really all I'm trying to figure out. (And if the code or docs are
wrong, then presumably someone who maintains them would like a bug
report.)

Shriram

On Thu, May 21, 2015 at 4:21 PM, Matthias Felleisen
matth...@ccs.neu.edu wrote:

 Isn't it the whole point of styles to allow this kind of fixes? I am playing 
 with similar fixes for TeX output. Scribble is an UNCOL and all UNCOLs fail a 
 little bit at least -- Matthias




 On May 21, 2015, at 2:19 PM, Shriram Krishnamurthi shri...@gmail.com wrote:

 Understood. But my understanding of the docs is that it shouldn't do
 that in the first place.

 On Thu, May 21, 2015 at 2:15 PM, Ben Lerner bler...@ccs.neu.edu wrote:
 Probably a CSS fix: assuming you have something like this in your CSS
 preamble

 div.question { padding-left: 2em; }

 to cause the indentation, then something like this will disable the nested
 one:

 div.exercise  div.question { padding-left: 0em; }

 ~ben

 On 5/21/2015 2:12 PM, Shriram Krishnamurthi wrote:

 Thanks for these replies. Sorry I'm only now getting to them: Google failed
 to notify me of them.

 The problem with using (nested ...) is that it indents its content even when
 I don't use the 'inset style. Therefore, if I have (as I do)

 @exercise{@question{...}}

 everything in the exercise ends up nested one level, and the question ends
 up nested two levels. That's why I rejected the use of `nested` and was
 looking for alternate solutions.

 How can I get `nested` to not indent? I have exactly what you suggested:

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

 where

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

 and this still leads to the indentation.


 --
 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 a topic in the Google 
 Groups Racket Users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/racket-users/ZJqovwguPGQ/unsubscribe.
 To unsubscribe from this group and all its topics, 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] Scribble abstraction to attach styles

2015-05-21 Thread Shriram Krishnamurthi
Understood. But my understanding of the docs is that it shouldn't do
that in the first place.

On Thu, May 21, 2015 at 2:15 PM, Ben Lerner bler...@ccs.neu.edu wrote:
 Probably a CSS fix: assuming you have something like this in your CSS
 preamble

 div.question { padding-left: 2em; }

 to cause the indentation, then something like this will disable the nested
 one:

 div.exercise  div.question { padding-left: 0em; }

 ~ben

 On 5/21/2015 2:12 PM, Shriram Krishnamurthi wrote:

 Thanks for these replies. Sorry I'm only now getting to them: Google failed
 to notify me of them.

 The problem with using (nested ...) is that it indents its content even when
 I don't use the 'inset style. Therefore, if I have (as I do)

 @exercise{@question{...}}

 everything in the exercise ends up nested one level, and the question ends
 up nested two levels. That's why I rejected the use of `nested` and was
 looking for alternate solutions.

 How can I get `nested` to not indent? I have exactly what you suggested:

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

 where

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

 and this still leads to the indentation.


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