Dinesman's multiple-dwelling problem: Difference between revisions

Content deleted Content added
Hansoft (talk | contribs)
Added Forth version
Hansoft (talk | contribs)
m Fixed small typo
Line 227: Line 227:
," Miller"
," Miller"
," Smith" \ get name, type it
," Smith" \ get name, type it
does> swap cells + @c count type ." lives in ";
does> swap cells + @c count type ." lives in " ;


5 constant #floor \ number of floors
5 constant #floor \ number of floors
Line 271: Line 271:
Smith lives in 1
Smith lives in 1
</pre>
</pre>

=={{header|Haskell}}==
=={{header|Haskell}}==
The List monad is perfect for this kind of problem. One can express the problem statements in a very natural and concise way:
The List monad is perfect for this kind of problem. One can express the problem statements in a very natural and concise way: