
@volkert has joined the channel

Quick R6RS versus Racket question: I just came across the following R6RS code, where l
is expected to be bound to a syntax object: (define identifier-list?
(lambda (l)
(for-all identifier? l)))
I guess that R6RS allows for-all
to iterate over syntax objects—is that right? My translation of he above code to Racket is: (define identifier-list?
(lambda (l)
(andmap identifier? (syntax->list l))))

(for/and ([x (in-syntax l)]) (identifier? x))

is equivalent and I believe avoids making an intermediate list

Similarly, I have the following R6RS code snippet (the top of a loop): (let loop ((input #’(initial final … source … target …)))
While the following works as a translation, is there something more elegant than constructing a new syntax object and then making a list from that? Basically, I don’t know how to deal with the ellipses. (let loop ((input (syntax->list #’(initial final … source … target …))))

@pnwamk Thank you! I will give your suggestion a whirl.

@eeide that’s what i would do

@samth Thanks!

@fahree foo/bar is also “pronounced” as “foo with bar”

So reduce/strcat would read as “reduce with strcat”

nice!

OK, so I’m accumulating a series of small utilities in writing this acmart support.

At some point, I’ll have to ask what is the right policy for publishing these utilities

@fahree Likely the racket package catalog

in typed/racket, what is the idiomatic way to filter out nulls from a list? filter does not have a case for a predicate that contains negative information.

@mebassett this doesn’t seem ideal (it would be nice to just use something like filter-not
, or filter
with a negative type (which doesn’t exist in Typed Racket currently))… is there a predicate for the type w/o the Null
you could use filter
with?

i.e. something like this might work:

#lang typed/racket
(define-type Foo (U Null (Pair Any Any) String Number))
(define-type Non-Null-Foo (U (Pair Any Any) String Number))
(define-predicate non-null-foo? (U (Pair Any Any) String Number))
(define l : (Listof Foo) '())
(define l-w/o-nulls : (Listof Non-Null-Foo)
(filter non-null-foo? l))

Ah! this isn’t as bad and might do what you want:

#lang typed/racket
(define-type Foo (U Null (Pair Any Any) String Number))
(define-type Non-Null-Foo (U (Pair Any Any) String Number))
(: non-null-foo? (-> Foo Boolean : Non-Null-Foo))
(define (non-null-foo? x)
(not (null? x)))
(define l : (Listof Foo) '())
(define l-w/o-nulls : (Listof Non-Null-Foo)
(filter non-null-foo? l))

note that I’m not defining a predicate with the usually vanilla (-> Any Boolean : T)
type, but it takes in Foo
and is a predicate for those Foo
which are not Null

Ah — also note that this example does not work in 6.7

but does (will) in 6.8

the logic in Typed Racket has gotten a little better since 6.7

but still has some improvements I’m meaning to get to

anyway, hope that was helpful — good luck and good night!

@pnwamk - thanks for the very detailed response. I indeed defined a predicate for the type I wanted. I’ve got a few weird examples of type inference and I’m eagerly awaiting 6.8. goodnight!

leaky brain—what’s the name of the mechanism we use to override macro bindings to give them local meanings, as e.g. for ‘else’ in ‘cond’, which (IIRC) is bound at the top level to an expansion error but which inside of a cond has a different meaning? Does this make sense?

I’m not sure about the general concept, but I always associate that with syntax parameters since that’s how I implement it

Maybe that’s the term you’re looking for?

@notjack Yes! That’s exactly what I was trying to recall. Many thanks.

Though, to be pedantic, else
’s special meaning in cond
doesn’t use syntax parameters; it just recognizes else
as a syntax-case
literal.

Yes, I’d rather suspected that I might be wrong about that. smiley.

OK, so I’m a bit stumped. What part of the code does the translation of ç to \c{c} and how do I control whether it’s called or not?

looks like that translation happens here: https://github.com/racket/scribble/blob/574219e1ee1d8d2b0d7379c7dc5e0e06fb451516/scribble-lib/scribble/latex-render.rkt#L1231