Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Don't know much about Racket, but CL has type dispatch:

  (defmethod join ((a String) (b String))
    (concatenate 'String a b))
  ;; example: (join "abc" "def") => "abcdef"

  (defmethod join ((a Integer) (b Integer))
    (parse-integer (format nil "~D~D" a b)))
  ;; example: (join 123 456) => 123456
And rudimentary support for ADTs:

  (deftype Low-Score ()
    '(Integer 0 20))

  (deftype Normal-Score ()
    '(Integer 21 79))

  (deftype High-Score ()
    '(Integer 80 100))

  (deftype Score ()
    '(or Low-Score Normal-Score High-Score))
(But note that deftypes aren't allowed to recurse.)

CL also has first-class support for debugging with things like describe, step, and trace built-in.

EDIT: Yeah, the CL spec dates from 1994 and a bunch of things which we would expect nowadays (networking, POSIX,...) are provided by external libraries rather than being part of the spec, but in various ways CL is way ahead of its time.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: