Character codes: Difference between revisions
Content added Content deleted
(Added LFE example) |
|||
Line 432: | Line 432: | ||
'a ord . # 97 |
'a ord . # 97 |
||
97 chr . # a</lang> |
97 chr . # a</lang> |
||
=={{header|LFE}}== |
|||
In LFE/Erlang, lists and strings are the same, only the representation changes. For example: |
|||
<lang lisp> |
|||
> (list 68 111 110 39 116 32 80 97 110 105 99 46) |
|||
"Don't Panic." |
|||
</lang> |
|||
As for this exercise, here's how you could print out the ASCII code for a letter, and a letter from the ASCII code: |
|||
<lang lisp> |
|||
> (: io format '"~w~n" '"a") |
|||
97 |
|||
ok |
|||
> (: io format '"~p~n" (list '(97))) |
|||
"a" |
|||
ok |
|||
</lang> |
|||
=={{header|Liberty BASIC}}== |
=={{header|Liberty BASIC}}== |