Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Static Type Signature Syntax for a Lisp

Name: Anonymous 2013-12-14 17:42

How would you implement it without breaking homoiconicity?

Name: Anonymous 2013-12-14 20:07

>>2
typed racket
(struct: pt ([x : Real] [y : Real]))
 
(: distance (pt pt -> Real))
(define (distance p1 p2)
  (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))
           (sqr (- (pt-y p2) (pt-y p1))))))


Not too bad, though the infix : operator seems a little un-lispy.

>>3

(declaim (ftype (function ((unsigned-byte 64)) (values (unsigned-byte 64) &optional))
                shuffle))

Jesus christ that's hideous.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List