laurent.orseau
2021-9-27 07:00:44

Weird, that’s doesn’t happen to me. What install type did you choose? I always install as a Unix distribution, even for snapshots where it’s not the default.


laurent.orseau
2021-9-27 07:01:46

Our maybe that’s a recent issue? (The original post was from May)


spdegabrielle
2021-9-27 07:23:28

Scheme 2021 - Graphite: A Library for Data Visualization (Lightning Talk) https://www.youtube.com/watch?v=qSM-rbOkmn0\|https://www.youtube.com/watch?v=qSM-rbOkmn0


mildc055ee
2021-9-27 10:47:33

@soegaard2 Ah, I got it. That is what I wanted! Thank you! @sorawee It looks very customizable. I’ll try it :slightly_smiling_face:


capfredf
2021-9-27 12:02:28

I didn’t make myself clear. This issue has nothing to do with using installers from the download page. It only happens if users install racket through the suse’s official package manager (zypper or yast)


sorawee
2021-9-27 12:26:27

The package website seems weirdly broken. https://pkgs.racket-lang.org/package/pprint-compact and https://pkgs.racket-lang.org/package/fmt are both built — you can see the documentation at https://docs.racket-lang.org/pprint-compact/ and https://docs.racket-lang.org/fmt/. Yet, they are reported as no doc and no recent builds.


cperivol
2021-9-27 13:32:22

Is there a polymorphism mechanism (ideally typeclasses) for typed racket? What is the right way of dealing with overloading?


cperivol
2021-9-27 13:35:19

Also, is typed/racket generally faster than racket or does it do typechecks at runtime?



sorawee
2021-9-27 13:56:52

Typechecking is done at compile-time. So the compile-time will be slower compared to vanilla Racket, but run-time could be faster, due to Typed Racket optimization.


cperivol
2021-9-27 13:56:58

Hmm, what I had in mind was for racket to select an the implementation of a function:

;; A type that implements the class Show can be converted to string. (typeclass (Show type) (: show (-> type String))) ;; Showing a number is done using number->string (instance (Show Number) (define-method (show num) (number->string num))) ;; Showing a string is just returning the string (instance (Show String) (define-method (show str) str))


cperivol
2021-9-27 13:57:13

excellent, thank you


sorawee
2021-9-27 13:58:22

There’s one caveat: if you have an interaction between typed and untyped modules, Typed Racket needs to insert contracts at the boundary, and this could be expensive. But if the entire thing is in Typed Racket, the performance should be better than vanilla Racket.


cperivol
2021-9-27 13:58:24

I found something similar called case-lambda but it only selects between arities


cperivol
2021-9-27 13:59:58

That’s fair


markus.pfeiffer
2021-9-27 14:01:47

I’d caution against trying to write Haskell code in Racket; if you want Haskell use Haskell :wink:


markus.pfeiffer
2021-9-27 14:01:58

there was a discussion of generics for typed racket recently


markus.pfeiffer
2021-9-27 14:02:06

and they are not supported (yet)



cperivol
2021-9-27 14:02:38

ok then


cperivol
2021-9-27 16:24:23

is there an any function that finds at least one element of a list satisfying a predicate function like (any odd? '(1 2 3)) => #t ?


cperivol
2021-9-27 16:25:33

like vector-any but for lists


cperivol
2021-9-27 16:27:57

got it, I was missing (require srfi/1)


massung
2021-9-27 16:28:43

I use for/or and for/and for generic sequences:

(define (all? xs) (for/and ([x xs]) x)) (define (any? xs) (for/or ([x xs]) x))


massung
2021-9-27 16:29:05

obviously replace x with (predicate x) if needed


soegaard2
2021-9-27 16:29:08

ormap ?


cperivol
2021-9-27 16:29:29

typed racket is missing srfi1?


tbnelson
2021-9-27 16:30:24

@tbnelson has joined the channel


soegaard2
2021-9-27 16:30:43

No, findf is the one you ned.


spdegabrielle
2021-9-27 16:30:46

nope ; use (require srfi/1)


spdegabrielle
2021-9-27 16:31:05

cperivol
2021-9-27 16:32:25

hmm, that sucks.. I have been thrice today against calling untyped code from typed racket


spdegabrielle
2021-9-27 16:34:24

nb racket has a distinct facilities for sets https://docs.racket-lang.org/reference/sets.html


spdegabrielle
2021-9-27 16:34:48

(I just noticed sets are part of srfi 1)


ben
2021-9-27 18:30:03

TR doesn’t have types for in-cycle and for the stream library.

I think in-cycle would be easy to add to the base environment (typed-racket-lib/typed-racket/base-env/base-env.rkt). Streams are harder to support, but the typed-racket-stream package is a nice work-around.

Here are two things that work for now: ;; in-slice (require/typed racket/sequence (in-slice (All (A) (-> Natural (Sequenceof A) (Sequenceof (Listof A)))))) (~> (in-cycle '(A B)) (in-slice 9 _) (sequence-ref _ 0)) ;; stream (require typed/racket/stream) (require/typed racket/base (sequence->stream (All (A) (-> (Sequenceof A) (Sequenceof A))))) (~> '(A B) in-cycle sequence->stream (stream-take 9) stream->list)


samth
2021-9-27 19:11:37

@cperivol see andmap and ormap


samth
2021-9-27 19:11:56

which are the built-in versions, rather than the ones from srfi/1


cperivol
2021-9-27 19:12:49

how can I pattern match on Option? (match (ann 1 (Option Integer) [#f 0] [n n]) complauins about the type of n.


cperivol
2021-9-27 19:13:48

And unions in general


shu--hung
2021-9-27 19:14:47

cond will work, but the current implementation of match is too expressive that n is not guaranteed to be non-#f


shu--hung
2021-9-27 19:16:21

For example, the following match program will fallback to the n clause: (match (ann #f (Option Integer) [#f (=> fail) (fail)] [n n])


cperivol
2021-9-27 22:51:19

that worked nicely


cperivol
2021-9-27 22:51:35

Quite interesting how it makes those inferences, is there a paper on that?



sorawee
2021-9-27 22:59:17

sorawee
2021-9-28 05:10:33

notjack
2021-9-28 06:24:24

this is fantastic!