At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
o sweet.... we are askin the same question... feel like we should use remove-all definition but i have no clue how to operate it..
yeah... I have no idea how to do this... not that great in cs.. lol :/
...it's only about an hour till the deadline of this assignment.... i'm dying..
Yeah... I only got the first question. LOL. I'm screwed..
........i cant even say i got the first question cuz i didn't pass the test..... are u in cs 115..?
do i know u....?
yeah.. CS 115. In Lori Case class.... I don't think you know me.. I don't know that many people. LOL
i mean d i know u in person? nm we have different profs.... omg what to do...
No, I don't think you know me in person.. haha.. I just wrote all the design recipe stuff down hoping to get part marks.. I didn't get any of the actual functions itself...
o brilliant idea...... i'll do that immediately.... yeah muz get a 25%+ or it's too bad..
what program r u in?
haha.. yeah.. I just hope to get over 25% in the assignments to get that extra mark. LOL... and I'm in honours math.. hbu?
i already chose my program to be actsci....... and i now regret it a lot.... but i want to stay tho..
ooo actsci... a lot of people are taking that actually.. I'm actually taking MTHEL 131(intro to actuarial practice?) as my elective.. and I don't find it that interesting.. LOL
o i dont even know what that is...... my cousin 's in actsci 3rd yr and i juz wanted to get help from her so i chose the same program.. how i realize how tough it is.....><
haha.. that's why you choose a program that you like and enjoy.. I have to go drop off my algebra assignment due in 30 minutes.. LOL i'll be back soon. xD work on those design recipes! xD
o m g... i didn't even do my algebra assignment......
i was workin on cs all the time..
.... are you serious? ... wow.. Dx I did algebra first cause I find it easier and much more useful than CS... I hate CS ... don't even know why I have to take it...
...more useful....i much better in algebra than in cs so it doesn't matter if i miss one assignment.... thats why i gave it up..
yeah i don't see the point of taking cs.........i'm terrible at it...........
haha.. me too... I don't understand a thing in CS.. everything the prof says is just alien language to me.. LOL.. gonna go drop off algebra now.. i'll be back soon xD
oo~~ see u soon...... btw i cannot log in to my markus no matter which browser i use now...
o.O ur right... some authorization thing... :s
。。。 what should we do..........
I have no idea... I submitted some of mine already... It's probably cause a lot of people are using it or something.. Just keep trying I guess? :S
。。。 i emailed the ta.
I'm rusty at Scheme, but you should do something like this. (define (can-play-word? word) (cond ((empty? word) #t) ((char= (car word) 'a) (can-play-word (cdr word))) ((char= (car word) 'b) (can-play-word (cdr word))) ((char= (car word) 'c) (can-play-word (cdr word))) ((char= (car word) 'd) (can-play-word (cdr word))) ((char= (car word) 'e) (can-play-word (cdr word))) ((char= (car word) 'f) (can-play-word (cdr word))) ((char= (car word) 'g) (can-play-word (cdr word))) (else #f))) As I said, it might not be exactly like this. I have no way to test it at the moment, but it should follow this general structure: Make a cond, ask if the word still has elements, if its empty, it's automatically true. If the letter you recieve is a, b, c, d, e, f or g, you call the function again and keep trying. If you recieve anything else, it's automatically false.
Hey... thanks for the reply... an error message appeared when I ran the program.. char=: this function is not defined
yeah i have no clue what does char means.... i know car is first and cdr is rest...
hmm, there should be a function that does what char= is supposed to do, anything you remember that is used to compare two values? Lemme look up online char means a single character like a, b or c
Oh my bad, it's supposed to be char=? not char=
I wrote a helper function can-play-letter? that determines if a single letter is playable. Then for can-play-word? I said it's either that the string is empty (base case), or the first letter is playable (do a little work) and the rest of the word is playable (recursively reduce it to a smaller problem).
;;wordlist: string -> list-of-symbols ;;Purpose: transform a string to a list ;;Examples:(define (wordlist maryh) => (cons #\m (cons #\a (cons #\r (cons #\y (cons #\h empty))))) (define (wordlist word) (string->list word)) ;;data analysis: ;; if the word contains only a,b,c,d,e,f,g then produces boolean value true ;; if the word contains letters other than a,b,c,d,e,f,g then produces boolean value false ;;wordtest: string->boolean ;;Purpose: produce boolean value of a word whether it contains only a,b,c,d,e,f,g ;;or it contains letters that are not on the piano keyboard by consuming a string ;;Examples: ;;(check-word "dad") => true ;;(check-word "play") => false (define (check-word word) (cond [(equal? (list->string(cons (first (wordlist word)) empty))"a") true] [(equal? (list->string(cons (first (wordlist word)) empty))"b") true] [(equal? (list->string(cons (first (wordlist word)) empty))"c") true] [(equal? (list->string(cons (first (wordlist word)) empty))"d") true] [(equal? (list->string(cons (first (wordlist word)) empty))"e") true] [(equal? (list->string(cons (first (wordlist word)) empty))"f") true] [(equal? (list->string(cons (first (wordlist word)) empty))"g") true] [else false])) ;;tests (check-expect (check-word "face") true) (check-expect (check-word "False") false) ;;data analysis: ;;a wordlist is a helper function that ;;help to convert a sting into a list of word ;;can-play-word?: string -> boolean ;;Purpose: produce boolean value depending on whether or not a word can be played on a piano ;;by consuming a string ;;Examples: ;;(can-play-word? "face") => true ;;(can-play-word? "Dad") => false ;;(can-play-word? "apple") => false ;; (can-play-word? "lee-chin") => false (define (can-play-word? word) (cond [(empty? (wordlist word)) true] [(check-word word) (can-play-word? (list->string (rest (wordlist word))))] [else false]))
Sorry, my Scheme is ancient (R5RS, circa 1997). (define (can-play-letter? letter) (and (char>=? letter #\a) (char<=? letter #\g))) (define (can-play-word? word) (or (= (string-length word) 0) (and (can-play-letter? (string-ref word 0)) (can-play-word? (substring word 1 (string-length word))))))