Type detection: Difference between revisions

m
added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added other whitespace to the task's preamble.
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added other whitespace to the task's preamble.)
Line 1:
{{draft task|Type detection}}
 
This draft task needs a purpose, a description and some way to tell whether examples satisfy or do not satisfy it.
 
The task is to show a function/procedure that processes a block of text by printing it. The function takes one parameter (ideally) that describes the text. Demonstrate by calling the function twice, each time passing in a different type.
 
;Task:
This can be done with pattern matching, multi-methods, dynamic type detection, structs with a tag, etc. The objective is write one [eg library] function that processes text from multiple sources (such as a string/char *, socket, file, etc). If not practical, show how the caller would coerce a type that can be passed to the library function.
Show a function/procedure that processes a block of text by printing it.
 
The function takes one parameter (ideally) that describes the text.
 
Demonstrate by calling the function twice, each time passing in a different type.
 
 
This can be done with pattern matching, multi-methods, dynamic type detection, structure(s) with a tag, etc.
 
The objective is write a [e.g. library] function that processes text from multiple sources (such as a string/char *, socket, file, etc).
 
If not practical, show how the caller would coerce a type that can be passed to the library function.
<br><br>
 
== {{header|J}} ==