Questions tagged [typed-racket]

Typed Racket is a statically typed dialect of the Racket Scheme-derived language, that eases the migration from untyped to typed code.

Typed Racket is a statically typed dialect of that eases the migration from untyped to typed code.

Typed Racket is a family of languages, each of which enforce that programs written in the language obey a type system that ensures the absence of many common errors. The Typed Racket Guide is intended for programmers familiar with Racket. For an introduction to Racket, see The Racket Guide.

130 questions
0
votes
2 answers

Subtyping relationship between struct types in typed/racket

If in typed/racket I define three structs: (struct: foo ([a : Number])) (struct: bar ([b : String])) (struct: st ([a : Number] [b : String] [c : Number])) How can I make st be both a subtype of foo and of bar, so that both of the following…
Suzanne Soy
  • 2,522
  • 5
  • 32
  • 48
0
votes
1 answer

Why do polymorphic functions that return polymorphic functions use a gensym in their type?

Suppose I have a function first-value that takes a value and returns a function that ignores its input and returns the original value: (: first-value (All (A) (-> A (All (B) (-> B A))))) (define ((first-value a) b) a) If I inspect the type of…
Jack
  • 2,083
  • 11
  • 23
0
votes
0 answers

Typed Racket, type matching not working for me

I need this input (board-ref (Game-board new-game) (Pos 3 4)) to come out true. I've run through the function step by step and it seems like it should come out true, but for some reason, it keeps coming up false? Can anyone help me fix this?…
metalhead696
  • 157
  • 2
  • 6
0
votes
0 answers

How to avoid type annotations with literal numbers and types based on them?

In Typed Racket, if I have the following type and function: (define-type A (U 'one 'two)) (define (f [a : A]) : A a) Then the function call (f 'one) typechecks. However, if I use literal numbers as components of a union type like…
Jack
  • 2,083
  • 11
  • 23
0
votes
1 answer

Typed Racket: Natural Numbers

I have to solve a problem with a unique definition of the natural numbers: (define-type Nat (U 'Zero Succ)) (define-struct Succ ([prev : Nat]) #:transparent) So basically, 0 = 'Zero, 1 = (Succ 'Zero), 2 = (Succ (Succ 'Zero)).... etc. Using this…
metalhead696
  • 157
  • 2
  • 6
0
votes
1 answer

Why doesn't string-normalize-whitespace type check with keyword arg?

In typed racket, I have `(: collapse ((Listof Expansion) -> Expansion)) ; flatten a list of expansions into a single expansion representing the whole thing-- (define (collapse expansions) (letrec: ([token : String (foldl (λ: ([e :…
Ben
  • 4,521
  • 2
  • 37
  • 73
0
votes
1 answer

Unable to use sync with typed racket

Hi I'm learning how to use logging facilities provided by racket. I wrote the following piece of code to get the hang of how things are working. #lang racket (define list-logger (make-logger 'list-logger)) ;;(: log-debug (String Symbol ->…
nihal
  • 57
  • 4
-1
votes
1 answer

override in typed racket

If I want to override a class from typed racket to untyped racket, is it possible? if it is possible,I will be very much thankful if can anyone tell me how to override this below mentioned typed racket class to untyped racket class? I want to…
-1
votes
1 answer

some project about typed racket

I am doing some study in typed racket.To understand typed racket well, I need some typed racket projects . Can anyone please give me some links where I can find some typed racket source code.Thanks
-2
votes
2 answers

create sqrt function in racket

I tried to create a sqrt+ function, which will get a list of numbers and return a list of numbers. Can anyone tell me what's wrong with the function? #lang pl 03 (: sqrt+ : (Listof Number) -> (Listof Number)) ;; a version of `sqrt' that takes a…
1 2 3
8
9