Skip to content

Commit b950ac7

Browse files
committed
update informal intro
1 parent 2b15b2f commit b950ac7

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/tutorial/informal-introduction-to-lisp.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Output:
225225
113.06
226226
```
227227

228-
Like Python, you should treat `*` as read-only. Avoid assigning to it explicitly.
228+
You should treat `*` as read-only. Avoid assigning to it explicitly.
229229

230230
Common Lisp supports other numeric types, including complex numbers. The imaginary unit is represented as `#C(0 1)` or `0+1i`
231231

@@ -350,13 +350,13 @@ Second line.
350350

351351
Common Lisp doesn't have "raw strings" in the same way as Python. Backslashes are always interpreted as escape characters unless they are themselves escaped (e.g., `\\`).
352352

353-
String literals can span multiple lines using backslashes at the end of each line to continue the string:
353+
String literals can span multiple lines without the need for any special syntax:
354354

355355
```lisp
356-
(setf long-string "Usage: thingy [OPTIONS]\
357-
\
358-
-h Display this usage message\
359-
\
356+
(setf long-string "Usage: thingy [OPTIONS]
357+
358+
-h Display this usage message
359+
360360
-H hostname Hostname to connect to")
361361
(print long-string)
362362
```
@@ -386,47 +386,47 @@ Output:
386386
There is no automatic concatenation of adjacent string literals in Common Lisp. You must always use `concatenate`.
387387

388388
```lisp
389-
(concatenate 'string "Py" "thon")
389+
(concatenate 'string "Li" "sp")
390390
```
391391

392392
Output:
393393

394394
```lisp
395-
"Python"
395+
"Lisp"
396396
```
397397

398398
```lisp
399-
(setf prefix "Py")
400-
(concatenate 'string prefix "thon")
399+
(setf prefix "Li")
400+
(concatenate 'string prefix "sp")
401401
```
402402

403403
Output:
404404

405405
```lisp
406-
"Python"
406+
"Lisp"
407407
```
408408

409409
Strings can be accessed by index using `aref`. The first character has index 0:
410410

411411
```lisp
412-
(setf word "Python")
412+
(setf word "Lisp")
413413
(aref word 0) ; character in position 0
414414
```
415415

416416
Output:
417417

418418
```lisp
419-
#\P
419+
#\L
420420
```
421421

422422
```lisp
423-
(aref word 5) ; character in position 5
423+
(aref word 2) ; character in position 5
424424
```
425425

426426
Output:
427427

428428
```lisp
429-
#\n
429+
#\s
430430
```
431431

432432
Indices can't be negative in Common Lisp's `aref`.
@@ -440,17 +440,17 @@ To get a substring (slicing), use `subseq`:
440440
Output:
441441

442442
```lisp
443-
"Py"
443+
"Li"
444444
```
445445

446446
```lisp
447-
(subseq word 2 5) ; characters from position 2 (included) to 5 (excluded)
447+
(subseq word 2 3) ; characters from position 2 (included) to 3 (excluded)
448448
```
449449

450450
Output:
451451

452452
```lisp
453-
"tho"
453+
"s"
454454
```
455455

456456
Slice indices have useful defaults; an omitted first index defaults to zero, and an omitted second index defaults to the length of the string:
@@ -462,17 +462,17 @@ Slice indices have useful defaults; an omitted first index defaults to zero, and
462462
Output:
463463

464464
```lisp
465-
"Python"
465+
"Lisp"
466466
```
467467

468468
```lisp
469-
(subseq word 4) ; characters from position 4 (included) to the end
469+
(subseq word 2) ; characters from position 4 (included) to the end
470470
```
471471

472472
Output:
473473

474474
```lisp
475-
"on"
475+
"sp"
476476
```
477477

478478
Common Lisp strings *are* mutable. You can change individual characters using `(setf (aref string index) new-character)`:

0 commit comments

Comments
 (0)