我正在尝试学习Racket,并在此过程中尝试重写Python过滤器.我的代码中有以下一对函数:
def dlv(text):
"""
Returns True if the given text corresponds to the output of DLV
and False otherwise.
"""
return text.startswith("DLV") or \
text.startswith("{") or \
text.startswith("Best model")
def answer_sets(text):
"""
Returns a list comprised of all of the answer sets in the given text.
"""
if dlv(text):
# In the case where we are processing the output of DLV, each
# answer set is a comma-delimited sequence of literals enclosed
# in {}
regex = re.compile(r'\{(.*?)\}', re.MULTILINE)
else: …Run Code Online (Sandbox Code Playgroud) 我在配置 zsh 提示时遇到了一些困难。具体来说,我希望字体具有由十六进制代码定义的颜色:#87afdf
目前,我已按如下方式设置提示:
PROMPT='%B[%d]
? %b'
Run Code Online (Sandbox Code Playgroud)
我尝试通过以下方式添加颜色:
autoload -U colors && colors
PROMPT='%{$fg[#87afdf]%}%B[%d]
? %b%{$reset_color%}'
Run Code Online (Sandbox Code Playgroud)
但这只会给我以下胡言乱语:
$fg[#87afdf][/Users/gregory]
? $reset_color
Run Code Online (Sandbox Code Playgroud)
任何关于如何进行的想法将不胜感激。
除了学习Racket,我还在努力学习文学编程.不幸的是,关于scribble/lp,Racket文档很少说.有人能指出我在这个主题上有更好的资源或用Racket编写的文学程序的例子吗?
非常感谢你.