News for hackers. Stuff that matters.
Re:Lisp for C++ programmers by spdegabrielle on Monday October 28, 2013 @10:04AM (#6626958)
Racket [http://www.racket-lang.org] is a modern Lisp with STATIC TYPING.

Quote from the static typing example on home page:

Racket's type system is designed to let you add types after you've worked for a while in untyped mode — even if your untyped program wouldn't fit nicely in a conventional type system.

#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)))

To run the example, install Racket, start DrRacket, paste the example program into the top area in DrRacket, and click the Run button. Alternatively, save the program to a file and run racket on the file.

Re:Lisp for C++ programmers by brudgers on Monday October 28, 2013 @10:51AM (#6627255)
Hell, you don't even need to use typed/racket to implement static types. You can just use contracts with plain old Racket to achieve true lispyness...because contracts let you impose static type-checking selectively within your code and for staticly-typed code to symbiose with dynamically-typed code.

Racket Guide on contracts: http://docs.racket-lang.org/guide/contracts.html

Racket Reference on contracts: http://docs.racket-lang.org/reference/contracts.html

There's even this groovy academic paper: http://www.eecs.northwestern.edu/~robby/pubs/papers/oopsla20...

It almost goes without saying that contracts are the mechanism by which typed/racket is statically typed.

Re:Lisp for C++ programmers by xenophonf on Monday October 28, 2013 @02:55PM (#6629011)
Common Lisp is a modern Lisp with static typing, too. For example, here's compile-time type checking performed by the SBCL compiler:

  * (defun test (x)
      (declare (fixnum x))
      (the string x))
  ; in: DEFUN TEST
  ;     (THE STRING X)
  ;
  ; caught WARNING:
  ;   Derived type of X is
  ;     (VALUES FIXNUM &OPTIONAL),
  ;   conflicting with its asserted type
  ;     STRING.
  ;   See also:
  ;     The SBCL Manual, Node "Handling of Types"
  ;
  ; compilation unit finished
  ;   caught 1 WARNING condition
  STYLE-WARNING: redefining COMMON-LISP-USER::TEST in DEFUN
  
  TEST
  * (test 1)
  
  debugger invoked on a SIMPLE-TYPE-ERROR:
    Value of X in (THE STRING X) is 1, not a STRING.
  
  Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
  
  restarts (invokable by number or by possibly-abbreviated name):
    0: [ABORT] Exit debugger, returning to top level.
  
  (SB-C::%COMPILE-TIME-TYPE-ERROR (1) STRING #<unavailable argument> ((THE STRING X) X))
  0] 0
Re:Lisp for C++ programmers by hajile on Monday October 28, 2013 @02:25PM (#6628749)
Shen is a lisp dialect with a turing complete type system and lazy typing (both of which are optional for maximum programmer flexibility).

http://shenlanguage.org/index.html