3 ms·
A typical standard lib may have thousands upon thousands of functions with many less commonly used arguments and options. If you are saying "memorise the lot" i
by JetSetWilly 5y ago
A typical standard lib may have thousands upon thousands of functions with many less commonly used arguments and options. If you are saying "memorise the lot" is the only route to productivity on lisp then I'm out, because that's unrealistic. And let's not get into libraries outside of the standard lib, am I expected to memorise XML parsers, graphics APIs, and so on as well?
If you are saying "memorise what you commonly use" then that's fine, except that any typical program usually involves a lot of "lesser used" stuff as well.
- lispm 5y agoYou don't have to. Lisp development environments remember all what one loads into them: the definitions, their source location, their arguments, their documentation, who calls whom, the data types, ... One can ask Lisp about all that then.
- leprechaun1066 5y ago> One can ask Lisp about all that then How? As in what commands/functions/macros? Say I define a function and compile with slime, how do I get the repl to print it back to me? And with a function I loaded from an external library? Is there something like macroexpand-1 for functions which will print it out?
- lispm 5y agoM-. on a symbol brings you to the source code. Common Lisp also has built in the function FUNCTION-LAMBDA-EXPRESSION, which returns the source for a function -> when Lisp has recorded its definition. Try (DESCRIBE #'some-function) in SBCL to get information about the arglist, the types, the source file. In a SLIME editor buffer try c-h m . This will display the buffer commands. There are a zillion of commands to get information about the symbols, code references, etc. On my Lisp Machine: Command: Show Source Code (a defined function spec) mts::init-facts Source code for MTS::INIT-FACTS: (defun init-facts () (setf *init-facts* '((world (loc (actor joe) (val cave))) (joe (loc (actor joe) (val cave))) (world (loc (actor irving) (val oak-tree))) (irving (loc (actor irving) (val oak-tree))) (joe (loc (actor irving) (val oak-tree))) (world (loc (actor water) (val river))) (joe (loc (actor water) (val river))) (world (loc (actor honey) (val elm-tree))) (irving (loc (actor honey) (val elm-tree))) (world (loc (actor worm) (val ground))) (joe (loc (actor worm) (val ground))) (irving (loc (actor joe) (val cave))) (world (loc (actor fish) (val river))) (irving (loc (actor fish) (val river)))))) Command: Show Callers (a symbol [default MTS::INIT-FACTS]) MTS::INIT-FACTS MTS::MICRO-TALESPIN calls MTS::INIT-FACTS as a function. MTS::MICRO-TALESPIN-DEMO calls MTS::INIT-FACTS as a function. Done. Command:
- didibus 5y agoI'm referring to what you commonly use, but also I'm talking about the part of the standard library that involves more basic operations like creating collections, iterating them, defining and requiring modules, creating objects, looping, destructuring, literals, conditionals, data types, polymorphism, error handling, etc. As opposed to say learning the standard library relating to MIDI access, or file IO, or other specialized things that in theory could be a library and aren't really core. It might sound a little like syntax, but because Lisps have such a lean syntax, there's a lot of the fundamental constructs that are part of the standard library and they are more what I'm referring too. For example you'll have things like: car, cdr, append, mapcar, some, every, symbols, keywords, loop, intern, quote, format, butlast, intersection, union, multiple-value-bind, apply, funcall, =, eq, eql, if, unless, typecase, cond, dolist, iterate, etc. What often happens in Lisps is that each core function is very powerful and becomes almost a mini-DSL. So it takes a while to really learn about all those and have them memorized by heart so you don't constantly need to refer to the documentation about what they do and how they work and how to use them. And often their power comes when they are combined together as well, and that also takes some time to learn all the valid ways of combining them. Before you are familiar with all that and it's second nature, almost instinctive, you'll be a lot slower to read and write code.