I'm new in Racket programming. How can I use built in math functions? Example factorial? In first line I inserted #lang racket/base but it not imported math functions. When I use factorial function I have error:
factorial: unbound identifier in: factorial
Thank you for help me.
The racket/base language is fairly bare bones, and doesn't provide many math functions. The racket language is a bit bigger, although still doesn't have factorial in particular. However, the math library does have factorial. So you can always require it on top of whatever language you use. As such, you will end up with a program like:
#lang racket
(require math)
(factorial 5) ; => 120
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With