(Arne Babenhauserheide)
2017-11-11: add lines starting with # to be interpreted as literal arrays add lines starting with # to be interpreted as literal arrays
diff --git a/tests/literalarray.scm b/tests/literalarray.scm
new file mode 100644
--- /dev/null
+++ b/tests/literalarray.scm
@@ -0,0 +1,1 @@
+#(a b)
diff --git a/tests/literalarray.w b/tests/literalarray.w
new file mode 100644
--- /dev/null
+++ b/tests/literalarray.w
@@ -0,0 +1,1 @@
+# a b
diff --git a/wisp-reader.w b/wisp-reader.w
--- a/wisp-reader.w
+++ b/wisp-reader.w
@@ -36,6 +36,8 @@ catch #t
define wisp-pending-sexps : list
define : read-one-wisp-sexp port env
+ ;; allow using "# foo" as #(foo).
+ read-hash-extend #\space : λ (chr port) #\#
cond
: eof-object? : peek-char port
read-char port ; return eof: we’re done
diff --git a/wisp-scheme.w b/wisp-scheme.w
--- a/wisp-scheme.w
+++ b/wisp-scheme.w
@@ -686,6 +686,15 @@ define : wisp-replace-paren-quotation-re
list 'quasisyntax : map wisp-replace-paren-quotation-repr a
: 'REPR-UNSYNTAXSPLICING-e749c73d-c826-47e2-a798-c16c13cb89dd a ...
list 'unsyntax-splicing : map wisp-replace-paren-quotation-repr a
+ ;; literal array as start of a line: # (a b) c -> (#(a b) c)
+ : #\# a ...
+ with-input-from-string ;; hack to defer to read
+ string-append "#"
+ with-output-to-string
+ λ :
+ write : map wisp-replace-paren-quotation-repr a
+ current-output-port
+ . read
: a ...
map wisp-replace-paren-quotation-repr a
a