a
Size: a a a
a
TT
TT
a
TT
TT
ND
(delete val lst)
a
TT
(delete val lst)
a
(cond (and (> acc2 v) (< acc2 acc)))так?
ND
a
TT
#lang racket
(require srfi/1)
(define (max lst)
(fold (lambda (acc v acc2) ((if (> v acc) v acc)) 0 lst)))
(define lst (list first second third))
(define (sum-of-squares-of-top-two first second third) (
(+ (sqr (max lst)) (sqr (max (delete (max lst) lst))))))
(sum-of-squares-of-top-two 2 3 1)
fold: arity mismatch;
the expected number of arguments does not match the given number
expected: at least 3
given: 1
arguments...:
#<procedure>
TT
ND
ND
(cadr (sort lst >))
тоже вполне себеTT
#lang racket
(require srfi/1)
(define (max lst)
(fold (lambda (acc v acc2) ((if (> v acc) v acc)) 0 lst)))
(define lst (list first second third))
(define (sum-of-squares-of-top-two first second third) (
(+ (sqr (max lst)) (sqr (max (delete (max lst) lst))))))
(sum-of-squares-of-top-two 2 3 1)
fold: arity mismatch;
the expected number of arguments does not match the given number
expected: at least 3
given: 1
arguments...:
#<procedure>
a