Skip to content

Commit 513bf99

Browse files
author
Andy C
committed
[demo/survey-loop] List comprehension
[doc/framing] Notes on HTTP
1 parent 04df113 commit 513bf99

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

demo/survey-loop.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ for x in mylist:
2323
if x == 2:
2424
mylist.append(99)
2525
print(x)
26+
'
27+
28+
echo ---
29+
echo PY comp
30+
31+
python3 -c '
32+
def myappend(li, i):
33+
if i == 1:
34+
li.append(99)
35+
print(i)
36+
return i
37+
38+
mylist = [1,2,3]
39+
y = [myappend(mylist, i) for i in mylist]
40+
print(y)
2641
'
2742
}
2843

@@ -95,5 +110,4 @@ compare-mutate() {
95110
mutate-ysh
96111
}
97112

98-
99113
"$@"

doc/framing.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,23 @@ Traditional shells mostly support newline-based records. YSH supports:
167167

168168
1. Length-prefixed records
169169
1. Delimiter-based records
170-
- fixed delimiter: newline or `NUL`
171-
- chosen delimiter: TODO? with regex capture?
170+
- fixed delimiter: newline or `NUL`
171+
- chosen delimiter: TODO? with regex capture?
172172
1. Escaping-based records with [JSON][] and the [J8 Notation][] extension.
173-
- But we avoid formats that are purely based on escaping.
173+
- But we avoid formats that are purely based on escaping.
174+
175+
[J8 Notation]: j8-notation.html
176+
177+
## Appendix
178+
179+
### Notes on HTTP 1.1
180+
181+
It has a messy mix of strategies:
182+
183+
- The HTTP headers and body are separated by a blank line - a fixed **delimiter**
184+
- The `Content-Length:` header is a **length prefix** for the request or
185+
response body
186+
- But you can also use `Transfer-Encoding: chunked`, which makes the body a
187+
**stream** of length-prefixed chunks. The stream is terminated by a sentinel
188+
(a delimiter).
189+
- Multipart MIME file uploads use a **chosen delimiter** to separate files.

0 commit comments

Comments
 (0)