volkert
2017-1-14 16:05:53

@volkert has joined the channel


eeide
2017-1-14 19:04:19

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


pnwamk
2017-1-14 19:07:45
(for/and ([x (in-syntax l)]) (identifier? x))

pnwamk
2017-1-14 19:07:54

is equivalent and I believe avoids making an intermediate list


eeide
2017-1-14 19:09:30

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 …))))


eeide
2017-1-14 19:09:56

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


samth
2017-1-14 19:32:31

@eeide that’s what i would do


eeide
2017-1-14 19:39:18

@samth Thanks!


notjack
2017-1-14 22:22:55

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


notjack
2017-1-14 22:23:17

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


fahree
2017-1-14 22:46:46

nice!


fahree
2017-1-14 22:47:09

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


fahree
2017-1-14 22:47:40

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


notjack
2017-1-15 00:00:06

@fahree Likely the racket package catalog


mebassett
2017-1-15 00:15:37

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.


pnwamk
2017-1-15 01:14:25

@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?


pnwamk
2017-1-15 01:16:03

i.e. something like this might work:


pnwamk
2017-1-15 01:16:08
#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))

pnwamk
2017-1-15 01:18:33

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


pnwamk
2017-1-15 01:18:39
#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))

pnwamk
2017-1-15 01:19:30

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


pnwamk
2017-1-15 01:21:20

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


pnwamk
2017-1-15 01:21:23

but does (will) in 6.8


pnwamk
2017-1-15 01:21:32

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


pnwamk
2017-1-15 01:21:40

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


pnwamk
2017-1-15 01:21:52

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


mebassett
2017-1-15 01:32:11

@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!


jbclements
2017-1-15 01:57:14

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?


notjack
2017-1-15 02:04:13

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


notjack
2017-1-15 02:04:30

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


jbclements
2017-1-15 02:12:20

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


lexi.lambda
2017-1-15 02:23:03

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


jbclements
2017-1-15 02:46:19

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


fahree
2017-1-15 05:46:56

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?