See the files and streams dictionary in the HyperSpec. WITH-OPEN-STREAM, READ, READ-LINE, READ-CHAR, READ-BYTE, READ-SEQUENCE, ...
How to read a file, replace words in the file, and write the result back to the file
Use above. See also: WRITE and related.
Iterate the files in a directory and other filesystem stuff
See above. DIRECTORY, pathnames, ...
Interact with an SQL db
Use for example the CLSQL library.
Do communications over sockets
See the manual of your Lisp or use one of the portable libraries. See Quicklisp.
Threading for stuff like a webserver
See the manual of your Lisp or use one of the portable libraries. See Quicklisp.
Create GUIs
Depends. See Quicklisp or an implementation specific library.
Perform operations on binary files
See Hyperspec for file and stream operations. WRITE-BYTE, READ-BYTE. Open a stream as a binary stream.
Write a parser (not an interpreter for Lisp in Lisp, which as I understand is like 5 lines of Lisp)
Use one of the existing tools for that. Study existing parsers. There are many parsers written in Lisp, but not much in books about that (other than natural language parsers, which are described in the AI literature).
Interact with the operating system (i.e. stuff written in C or C++) to do stuff Lisp can't do natively
Depends. See Quicklisp or an implementation specific library.
How to write Lisp extensions in C (is that possible?)
Depends. See Quicklisp or an implementation specific library. -> FFI
Final advice: Read code from other authors.
Study other Lisp code. There is enough very diverse Lisp code out there. From web servers to music composition software.
You can write extensions for Lisp in C depending on which implementation you're using. Emacs-Lisp for example allows you to do that though it isn't Common Lisp. Usually what you want to do is write the code in Common Lisp and then optimize it as much as possible using different Lisp compiler declarations, or the other method where you use a foreign function interface.
Threading depends on which implementation you use, but I think most of them have threads now.
Hunchentoot is one of the best Lisp web servers and is pretty easy to get started with. You don't have to write any threading code yourself, you just have to write the HTTP request handler functions.
发布评论
评论(2)
我建议阅读“实用 Common Lisp”,因为它已经回答了您的一些问题。
您可能应该阅读三到四本书:
Common Lisp 参考
手册
现在您应该检查的下一件事是Lisp 实现手册。它描述了许多特定的扩展:网络、线程……
Common Lisp 实现的文档:
SLIME (基于 Emacs 的 Lisp-IDE)有一个 SLIME 用户手册。
Common Lisp 库的文档:
库
对于库,请使用
现在看看您的一些观点:
请参阅 HyperSpec 中的文件和流字典。 WITH-OPEN-STREAM, READ, READ-LINE, READ-CHAR, READ-BYTE, READ-SEQUENCE, ...
使用上面的内容。另请参阅:WRITE 及相关内容。
请参见上文。目录、路径名...
例如使用 CLSQL 库。
请参阅 Lisp 手册或使用可移植库之一。参见 Quicklisp。
请参阅 Lisp 手册或使用可移植库之一。参见 Quicklisp。
取决于。请参阅 Quicklisp 或特定于实现的库。
有关文件和流操作,请参阅 Hyperspec。写字节,读字节。将流作为二进制流打开。
使用现有的工具之一。研究现有的解析器。有许多解析器是用 Lisp 编写的,但关于这方面的书籍却很少(除了人工智能文献中描述的自然语言解析器)。
取决于。请参阅 Quicklisp 或特定于实现的库。
取决于情况。请参阅 Quicklisp 或特定于实现的库。 -> FFI
最终建议:阅读其他作者的代码。
研究其他 Lisp 代码。那里有足够多的非常多样化的 Lisp 代码。从网络服务器到音乐创作软件。
I would propose reading 'Practical Common Lisp', since it already answers some of your questions.
There are probably three to four books you should read:
Common Lisp Reference
Manuals
Now the next thing you should check out is the manual of your Lisp implementation. It describes a lot of specific extensions: networking, threads, ...
Documentation for Common Lisp implementations:
SLIME (the Emacs-based Lisp-IDE) has a SLIME User Manual.
Documentation for Common Lisp libraries:
Libraries
For libraries use
Now looking at some of your points:
See the files and streams dictionary in the HyperSpec. WITH-OPEN-STREAM, READ, READ-LINE, READ-CHAR, READ-BYTE, READ-SEQUENCE, ...
Use above. See also: WRITE and related.
See above. DIRECTORY, pathnames, ...
Use for example the CLSQL library.
See the manual of your Lisp or use one of the portable libraries. See Quicklisp.
See the manual of your Lisp or use one of the portable libraries. See Quicklisp.
Depends. See Quicklisp or an implementation specific library.
See Hyperspec for file and stream operations. WRITE-BYTE, READ-BYTE. Open a stream as a binary stream.
Use one of the existing tools for that. Study existing parsers. There are many parsers written in Lisp, but not much in books about that (other than natural language parsers, which are described in the AI literature).
Depends. See Quicklisp or an implementation specific library.
Depends. See Quicklisp or an implementation specific library. -> FFI
Final advice: Read code from other authors.
Study other Lisp code. There is enough very diverse Lisp code out there. From web servers to music composition software.
查看 Cliki the Common Lisp wiki 它提供了可用于 Common Lisp 的库列表,这将帮助您完成您的所有物品。
另外,您还需要查看Common Lisp Cookbook(还有更多< a href="https://lispcookbook.github.io/cl-cookbook" rel="nofollow noreferrer">更新版本)。它有一堆用于常见任务的代码,例如一次读取一行文件< /a> 和用于与用 C 编写的库交互的外部函数接口。
您可以用 C 语言编写 Lisp 扩展,具体取决于您使用的实现。例如,Emacs-Lisp 允许您这样做,尽管它不是 Common Lisp。通常您想要做的是用 Common Lisp 编写代码,然后使用不同的 Lisp 编译器声明或使用外部函数接口的其他方法尽可能地对其进行优化。
线程取决于您使用哪种实现,但我认为现在大多数都有线程。
Hunchentoot 是最好的 Lisp Web 服务器之一,而且非常容易上手。您不必自己编写任何线程代码,只需编写 HTTP 请求处理程序函数即可。
有人编译了Lisp 的 GUI 选项列表 :
Check out Cliki the Common Lisp wiki it provides a list of libraries available for Common Lisp which will help you accomplish all your items.
Also, you're going to want to check out the Common Lisp Cookbook (there's also a more updated version). It has a bunch of code for common tasks such as reading a file one line at a time, and Foreign Function Interfaces for interacting with libraries written in C.
You can write extensions for Lisp in C depending on which implementation you're using. Emacs-Lisp for example allows you to do that though it isn't Common Lisp. Usually what you want to do is write the code in Common Lisp and then optimize it as much as possible using different Lisp compiler declarations, or the other method where you use a foreign function interface.
Threading depends on which implementation you use, but I think most of them have threads now.
Hunchentoot is one of the best Lisp web servers and is pretty easy to get started with. You don't have to write any threading code yourself, you just have to write the HTTP request handler functions.
Someone compiled a list of GUI options for Lisp: