freenode/#lisp - IRC Chatlog
Search
1:52:48
vtomole
Is there tool for seeing how objects are consed by read? e.g, an input of (+ 1 2) gives (cons '+ (cons 1 (cons 2 '())))?
2:02:12
Bike
also, it's traditional to name constants as +sempty+ to distinguish them from run of the mill variables.
2:06:07
Bike
i wouldn't phrase it as "surrounding", but (foo ...) is an operation, and if foo is a function it's a function call.
2:06:31
Bike
it could also be a macro form, like (defun ...) is, or a special operation, like (if ...)
2:07:30
k-hos
you will eventually come across things like; '(1 2 3) which isn't a function call, because of the single quote
2:10:15
Bike
if you want to understand the semantics in detail i recommend writing a simple evaluator
4:07:51
jasom
LdBeth: most lisp implementations provide a way to run a program. It is possible that uiop:run-program will do what you need
4:11:01
jasom
hmm (uiop:run-program "htop" :output :interactive) didn't work as I expected, so maybe not
4:11:02
PuercoPop
jasom: My knowledge of terminals is not very deep. But I would imagine that the REPL wouldn't play nice with a program that takes the whole screen for a while. Like htop or vim.
4:11:36
jasom
PuercoPop: the REPL is uninvolved until the form returns in most implementations, so I wouldn't think that would be a problem
4:12:11
jasom
(uiop:run-program "htop" :output :interactive :input :interactive) ;; works on sbcl on MyMachine(tm)
4:12:49
jasom
It does not work on CCL, which makes at least some sense because ccl has a separate REPL thread IIRC
4:17:09
jasom
PuercoPop: for fancy REPLs there is a good chance that the program won't return the tty to the same state as before it was run, so those might have a problem. SBCL's REPL is so minimal it's not a problem
4:17:42
jasom
LdBeth: this works on every lisp I tried except ccl: (uiop:run-program "htop" :output :interactive :input :interactive)
4:18:27
PuercoPop
I've ran into issues with two programs writing to the same terminal (webpacker and vis, the editor).
4:19:02
jasom
There's a patchset for CCL that doesn't spawn a separate thread for tty interactions, but it's not maintained anymore
4:20:14
jasom
ealfonso: there are several, each with different strengths and weaknesses. I usually just write directly on top of clack because I'm a control freak.
4:20:46
PuercoPop
LdBeth: you might be interested in cl:ed, http://www.lispworks.com/documentation/HyperSpec/Body/f_ed.htm
6:00:15
edgar-rft
iqubic: some mac-specific GUI stuff, see https://en.wikipedia.org/wiki/Cocoa_(API)
11:53:13
light2yellow
what is the official name of standard library? the one which contains e.g. cons, car, cdr functions
11:54:06
light2yellow
or is it being put like "the implementation of the dialect should define blablabla"?
11:56:10
jackdaniel
any conforming implementation must have these two packages and symbols defined in the standard
11:56:19
light2yellow
I also find it hilarious that ANSI publishes a "standard", and then sells it for money. how is this a thing? same with C
11:57:30
jackdaniel
I don't understand many things as well, but texinfo sources are public domain and there are freely available standard resources build from them
11:58:57
light2yellow
"I will publish a standard, proclaim one to be so, but make it closed-access so that..." what? I doubt they earn any money, that's firstly, secondly, why are you called ANSI, you should be a non-commercial org
11:59:39
light2yellow
yes, of course, finding it or downloading from speacial resources is not an issue
12:05:36
edgar-rft
light2yellow, the "Common Lisp Standard" already includes the standard library. The symbols of the standard Libary there are called "the symbols in the COMMON-LISP package".
12:09:35
theemacsshibe[m]
ACTION funcalls set-difference with jackdaniel's answer and the perfect one -- keeps getting NIL
12:11:07
devon
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-9.html 1.9 Symbols in the COMMON-LISP Package
12:11:57
light2yellow
jackdaniel: I wanted to hear what is understood under standard library in CL, in more or less official form, since there's no such term as "standard library". now I know that there are packages, and COMMON-LISP is the standard package (i.e. not technically called "library"), and that is where standard "symbols" are defined. that's what I wanted to know
12:14:03
edgar-rft
the full bureaucratic story is here: http://www.lispworks.com/documentation/HyperSpec/Body/01_e.htm
12:20:07
edgar-rft
AFAIK sympols are imported, not inherited. So it's a matter of importance, not inheritance :-)
12:20:07
light2yellow
now, another question. is it up to implementation and/or interpreter to define what cons (as a function: http://www.lispworks.com/documentation/HyperSpec/Body/f_cons.htm) yields? for example, (cons 1 nil) => (1) -> a list, okay. (cons nil nil) => (NIL) -> same as (), an empty list, okay. (cons nil 1) => (NIL . 1) -> so, specifically a dotted pair. I know that cons is a dotted pair and a list is implemented
12:20:09
light2yellow
using cons, but won't it break somewhere if I was to pass it somewhere else, something that expects a list - since this is not a list, because a list ends with nil
12:21:51
Xach
light2yellow: in some cases it is specified that something will error if the object is not a "proper list"
12:22:01
theemacsshibe[m]
A list is just some nice conses where each CDR is just more of the list or nil
12:22:37
theemacsshibe[m]
List recursion like mapcar and loop .... in will fail because the final cdr isn't another cons, saying it's not a proper list.
12:25:06
light2yellow
regarding first part of the question, is it up to interpreter's pretty-printer to show me either a list, or a dotted pair, or does it show me exactly what objects will be yielded and passed?
12:27:27
theemacsshibe[m]
I believe implementations have to make a fancy list printout if possible, dotting the last cdr if needed.
12:30:53
theemacsshibe[m]
Also what books can I give GNU_PONUT to learn Lisp? They know some C(++) and Python already.
12:31:21
Xach
light2yellow: that is why '(defun foo () bar) at the repl prints as (DEFUN FOO () BAR) and not (DEFUN FOO NIL BAR)
12:31:38
Xach
theemacsshibe[m]: i like practical common lisp and paradigms of ai programming, both available for free.
12:33:32
theemacsshibe[m]
I see. I've finished PCL and started Norvig's works, and they're great, but idk how accessible they are for people used to algol syntaxes.
12:35:44
Xach
it takes time to get used to new syntax no matter what. some people take less time, some more.
12:36:54
light2yellow
so, then I guess interpreters will yield a list if car of the last cdr of the last list cons is nil
12:38:57
Xach
light2yellow: i don't really understand what operation you mean by "yield" or "return" - if the data structure exists, it exists.
12:39:42
Xach
what happens with a list (whether proper, dotted, or circular) depends on what you try to do with it.
12:39:46
theemacsshibe[m]
Also, reading A Gentle Introduction to Symbolic Computation made me see NIL technically isn't (NIL . NIL) since NIL is just a symbol with odd traits
12:40:08
jackdaniel
yield is usually used in coroutine context, it is more related to execution than returning anything
12:42:02
splittist
light2yellow: the 'interpreter' is doing three things: reading, evaluating, and printing. It might be easier to think of them separately. The reader returns an object or signals an error, for example.
12:43:27
jackdaniel
lisp code may be interpreted, most implementations do at least minimal compilation though
12:44:01
theemacsshibe[m]
CLISP (is dead, and) interprets bytecode. It's not very fast and does type checks all the time, so it seems interpreted basically.
12:44:20
phoe
theemacsshibe[m]: not actually dead, it has some recent commits although it does not have a recent release
12:44:20
light2yellow
jackdaniel: yeah, actually, true. I remember reading smth on this (regarding C interp)
12:45:13
jackdaniel
also clisp does a lot of optimizations before it produces bytecode (and it has jit infrastructure etc etc)
12:45:49
phoe
theemacsshibe[m]: a lot of the CLISP friendliness comes because it comes with readline bundled
12:45:50
jackdaniel
I would think twice before calling clisp an interpreter, but sure, lines are blurred at some cases