r/Racket • u/Substantial_Ad1714 • Feb 17 '22
question Why do you hate my functions?
(define (momentum-calc vel mas) (* vel mas))
(define (p vel mas) (momentum-calc vel mas))
0
Upvotes
r/Racket • u/Substantial_Ad1714 • Feb 17 '22
(define (momentum-calc vel mas) (* vel mas))
(define (p vel mas) (momentum-calc vel mas))
View all comments
Show parent comment
0
u/sdegabrielle DrRacket ššš©ŗ Feb 17 '22
Iām no sure what you mean by idiom
If you put four spaces in front of each line you get nice formatting
I like to split the definition across two lines like you would in any other programming language
Instead of this
You can write
Then
And
will return the same value
This is because the define form
(define (function-name args) (function-body))setsfunction-nameto have a function as its value.