Function prototype: Difference between revisions

m
→‎{{header|Racket}}: Revert change to lang tag (racket is far enough from lisp)
m (Removed BY VALUE clause from two-args prototype.)
m (→‎{{header|Racket}}: Revert change to lang tag (racket is far enough from lisp))
Line 395:
=={{header|Racket}}==
Most of the points are covered in this program
<lang lisp>#lang racket>
#lang racket
 
(define (no-arg) (void))
Line 409 ⟶ 410:
<tt>(void)</tt> is a function that returns "nothing", so this are prototypes that do nothing.
Although standard Racket doesn't allow type declarations, it allows contracts, so we can add this to the previous declarations
<lang racket>
<lang lisp>(provide (contract-out
[two-args (integer? integer? . -> . any)]))</lang>
then any module that imports the function can only pass integers to two-args.
 
Another way is using the <tt>typed/racket</tt> language, like this
<lang lisp>#lang typed/racket>
#lang typed/racket
 
(: two-args (Integer Integer -> Any))