Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

Problem Set 8 - UBC 2024 - CPSC 110

Beoordeling
1,0
(1)
Verkocht
24
Pagina's
13
Geüpload op
20-12-2022
Geschreven in
2022/2023

Completed file for problem set 8. Remember to copy the pdf file to Dr Racket for a better view. This file should be exactly identical except that the file has answers for each problems.

Instelling
Vak

Voorbeeld van de inhoud

;; DO NOT PUT ANYTHING PERSONALLY IDENTIFYING BEYOND YOUR
CWL IN THIS FILE.
;; YOUR CWLs WILL BE SUFFICIENT TO IDENTIFY YOU AND, IF YOU HAVE
ONE, YOUR
;; PARTNER.
;;
(require spd/tags)

(@assignment psets/pset-08); Do not edit or remove this tag

;; If you are:
;; - A 110 or 107 student replace the first set of '???'s with your cwl.
;; For problem sets, If you have a partner, please replace the second
;; set of '???'s with their cwl. Remember this, it is what you will
;; do with these @cwl annotations for the whole course.
;; - A UBC Extended Learning student, replace the first set of ??? with
;; your email address as confirmed in the email you received from
;; extended learning. The handin password is also in that email.
;; Remember this, it is what you will do with these @cwl annotations
;; for the whole course.
;;
(@cwl ??? ???)

;; These problems will be autograded. NOTE that, for problems 1-5, all of the
;; following are required. Violating one or more will cause your solution to
;; receive 0 marks.
;;
;; - Files must not have any errors when the Check Syntax button is pressed.
;; Press Check Syntax and Run often, and correct any errors early.
;;
;; - The function definition MUST call one or more built-in abstract functions.
;;
;; - For maximum credit the function definition should use the most clear
;; and expressive combination of abstract functions. In particular, while
;; it is possible to just use foldr for these problems that is not always
;; correct. If what is happening is a filter, then it is not correct to
;; just implement filtering with foldr.
;;
;; - The function definition MUST NOT be recursive.
;;
;; - The function definition MUST NOT use any part of the recursive Natural

, ;; template or the (listof X) template.
;;
;; - it must not include (cond [(empty? ... anywhere
;; - it must not include (cond [(zero? ... anywhere
;; - it must not include (if (empty? ... anywhere
;; - it must not include (if (zero? ... anywhere
;;
;; - The result of the function must directly be the result of one of the
;; built-in abstract functions. So, for example, the following is not
;; a valid function body:
;;
;; (define (foo x)
;; (empty? (filter ...)))
;;
;; - You MUST NOT change or comment out any check-expects, but you are
free
;; to add new ones.

(@problem 1)
;;
;; Design a function called sum-squares that consumes a list of naturals,
;; and produces the sum of squaring all of the naturals in the list.
;;
;; For example: (sum-squares (list 5 2 4)) produces 45.
;;
;; Your function definition must use built-in abstract functions.
;; For full marks it must be a composition of exactly 2 built-in
;; abstract functions.
;;

(@htdf sum-squares) ; uncomment this when you start problem 1
(@signature (listof Natural) -> Natural)
;;produce sum of squaring all of naturals in given list

(check-expect (sum-squares empty) 0)

(check-expect (sum-squares (list 5 2 4)) 45)

(check-expect (sum-squares (list 1 1 1)) 3)

Geschreven voor

Instelling
Studie
Vak

Documentinformatie

Geüpload op
20 december 2022
Aantal pagina's
13
Geschreven in
2022/2023
Type
College aantekeningen
Docent(en)
Gregor kiczales
Bevat
Alle colleges

Onderwerpen

€7,06
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF


Ook beschikbaar in voordeelbundel

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
2 jaar geleden

1,0

1 beoordelingen

5
0
4
0
3
0
2
0
1
1
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
tranghane Alfa-college
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
84
Lid sinds
3 jaar
Aantal volgers
57
Documenten
24
Laatst verkocht
5 maanden geleden

2,4

7 beoordelingen

5
1
4
1
3
1
2
1
1
3

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen