Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Created March 2, 2025 14:06
Show Gist options
  • Save sogaiu/76a8e588cc36e832141c60d7725090c5 to your computer and use it in GitHub Desktop.
Save sogaiu/76a8e588cc36e832141c60d7725090c5 to your computer and use it in GitHub Desktop.
#lang typed/racket
(struct pt ([x : Real] [y : Real]))
 
;; the form on the next line is a type annotation
(: distance (-> pt pt Real))
(define (distance p1 p2)
  (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))
           (sqr (- (pt-y p2) (pt-y p1))))))
(doc my-fn
  ``
  Fabulous docstring that contains numerous examples.
  
  Could even live elsewhere in the file.
  ``)
(defn my-fn
  [x y]
  (+ x y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment