
What does “ellipsis saturation” mean?

@notjack You might find do/sequence
useful.

Oops, I don’t think thats a word. I’m trying to refer to this: if (main ...) = (A B C)
, then right now ((main ...) ...) = ((A B C) (A B C))
instead of ((A A A) (B B B) (C C C))
. The pattern variables match the ellipses from the inside instead of from the outside.

I’m missing a tiny bit of info that’s making something a little confusing for me. I have a struct like so:
(struct foo
#:property prop:sequence
(lambda (f) (foo->stream f))
#:methods gen:stream
[...])
The foo->stream
function works fine, and I can use for
loops with my foo structs just fine. However, I’m a little confused by the following:
(define xs (foo ...))
(define ys (sequence-map ... xs))
;; note: this is fine, ys is a sequence
(stream? ys) ;=> #f
If prop:sequence
returns a stream object (and streams are sequences), and sequence-map
— I assume — calls stream-map
under the hood for stream sequences, then why isn’t ys
also stream?

More importantly, what I want to make sure of is that ys
isn’t being eagerly built as a large collection (I want it to be a stream)

Haven’t fully read the whole thing, but I don’t think you need prop:sequence
. A stream is already a sequence. E.g.,
(define-struct list-stream (v)
#:methods gen:stream
[(define (stream-empty? stream)
(empty? (list-stream-v stream)))
(define (stream-first stream)
(first (list-stream-v stream)))
(define (stream-rest stream)
(list-stream (rest (list-stream-v stream))))])
(sequence? (list-stream 1)) ;=> #t

w/o the prop:sequence
the for
loops won’t implicitly work

Ohhh, that’s new to me

Interesting.

I mean, maybe that’s a bug, but that’s how it is

This seems to work fine for me

(define-struct list-stream (v)
#:methods gen:stream
[(define (stream-empty? stream)
(empty? (list-stream-v stream)))
(define (stream-first stream)
(first (list-stream-v stream)))
(define (stream-rest stream)
(list-stream (rest (list-stream-v stream))))])
(for ([x (list-stream '(1 2 3))])
(println x))

That works for me as well, but my code — which implements streams just fine for stream-map, etc. — does not

oh wait

ugh… nvm, im stupid :wink:

my original question still hold

I basically have foo
and foo-stream
, because the data required is different (as opposed to list, which is - itself - a simple stream)

so foo->stream
returns a different type

For sequence-map
, the result is not a stream, but it’s still can be lazily built

I use prop:sequence
to return the foo-stream
type

> For sequence-map
, the result is not a stream, but it’s still can be lazily built Okay, that’s pretty much what I needed to be sure of. Thanks

As a concrete example: (stream? (in-cycle '(1 2 3)))
returns #f
, but (in-cycle '(1 2 3))
is an infinite sequence. It can’t be built eagerly! Same for (sequence-map add1 (in-cycle '(1 2 3)))
.

Yeah, I was doing things like (define xs (range 10000000))
(define ys (sequence-map add1 xs))

And making sure memory wasn’t going up

Oh

range
is different, because it produces a list, which is eager

You want in-range

good pro tip. thanks :wink:

@ryanc can’t use it outside a for
loop :(

What sorawee said: both sequences and streams can be lazy. The difference is that streams are expected to expose an iteration API that doesn’t use mutable state.

is this for that ordered hash data structure you’re working on?

Meanwhile, over in Java, streams are the ones that are expected to expose a mutable API. :disappointed:

It’s not an ordered hash. Hash just happened to be a good example of a multiple value sequence.

The spams (I count 6) on the mailing list over the past month mostly associate with the handler “boutinputs” from protonmail. Can we block him/her?
Also, would it be possible to setup a filter? I can’t see any legitimate context for a Swastika symbol to appear in the mailing list.

It also actually looks like a smear campaign.

Are you referring to the italian posts complaining about pedophiles and such?

I blocked several people who spammed recently

I’ll check who sent the most recent one

But it’s not possible to create a filter

@jmhimara yeah

I joined the list recently and was taken aback

I just noticed that symbols aren’t a built-in syntax class in syntax/parse. Looks like you can define new syntax classes with define-syntax-class
, but as far as I can tell that ultimately relies upon the built-in classes. So if one wanted symbols to be a new syntax class, one would need to add a new built-in class to syntax/parse. Is that right?

Symbol is just (quote a)
where a
is an id
, right?

hmm, let me check if that works

#lang racket
(require syntax/parse/define)
(define-syntax-parse-rule (foo ({~literal quote} a:id))
(define a 1))
(foo 'abcdef)
abcdef ;=> 1

thanks! it’s a bit bulky, so I’ll try to make this more compact with define-syntax-class
, but that’s what I was looking for