Question: Scheme Function: (define (append lizt1 lizt2) (cond ((null? lizt1) lizt2) (else (cons (car lizt1) (append (cdr lizt1)lizt2))) ) ) Problem: Reimplement the function in Scala
Scheme Function:
(define (append lizt1 lizt2)
(cond
((null? lizt1) lizt2)
(else (cons (car lizt1)
(append (cdr lizt1)lizt2)))
)
)
Problem:
Reimplement the function in Scala.
Guidelines:
Each reimplementation must define the same protocols as theoriginal Scheme implementation.
1 Names may be altered when they conflict withreserved words or library functions.
2 Generic types should be used when possible,otherwise consistent non-generic types should be usedinstead.
Each reimplementation must produce the same semantics as theoriginal Scheme implementation when possible.
1 No library functions which produce the samesemantics may be used.
2 No iteration may be used, onlyrecursion.
3 There must be referential transparency, thusno side effects.
4 Any suitable operations for equality may besubstituted.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
