Question: This is a code written in Dr Racket. Why it uses cons and what cons does? ; contract: insert: l ( list of numbers )
This is a code written in Dr Racket. Why it uses cons and what cons does?
; contract: insert: llist of numbers valnumber list of numbers
; test
; function
define insert val cond empty llist val
val first lcons val l ; insert it to the list
else cons first linsert rest l val; do not insert the value, but
add first of not to remove element from the list
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
