|
|||
|
Does anyone know what this is? I'm studying it in Computer Science right now, and I need some help in building functions. Here is the problem: Quote: 4. About six million people living near the Congo River speak a Bantu language called Lingala. Their words for
numbers 1 through 9 are: 1 moko, 2 mibale, 3 misato, 4 minei, 5 mitano, 6 motoba, 7 nsambo, 8 mwambe, 9 libwa The word for 10 is zomi, but the prose numerals for multiples of 10 from 20 to 90 are formed from an alternative word for 10, ntuku, and the word for the multiplier: 10 zomi, 20 ntuku mibale, 30 ntuku misato, etc. The prose numerals for multiples of 100 up to 900 are formed from the word nkama ( hundred') and the word for the multiplier: 100 nkama moko, 200 nkama mibale, 300 nkama misato, etc. Similarly, the prose numerals for multiples of 1000 up to 9000 are formed from the word nkoto ( thousand') and the word for the multiplier: 1000 nkoto moko, 2000 nkoto mibale, 3000 nkoto misato, etc. Linking these words together forms the numbers 1 through 9999: 11 zomi moko 21 ntuku mibale moko 84 ntuku mwambe minei 157 nkama moko ntuku mitano nsambo 440 nkama minei ntuku minei 913 nkama libwa zomi misato 1111 nkoto moko nkama moko zomi moko 2001 nkoto mibale moko 5082 nkoto mitano ntuku mwambe mibale 9999 nkoto libwa nkama libwa ntuku libwa libwa Develop the Scheme function Lingala, which consumes an integer between 1 and 9999 and produces the Lingala prose for that number. This is how far I got: Quote: ;; Number 4
(define (ones x) (modulo x 10)) (define (tens x) (modulo (quotient x 10) 10)) (define (hundreds x) (modulo (quotient (quotient x 10) 10) 10)) (define (thousands x) (modulo (quotient (quotient (quotient x 10) 10) 10) 10)) ;; Lingala: number -> string ;; consumes a number and returns the Lingala number ;; (define (Lingala-number x) (cond [(= (ones x) 1) "moko"] [(= (ones x) 2) "mibale"] [(= (ones x) 3) "misato"] [(= (ones x) 4) "minei"] [(= (ones x) 5) "mitano"] [(= (ones x) 6) "motoba"] [(= (ones x) 7) "nsambo"] [(= (ones x) 8) "mwambe"] [(= (ones x) 9) "libwa"]) If anyone know how to write Dr. Scheme, please help ASAP! Thanks! posted by nocturnal_anonymous |
|||
|
|||
| in-my-opinion.orgTechnology, Computers, Science, InternetComputers and InternetDr. Scheme |
|
|||
|
THAT is actually what I accuse science studies of. They try to make examples as least applicable to real life as possible. Sucks. It's a major mistake in science nowadays and should be changed. "Nkoto moko nkama moko zomi moko"? Gimme-a-break. posted by knn |
|||
|
|||
|
|||
|
Do you know how to write Scheme? I need some help here. posted by nocturnal_anonymous |
|||
|
|||
|
|||
|
Quote: Do you know how to write Scheme? That's the other part of the VERY SAME problem: Using programming languages noone else uses. Some have been just developed for the university use. Sucks, sucks, sucks. Learning for non-life. Teaching non-applicable stuff and call this "school". posted by knn |
|||
|
|
|||
|
|||
|
I think Dr. Scheme is modified version of Scheme, because I'm in Computer Science 1A class, which is the very basics of computer science. I think after this semester we're going to start learning Java...Dr. Scheme is supposed to be like a prep I guess... posted by nocturnal_anonymous |
|||
|
|||
|
|||
|
nocturnal_anonymous: I think Dr. Scheme is modified version of Scheme, because I'm in Computer Science 1A class, which is the very basics of computer science.
I think after this semester we're going to start learning Java...Dr. Scheme is supposed to be like a prep I guess... I took Scheme in my first Computer Science class. It's the worst language I've ever programmed with, maybe even worse than QBasic! I checked your progress and you're doing good. Just be careful because it's gonna be a long ass program. Try searching on Google for "numbers to letters" or something like that and even though you may find it in another language you can still apply the same principle. Good luck! If you need more help don't hesitate to ask posted by Echelon |
|||
|
|||
|
|||
|
Quote: I think after this semester we're going to start learning Java...Dr. Scheme is supposed to be like a prep I guess... I far as I understand Java and scheme appear to have very little similarity. Java is very english like and has object-orientedness as a key feature. I thought purpose of most programming languages is to make them closer to human expression (english-like for most of us) while translating the programming instructions to binary code which the machines understand. I am curious what criteria they had in mind when they came up with bantu keywords as in Scheme. posted by blueSky |
|||
|
|||
|
|||
|
Quote: I am curious what criteria they had in mind when they came up with bantu keywords as in Scheme. That is just the language for the PROBLEM our computer science teacher told us to do. He could have told us to build a function to translate numbers into French or something. The language of Scheme is very English-like as well, if you take a look. Such as "define," "substring," "string-append," "number->string," "quotient," etc... Quote: If you need more help don't hesitate to ask I'm asking. posted by nocturnal_anonymous |
|||
|
|||
|
|||
|
Quote: The language of Scheme is very English-like as well, if you take a look. Such as "define," "substring," "string-append," "number->string," "quotient," etc... As is every programming language. With one difference: Other languages are USEFUL. posted by knn |
|||
|
|||
|
|||
|
Quote: As is every programming language. WIth one difference: Other languages are USEFUL. Whatever you say, knn... ... Just because YOU don't know how to use it doesn't mean it's not useful posted by nocturnal_anonymous |
|||
|
|||
|
|||
|
Quote: Just because YOU don't know how to use it doesn't mean it's not useful ...don't try and cover up your ignorance with scorn. I don't know Fortran or VB either, but they are USEFUL. posted by knn |
|||
|
|||
|
|||
|
Quote: I don't know Fortran or VB either, but they are USEFUL. I haven't even heard of those before... Don't judge something when you don't understand it yet. ... posted by nocturnal_anonymous |
|||
|
|||
|
|||
|
Quote: Don't judge something when you don't understand it yet. OK, I got the following text from Consider the following simple mathematical function
which converts degrees in fahrenheit to degrees in centigrade. It's easy to convert this function into a Scheme program: use define to introduce a new definition, and put the operators in front of their operands.
Aaargh! They try to be academic smartasses. posted by knn |
|||
|
|||
|
|||
|
I was told that Scheme was a language developed by MIT to teach programming basics. And they say that it is useful in programming applications in robotics. posted by Echelon |
|||
|
|||
|
|||
|
Quote: And they say that it is useful in programming applications in robotics. Hmm, what programming language isn't? posted by knn |
|||
|
|||
|
The time now is 1 December 2008, 21:11 php B.B. |