freenode/#lisp - IRC Chatlog
Search
19:55:51
pjb
stylewarning: you can check it in the sources https://gitlab.common-lisp.net/cmucl/cmucl search for process-yield and idle-loop
21:29:06
opcode
i need some help understanding car and cdr: why does (append (cdr '(1 2 3 4)) (car '(a b c d))) return (2 3 4 . A) and not (2 3 4 A)?
21:42:27
edgar-rft
APPENDing elements at the end of a list is not fast in Lisp, if you must add several elements one after the other it's often faster to PUSH to the reversed list and reverse again if finished. Alternatively you can keep a pointer to the last cell in a variable, but this only makes sense if you have really *many* of those APPEND operations on the same list.
23:47:55
moon-child
wait-process returns an exit code. I think launch-program might also do something if it can't start the command
23:50:02
irc_user
Got it, thank you. I haven't actually downloaded lisp yet but it looked interesting so I wanted to try rewriting some scripts in it. Looks like UOIP comes with it and isn't a separate lib?
23:51:03
moon-child
uiop is a general portability library. It is not part of common lisp, but many implementations ship an implementation of it
0:36:26
nij
Why do some people name their personal systems like this? com.xyz-name.system-name? Should I follow this convention?
0:36:56
White_Flame
it's to avoid collisions. Because only a few people do that, I"m not sure it's really necessary
0:37:21
White_Flame
but if you do use that, there are nicknames and package-local-nicknames that can give a shorter prefix instead of the fqdn style
0:40:40
saturn2
i'd say it's a good convention to follow if you want to publish a ton of different things and not worry too much about how appropriate they are for general use
0:41:45
saturn2
it's annoying when someone squats on a generic name with a library that's not very good
0:50:01
nij
So as my personal scripts pile up, I will have to make systems that named "nij.scripts.celebrate", "nij.scripts.wordie".. etc? Isn't this a little cumbersome? Is there a better way, like (defsystem "wordie" :inherit "nij.scripts"..)?
1:36:00
nij
Should I consider using SICL over SBCL? I heard that the former is "cleaner" without understanding.
1:43:32
martinodb
hi! i have a question. I'm trying the maiden IRC framework, so this maiden-silly agent connected to an IRC channel, but it doesn't talk to me at all. The documentation says something about activating it. Doesn't it do anything out of the box? do I have to edit the code? thanks!
1:50:27
nij
"Everything should be in a repl cuz that's the coziest place to have fun.. including the repl itself!"
1:50:41
no-defun-allowed
If you are only interested in cleanliness, then your code would be subject to the ugly parts of both SBCL and SICL.
1:54:14
mister_m
I accidentally did an infinite recursion in the repl (using slime), I'd like to stop this without killing my inferior lisp process, how can I do that from within the REPL buffer? C-c C-c doesn't seem to do anything
2:07:40
mister_m
maybe I just missed the SLDB buffer that was created on C-c C-c in the REPL buffer.
3:19:48
asarch
I did a downgrade to Debian Stable and its Emacs 26.1 has been failing to get the M-x 'package-refresh-contents' to install Slime
4:00:56
White_Flame
mister_m: if your inferior-lisp gets dropped into ldb, you probably blew the heap, or the stack twice
4:03:35
dieggsy
asarch: melpa has been odd recently. I don't use it as my package repo but I search their website sometimes and it's been extremely slow
5:09:30
White_Flame
the lack of interchangeability of different communications stream styles is a general problem, across many domains
5:11:52
White_Flame
I don't know enough for it to be a definite "no", but such situations hit me too often between other stream interfaces
6:12:26
beach
pbaille: #lisp is not really for trivial questions, but such questions are tolerated, especially if traffic is low. If trivial questions become too annoying, you may get redirected to #clschool which is meant for such questions.
6:13:21
beach
pbaille: On the other hand, some newbie questions are not trivial, and the answers to them are often worth repeating here, like for instance the semantics of function calls and argument passing.
6:18:25
pyc
Does https://plaster.tymoon.eu/edit not work anymore? I tried it many times but it does not return me a link I can share. The input just disappears after posting my snippet.
6:20:23
pbaille
I was curious about code equivalence those days. Is there any known works around that. for instance determining the equivalence of those 4 expressions:
6:21:05
beach
pbaille: That would be an undecidable problem in general, so I think you are out of luck.
6:21:07
pbaille
sorry I'm discovering IRC... the four expressions posted where intended to be after my question. all my apologies.
6:21:11
no-defun-allowed
You may reduce the first three to the fourth using substitution in this case, but generally equivalence is equivalent to the halting problem.
6:21:21
pyc
no-defun-allowed: thanks! I can see your post. I wonder why it does not work for me. When I click post, it goes back to the https://plaster.tymoon.eu/edit and the input disappears. I don't get any link I can share.
6:22:04
pyc
no-defun-allowed: are you logged into https://plaster.tymoon.eu/edit ? or did you use it without logging in? I am not logged in.
6:22:19
flip214
pbaille: you could try to use macro expansion to rewrite all expressions to a minimal subset - eg. replace LET by a LAMBDA form.
6:22:56
flip214
but then you'd still need quite a few manually defined rules - eg. the order of variables in LET can be different.
6:24:12
flip214
and you might need an expression simplifier to see that (* (- a b) (+ a b)) equals (- (* a a) (* b b)) and so on.
6:24:37
flip214
so you can arbitrarily far, depending on how much time/effort you're willing to spend...
6:24:52
pbaille
but maybe bindings can be ordered using kind of an hash of the value they are bind to
6:25:07
flip214
OTOH, I can also see an alternative way -- compile the expressions, and try to prove that the machine code gives identical results.
6:25:27
Nilby
As you may know, there are many undecidable in general problems which are quite worthwile and solvable in specific.
6:25:31
flip214
Ie. like decompiling back to C or so... that would get rid of many small differences in the sources
6:25:34
moon-child
that throws away information. It is likely to be harder to prove interesting facts about machine code than about lisp code
6:26:33
flip214
moon-child: not necessarily... at least that's a well-defined set of basic instructions.
6:26:34
moon-child
those 'small differences' are things you need to be able to handle anyway. Many of them will result from compiler optimizations, the sorts of analysis underlying which you will need to replicate if you would like to automatically prove things about code
6:27:51
Nilby
pbaille: You're welcome. I think too many time people are discorged from finding useful solutions to undecidable in general problems.
6:28:57
pyc
got some clue about the pastebin issue. When I submit in the browser's network tab I see a POST being made to this URL: https://plaster.tymoon.eu/?error=You%20did%20not%20enter%20the%20captcha%20correctly.
6:31:59
pbaille
flip214: thank you for your suggestions. I've worked on those kind of things a few months ago (in clojure), I will try discuss it with you guys a bit later. thank you
6:40:06
beach
saganman: It just barely started. I need to download some screen-recording program to my new desktop computer and record my ELS talk. What about you?
7:17:02
pyc
Is this a good coding style: https://pastebin.ubuntu.com/p/Y7Y35fwjRW/ ? What I am doing here is computing everything in (let* ...) and returning what I need as a separate expression in the end. Does it look odd to experienced Lisp programmers?
7:22:06
jdz
And I think the function should accept a string, and reading file contents into a string should be done somewhere up the call chain.
7:22:17
pyc
jdz: in that case this code will fail with error. I can definitely improve the error handling. however is my style of doing all computation in (let* ...) and then returning just that one thing I need to return in the end proper coding style? Coming from other languages, it felt odd to me, so wanted the opinion of experienced programmers here.
7:23:09
beach
pyc: Again, you can probably leave out the last binding, because the name of the function should be enough to tell what the result of it would be.
7:23:17
jdz
You could make this into a generic function, with methods on specializing on STRING and PATHNAME.
7:25:11
pyc
jdz: yes, I was considering that alternative too. Certainly the whole thing can be written without let binding. so can I assume that experienced Lisp programmers avoid LET binding whenever possible? Or is it just another alternative and both alternatives (LET or no LET) are equally valid and good?
7:29:08
moon-child
in this case, though, for the purposes of efficiency I might keep track of the position of the {{{, to avoid needing to look over so much of the string for the }}}
7:30:33
pyc
moon-child: great point! in fact I do need to ensure that I search for }}} *after* {{{ and ignore any }}} before {{{. so I do need to keep track of its position.
7:31:19
jdz
pyc: I do not favor _fewer_ bindings, but introducing them unnecessarily just create more clutter and more work for brain.
7:33:03
moon-child
naming things is difficult. The wrong name is worse than no name at all; the former may mislead, where the latter is self-evident in its use
7:33:17
jdz
flip214: Sure. But that's the thing about commenting—there's no point commenting trivial code.
7:34:02
moon-child
(self-evidence may be insufficient when the thing being evinced is sufficiently complex. But.)
7:34:11
flip214
jdz: "trivial" depends on the consumer ;) and a few weeks later the author herself might be glad about one more name
7:40:33
Nilby
When coding in a forth-like language I frequently had to comment almost every line with the presumed state of the stack.
7:42:18
pyc
an off-topic question. Can forth operators act on arbitrary number of arguments. For example, Lisp can do (+ 1 2 3) where + takes any number of arguments. It is of course possible because we can delimit the call with ). Is such a thing possible in Forth?
7:44:58
pyc
Nilby: how would the operator know how many arguments the programmer wants to add for example when there are no delimiters to specify that?
7:45:09
Nilby
A common thing with varibale arguments is to have a count or a fencepost on the arglist.
7:45:32
pyc
Nilby: say, I make a Forth operator op, and I write 1 2 3 4 5 op. How would it know if I want op to consume 2 arguments or 3 arguments or 4 arguments?
7:46:00
pyc
Nilby: by fencepost, you mean, some sort of special value I keep on the stack to mark the end of list of arguments?
7:46:59
pyc
Nilby: okay, understood. so the responsibility for that falls on the programmer unlike Lisp where the paren-based syntax itself takes care of it.
7:48:52
pyc
Oh right! That gives me ideas! Write Lispy code in Forth by using ( and ) fenceposts and defining operators to work on them. :-D
7:50:00
jdz
Nilby: How are those "fenceposts"? Aren't they just numbers (ASCII codes for the characters)?