以下三个示例失败并出现以下错误:
(setv dct {1 2 3 4})
(setv dcts "dct")
;; (print (get (. (globals) [dcts]) 1))
(print (-> (globals) (. [dcts]) (get 1)))
;; (print (get (get (globals) "dct") 1))
(print (-> (globals) (get "dct") (get 1)))
;; (print (get (get (globals) dcts) 1))
(print (-> (globals) (get dcts) (get 1)))
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "/home/shadowrylander/test.hy", line 5
(print (-> (globals) (. [dcts]) (get 1)))
^
hy.errors.HySyntaxError: parse error for pattern macro 'get': got unexpected end of file, expected: some(...)
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "/home/shadowrylander/test.hy", line 8
(print (-> (globals) (get "dct") (get 1)))
^
hy.errors.HySyntaxError: parse error for pattern macro 'get': got unexpected end of file, expected: some(...)
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "/home/shadowrylander/test.hy", line 11
(print (-> (globals) (get dcts) (get 1)))
^
hy.errors.HySyntaxError: parse error for pattern macro 'get': got unexpected end of file, expected: some(...)
get
线程宏 ( )是否不能使用或一般宏->
?我已经多次重写打印语句以确保括号一致,并且它们都在那里。