From 513c12550cf9b21590a0ad517ee9b5c87dbb9d96 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Fri, 1 Mar 2024 21:36:16 +0100 Subject: [PATCH] add escaped symbols to scheme tutorial --- docs/docs/scheme-intro/data-types.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/docs/scheme-intro/data-types.md b/docs/docs/scheme-intro/data-types.md index fb49309d..917a8438 100644 --- a/docs/docs/scheme-intro/data-types.md +++ b/docs/docs/scheme-intro/data-types.md @@ -84,6 +84,24 @@ You can also convert string to symbol with: Scheme have conversion of using `->` arrow to define procedure that convert types. +In R7RS spec there is also a way to define symbols with special characters. Those symbols start and end with a vertical bar character. + +```scheme +(define |foo bar| 10) +(define |foo () bar| 20) +(display |foo bar|) +;; ==> 10 +(display |foo () bar|) +;; ==> 20 +``` + +You can also put escaped characters in symbol, like in strings: + +```scheme +(symbol=? '|\x3BB;| 'λ) +;; ==> #t +``` + ## Comments There are 3 types of comments in Scheme: