Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Typed Racket example to RacketScript playground? #283

Open
spdegabrielle opened this issue Dec 16, 2021 · 9 comments
Open

Add Typed Racket example to RacketScript playground? #283

spdegabrielle opened this issue Dec 16, 2021 · 9 comments

Comments

@spdegabrielle
Copy link
Contributor

Been thinking about TypeScript.

Is the Typed Racket example possible?

#lang typed/racket

;; Using higher-order occurrence typing
(define-type SrN (U String Number))
(: tog ((Listof SrN) -> String))
(define (tog l)
  (apply string-append
         (filter string? l)))
(tog (list 5 "hello "
           1/2 "world" (sqrt -1)))

Cc: @samth

@stchang
Copy link
Member

stchang commented Dec 16, 2021

Pure TR would probably be fine since most of the work is done during expansion, but mixed typed-untyped might run into problems with contracts (like with #268)

@stchang
Copy link
Member

stchang commented Dec 16, 2021

I just tried the above example and it worked fine once I fixed a small issue with protect-out (#284). I'd want a few more tests before adding it to the playground. Do you want to come up with a few more? :)

@spdegabrielle
Copy link
Contributor Author

Scribble?

#lang scribble/base

@; Generate a PDF or HTML document
@(require (only-in racket ~a))
@(define N 99)
@title{Bottles: @italic{Abridged}}
@(apply
  itemlist
  (for/list ([n (in-range N 0 -1)])
    @item{@(~a n) bottles.}))

@spdegabrielle
Copy link
Contributor Author

Do you want to come up with a few more? :)

Once the playground can do all the examples on the Racket homepage, why not put the working examples on the racket homepage?

@stchang
Copy link
Member

stchang commented Dec 17, 2021

I dont want to add any examples that don't actually represent the programs one could write

@spdegabrielle
Copy link
Contributor Author

spdegabrielle commented Dec 17, 2021

What examples could/would you put there?

@vishesh
Copy link
Member

vishesh commented Dec 17, 2021

Scribble would be interesting. Although, unlike Typed Racket or Datalog it would require some changes to Playground apart from any unsupported Racket we may find (e.g. there is scribble command), to use HTML renderer and put that in output.

@vishesh
Copy link
Member

vishesh commented Dec 17, 2021

What examples could/would you put there?

I think it would be worthwhile to prepare a feature matrix to compare Racket and RacketScript (in terms of primitive functions, data structures and semantics). I think once we can compile linklets, things would be easier.

@spdegabrielle
Copy link
Contributor Author

I'd love to put the Rhombus prototype that Sam P did but i think it is too soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants