freenode/#lisp - IRC Chatlog
Search
23:14:36
jasom
pyc: uiop has a lot of utility functions for dealing with pathnames; try e.g. (uiop:ensure-directory-pathname "baz")
23:57:24
White_Flame
any hints on which of the myriad XML libs to use, preferring a sax style of processing?
0:26:58
jasom
White_Flame: if you do need DTDs &c. CXML is by far the best (but make sure you use a custom entity-resolver if you have untrusted inputs)
0:29:07
White_Flame
a big lack in cliki is no voting/annotation about how the many libs compare relative to each other
0:30:14
jasom
I think "the number of people who read cliki and have used an XML library in the past 10 years" is probably too small for voting to be useful?
0:37:58
jasom
https://plaster.tymoon.eu/view/2319#2319 <-- whichever you decide on, make sure that this doesn't work
0:39:06
jasom
With CXML, that will include the contents of /etc/passwd in the resulting parse (but specifying an entity-resolver that always throws an error will prevent that)
0:40:53
jasom
at least nobody wired an http client into cxml, so out-of-the-box it won't let you make arbitrary http requests, unlike many other XML parsers
5:22:07
fe[nl]ix
Eitaro Fukamachi is now accepting sponsorship: https://github.com/sponsors/fukamachi
6:57:17
pyc
is there a way to check if string "foo" is in string x? equivalent to `"foo" in x` construct of Python?
6:59:56
Nilby
Don't forget to check the sequences section when looking for functions useful for strings.
7:09:29
louis771
I'm just getting starting with CL and want to do some web backend stuff with it... there is no way around his libraries.
7:10:30
pyc
i see that in some code examples, people write list and in some places people write '(). how do you decide which one to use where? For example, yesterday, Xach provided this example: (make-pathname :directory (list :relative "baz")). But I could write it as (make-pathname :directory '(:relative "baz")) too. so what should be my guiding principle to decide if I should use the list function or quoted
7:10:46
louis771
And I totally agree that quickdocs.org must be revived if CL wants to attract newbies
7:12:45
louis771
pyc AFAIK use ' for lists you won't change, use list for lists you will add/remove stuff from
7:13:18
louis771
if you use ' then the compiler is permitted to allocate l1 and l2 in a way that they share their common tail in the read-only memory
7:15:07
beach
pyc: Though you can always (and should always) use '() for the empty list if it is a form, so intended to be evaluated.
7:15:31
pyc
how do you use SLIME REPL and code buffer together? if you want to test out the usage of some CLHS functions before using them in your app code, do you go to the REPL and type trial code there, or do you type it in the source code file buffer itself and evaluate there?
7:17:47
susam
I use the file buffer itself. I almost never enter anything into the REPL directly. That way I am always editing a file. The main reason why I adopted this style of working is so that I don't have to type M-p to bring up old inputs in the REPL buffer.
7:20:43
beach
moon-child: Let me find the relevant section in the Common Lisp HyperSpec. It is very hard to find usually.
7:21:04
susam
beach: I use the same file code buffer that I am currently working on. Say there is a (defun foo () ...) and there is a (defun bar () ...) in my buffer and I am working on foo. I just use the space between foo and bar as my scratch pad. I let that area become a mess. When I complete foo, I delete all the lines in the scratch pad area.
7:22:49
pyc
interesting. let me see if I can adopt editing a file only workflow. I go to REPL often by habit. it will be nice if I don't have to switch context between REPL and file buffer so often
7:25:13
susam
Truth be told, I don't know if my style of working is more efficient than others'. I just shared what I do and it works for me. But always eager to learn better ways. I care a lot of coding ergonomics. I often wonder it would have been nice to have some sort of live coding community for CL so that I can see how others navigate their workspace, write code, manipulate code, etc. so that I can learn something from them.
7:26:41
beach
moon-child: So () is used only for things like empty parameter lists or empty lists of superclasses.
7:49:23
ldbeth
susam: maybe we can find a place to do streaming or helding regular meetings remotely.
8:01:09
Nilby
suam, ldbeth: I think it's quite useful to see how other Lispers work. e.g. check out Baggers or Shinmera's livestreams. It'd be cool to see people share their coding setup.
8:08:59
pyc
(first '(1 2 3)) returns the integer 1. But (last '(1 2 3)) returns a list containing an integer: (3). Why this inconsistency?
8:10:14
edgar-rft
first returns a pointer to the first cons cell, last returns a pointer to the last cons cell, no inconsistency
8:10:50
beach
ldbeth: You use (cons a nil) if you want to create a CONS cell where the CAR is the value of A and the CDR is the Boolean value false. You use (cons a '() if you want to create a singleton list with the element in it that is the value of A.
8:13:24
beach
ldbeth: And the fact that you see things in code (old or new) is no guarantee, because it depends on who wrote the code. As you have probably noticed, many people here don't give a damn about conventions.
8:14:40
ldbeth
beach: quite right, many people wrote these code probably learned lisp before ANSI CL
8:15:37
pyc
Nilby: I am not sure I understand the consistency. I know that '(1 2 3) is (1 . (2 . (3 . nil))). Here the first cons cell contains 1 and a pointer to (2 . (3 . nil)). The last cons cell contains 3 and a pointer to nil.
8:16:00
pyc
Yet first returns only 1, no pointer to anything. But last returns 3 and a pointer to nil: (3 . nil) which is equivalent to (3).
8:17:41
beach
pyc: It is just that LAST is more useful the way it is defined, because you can then use (SETF CDR) to add elements to the end.
8:18:54
beach
ldbeth: While you are at it, check your code for confusion between false and the default value NIL.
8:20:50
Nilby
pyc: I guess you're right. Maybe that's why I like Lisp. It seems to value programming practicality over total abstract consistency.
8:25:49
beach
I may have written something in http://metamodular.com/SICL/representing-method-combinations.pdf
8:32:22
ldbeth
beach: do you use any specific schema for implementing multiple return values in SICL? I don't find it in the current specification.
8:34:56
beach
What do you mean by "schema". The idea on the x86 is to use the unused space immediately beyond the stack pointer, plus a few registers. That turns out to be enough for the minimum limit.
8:39:19
beach
If a function that returns multiple values is inlined, then, depending on what is known about that function at compile time, some optimization can take place. Is that what you are asking?
8:43:29
ldbeth
Ah, I think mv return is a feature been overlooked, especially in functional programming languages that having nice optimization to reduce consing for currying, but still return an vector/tuple for multiple results.