String prepend: Difference between revisions
m
→{{header|Phix}}: added syntax colouring the hard way, phix/basics
Alextretyak (talk | contribs) (Added 11l) |
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
||
Line 1,131:
=={{header|Phix}}==
{{libheader|Phix/basics}}
<!--<lang Phix>-->
<span style="color: #004080;">string</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"World"</span>
<b>NB:</b> s = prepend(s,"Hello ") gives typecheck: s is {"Hello ",'W','o','r','l','d'}, rather than the "Hello World" you probably wanted.▼
<span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"Hello "</span><span style="color: #0000FF;">&</span><span style="color: #000000;">s</span>
<!--</lang>-->
▲<b>NB:</b> s = prepend(s,"Hello ") gives typecheck: s is {"Hello ",87'W',111'o',114'r',108'l',100'd'}, of length 6, rather than the "Hello World" of length 11 you probably wanted.<br>
- and likewise s = prepend("Hello ",s) is not only the wrong way round but dies with typecheck: s is {"World",72'H',101'e',108'l',108'l',111'o',32' '} (length 7).
=={{header|PicoLisp}}==
|