How to resolve the algorithm Interactive programming (repl) step by step in the Smalltalk programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Interactive programming (repl) step by step in the Smalltalk programming language

Table of Contents

Problem Statement

Many language implementations come with an interactive mode. This is a command-line interpreter that reads lines from the user and evaluates these lines as statements or expressions. An interactive mode may also be known as a command mode,   a read-eval-print loop (REPL),   or a shell.

Show how to start this mode. Then, as a small example of its use, interactively create a function of two strings and a separator that returns the strings separated by two concatenated instances of the separator   (the 3rd argument).

should return

This task is   not   about creating your own interactive mode.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Interactive programming (repl) step by step in the Smalltalk programming language

Source code in the smalltalk programming language

$ gst
GNU Smalltalk ready

st> |concat|
st> concat := [ :a :b :c | (a,c,c,b) displayNl ].
a BlockClosure
st> concat value: 'Rosetta' value: 'Code' value: ':'.
Rosetta::Code
'Rosetta::Code'
st>


$ stx --repl
Welcome...

STX> |concat|\
concat := [ :a :b :c | (a,c,c,b) displayNl ].\
concat value: 'Rosetta' value: 'Code' value: ':'.
Rosetta::Code
-> (Answer): 'Rosetta::Code'
STX>


  

You may also check:How to resolve the algorithm Boolean values step by step in the E programming language
You may also check:How to resolve the algorithm String prepend step by step in the C# programming language
You may also check:How to resolve the algorithm Factorial step by step in the Genyris programming language
You may also check:How to resolve the algorithm Bioinformatics/base count step by step in the Ada programming language
You may also check:How to resolve the algorithm Luhn test of credit card numbers step by step in the Run BASIC programming language