
Would this be the correct contract for a list that has at least 1 element in it? (list/c any/c any/c ...)


(and/c list? (not/c empty?)) should work too

ty

+1 for @laurent.orseau’s suggestion.
(list/c X Y Z)
describes lists of some specific length. Instead, another approach is (cons/c any/c list?)
which gives a list with at least one element.

for my particular case, i wanted to ensure that the types of the list elements were matched (they aren’t any, just used that for an example). but seeing all the other options is good :slightly_smiling_face:

You can also use list-of (or listof ? I never remember)

Right now there’s a problem with Rhombus installation, if I’m not mistaken. You need a Racket version after (inclusive) commit 5e75f7c but before (exclusive) cb23f25. Here’s a Racket installer that satisfies the constraint: https://plt.cs.northwestern.edu/snapshots/20210802-06d892f477/index.html

I got 8.2.0.5 from Utah and it’s working for me

Downloaded last night fwiw

OIC

Is it possible to typeset an identifier so that a part of it is italicized, but the rest is not?

there’s a (non-empty-listof any/c)
as it turns out :slightly_smiling_face: