Question

Why does the following not succeed in producing a sequence of length 4 ? $$ \mathrm{i} \leftarrow \text { (Primes new) select: }[: \mathrm{x} \mid \mathrm{x}<10] $$ Show how to implement methods for the following messages: while: The argument must be a one-parameter block returning a boolean value. Return values from the underlying generator as long as the block evaluates to true. Terminate when the underlying generator is exhausted or when a value is found for which the block is not true. until: Like while: The argument must be one-parameter block returning a boolean value. Produce values from the underlying generator until the block returns true, or until the generator is exhausted. Is it necessary to implement both of these in terms of AbstractGenerator? Show how, if a method exists for either one, the other can be implemented in terms of it.

   Why does the following not succeed in producing a sequence of length 4 ?
$$
\mathrm{i} \leftarrow \text { (Primes new) select: }[: \mathrm{x} \mid \mathrm{x}<10]
$$
Show how to implement methods for the following messages:
while: The argument must be a one-parameter block returning a boolean value. Return values from the underlying generator as long as the block evaluates to true. Terminate when the underlying generator is exhausted or when a value is found for which the block is not true.
until: Like while: The argument must be one-parameter block returning a boolean value. Produce values from the underlying generator until the block returns true, or until the generator is exhausted.
Is it necessary to implement both of these in terms of AbstractGenerator? Show how, if a method exists for either one, the other can be implemented in terms of it.
Show more…
A little Smalltalk
A little Smalltalk
Timothy Budd 1st Edition
Chapter 8, Problem 6 ↓

Instant Answer

verified

Step 1

The code assigns the result of the expression `Primes new` to the variable `i`, but it does not specify any action to generate a sequence of length 4. The `select:` message is used to filter elements from a collection based on a condition, but it does not generate  Show more…

Show all steps

lock
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Why does the following not succeed in producing a sequence of length 4 ? $$ \mathrm{i} \leftarrow \text { (Primes new) select: }[: \mathrm{x} \mid \mathrm{x}<10] $$ Show how to implement methods for the following messages: while: The argument must be a one-parameter block returning a boolean value. Return values from the underlying generator as long as the block evaluates to true. Terminate when the underlying generator is exhausted or when a value is found for which the block is not true. until: Like while: The argument must be one-parameter block returning a boolean value. Produce values from the underlying generator until the block returns true, or until the generator is exhausted. Is it necessary to implement both of these in terms of AbstractGenerator? Show how, if a method exists for either one, the other can be implemented in terms of it.
Close icon
Play audio
Feedback
Powered by NumerAI
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever