freenode/#lisp - IRC Chatlog
Search
9:26:53
beach
nullx002: What is the reason for your question? I am asking because you seem to be new here. I don't recognize your nick.
9:28:29
nullx002
yes, using bit of lisp and emacslisp for few years, but nothing special. was off the grid for 3 years..
10:16:39
pyc
how can I get the "CL-USER>" prompt that I see in most documentations. If I run CLISP I get only "[1]>" prompt and SBCL gives me "*" prompt. Where does "CL-USER>" come from?
10:18:53
beach
pyc: Unless you use something like SLIME, programming in Common Lisp is going to be very painful, and you will be disgusted and abandon it.
10:19:43
pyc
beach: why is that? I have been writing standalone .lisp files and executing them as "clisp foo.lisp". Seems to work just fine. Not much different from Python or C.
10:20:35
pyc
beach: can you explain why you would be disgusted? Maybe as a beginner I don't realize why my way of doing Lisp is suboptimal.
10:21:01
beach
I guess if you are used to inferior programming languages, you don't know what you are missing.
10:21:07
pyc
drbluefall: Which one is more popular between SLIME and SLY? And for what reasons would one recommend SLY over SLIME or vice versa?
10:22:17
beach
pyc: In Common Lisp, you develop code interactively, one definition at a time. You often compile top-level forms immediately after you type them.
10:23:04
beach
pyc: You often switch between the code and the REPL to test a single function after you typed it.
10:23:20
pyc
beach: thanks! I will stick to SLIME then. I tried SLIME once briefly but did not know enough to be able to realize its usefulness.
10:24:56
Nilby
pyc: In CLisp you can set the prompt with the custom:*prompt-.. variables, e.g. (setf custom:*prompt-start* "foo")
10:26:27
pyc
beach: yes, thanks. that is convincing enough. i will stick with SLIME and learn it more.
10:29:00
beach
Well, I guess it sort of is, if you count realizing a wet dream by an incompetent hacker without training.
10:29:47
beach
Oh, and convincing incompetent management about what programmers to hire, and what language to use for the next project.
10:30:18
carkh
i remember reading a blog post about some company that couldn't get out of cobol because of its outstanding decimal numbers processing
10:31:26
drbluefall
Like, say when it comes to web, I will be the first to admit that I will sooner reach for Rust
10:33:04
carkh
yes, i think i'll stick to clojure for the web, rust is annoyingly low level for that kind of stuff
10:35:07
carkh
that borrow checker gymnastic seemed annoying to me. Though i can see how this is all usefull for low level work
10:38:01
drbluefall
For me, the draw was more the ecosystem than the language itself (although the language felt much nicer than what I was using before).
10:39:05
carkh
that's one thing missing here, a competent packge system (even if quicklisp is a big step in the right direction)
10:40:35
drbluefall
quicklisp I find usually sufficient, although something akin to cargo would be absolutely *amazing*
10:41:57
drbluefall
I think the most painful experience with packages and dependencies was in C/C++.
10:42:59
moon-child
the main essential complexity with c is that they tried to make dynamic linking work. Dynamic linking is a really nice idea, but it's proven itself to be unworkable
10:44:40
beach
moon-child: Dynamic linking was the norm in Multics and it worked great. The problem you see are very likely due to the fact that Unix imposes a programming model that makes the process look like the naked machines from 70 years ago or so.
10:46:59
beach
I was horrified when I learned about Unix-style dynamic linking in the book "Linkers and Loaders" by John Levine.
10:47:33
jdz
Nilby: And also multiple return values. That way code is much easier to update without breaking existing users.
10:47:35
kevingal
I miss virtual environments from Python, though I guess that's not something that's missing from quicklisp.
10:48:52
beach
marcoxa: Unix was meant to mimic as many features as they could from Multics, but on a very small PDP machine at the time. I guess they managed to use `ls' and a few more things.
10:50:00
beach
I am not in favor of a return to Multics, because it had similar (but not as severe) address-space limitations as 16 or 32-bit machines do. But we can do better now.
10:51:06
drbluefall
Admittedly I'm not entirely familiar with Multics, since it seems to be entirely before my time
10:51:14
beach
By the way, the Common Lisp condition system was largely inspired by that of Multics PL/I. All other languages seem to have forgotten about that.
10:51:56
beach
So the exception-handling of most languages is indeed inferior to that of Common Lisp and Multics PL/I.
10:52:41
beach
Or else, you will think that what we have now is the greatest thing since sliced bread.
10:54:37
drbluefall
I intend to double down on CL and Rust, since both appeal to me in their own ways enough that I want to invest time in both
10:55:39
beach
carkh: I said nothing about being an "expert". But it is important to know what we had and that was lost in favor of the truly inferior stuff we are forced to use today.
10:55:41
moon-child
drbluefall: rust is mostly ocaml and c++, with bits of cyclone and clean mixed in. Not worth the effort. If you want to learn about the interesting things in rust, I recommend ocaml and ats
10:56:40
carkh
beach: i think it might depend on your goals, i can see how you may be interested, due to your endeavours
10:57:42
beach
carkh: Oh, it definitely depend on your goals. Like if all you want is to make money by doing what everyone else does while being ignorant of what we could have, then sure, just use the tools you need.
10:58:34
beach
carkh: Luckily, I find that Common Lisp programmers often want more than that, and that's why I like to hang out here in #lisp.
10:58:43
drbluefall
Like, other languages may have features that Rust also has, but it ain't just the features of a language that matter. It's also the experience developing in it
11:00:20
kevingal
Speaking of history, I read this the other day: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html
11:01:39
kevingal
It refers to an Altair emulator that lets you enter a program using virtual switches.
11:01:40
jackdaniel
I've wanted to learn rust some time ago, but my "Hello world" program still compiles ;)
11:23:36
marcoxa
I wasted a lot of ti.... er, had a loto of fun with those the past year. Hey. I learned JCL :)
11:23:39
beach
So, according to Land of Lisp, page 40, if you type (cons 'pork (cons 'beef (cons 'chicken ()))) to the REPL, it would be "perfectly correct" for the REPL to answer (cons 'pork (cons 'beef (cons 'chicken ()))) in addition to (pork beef chicken).
11:26:20
marcoxa
beach: as I said, it has been fun. I also veered off a tangent and wrote the missing JCL mode for Emacs :)
11:27:44
marcoxa
beach: I am sick. I know. https://within-parens.blogspot.com/2020/12/iron-handling-with-emacs-lisp.html
11:29:55
jackdaniel
I'm not reprimending anyone, I was just curious if we've reached this point of the year when this discussion theme starts another cycle!
11:37:20
kevingal_
Are you planning to get a job programming mainframes? The thought crossed my mind when I read those articles about the lack of COBOL programmers.
11:49:12
marcoxa
Let's say that I am in the right age group to apply for a COBOL programmer position :) I do have other plans though :)
11:59:16
kevingal_
I had a little daydream about walking through air-conditioned halls and learning the secrets of the mainframes from the ancient sages. But maybe I'll try out this emulator instead, haha.
12:03:22
rogersm
folks, any recommendation on changing Common Lisp colouring in emacs? After some time using the standard emacs colours I would like to try something different.
13:01:22
marcoxa
kevingal I can be your guide, but only to point out the dangers, not to fight them :) Plus, you will need a button down shirt (white), thick rimmed glasses, a skinny tie and, above all, some pens in your shirt pockets. Dilbert is an amateur.
13:04:51
marcoxa
Check this out: https://www.reddit.com/r/emacs/comments/kgw96j/experimental_command_prompt_in_the_header_line/
13:07:54
jmercouris
backtrace just reveals: 0: Foreign function gsignal, pc = 0x7fbf3cdcf08a, fp = 0x7fbf19cf7778
13:15:09
jackdaniel
I personally usually print these numbers and add put it in my "do not use cffi" archive files
13:32:12
pyc
what is the difference between Quicklisp and Roswell? when would one use one vs. the other?
13:34:27
jackdaniel
roswell is a set of C programs that is meant to help you manage local lisp installations and such
13:35:04
jackdaniel
quicklisp is a program that lets you download libraries and load them in your running image
13:39:34
pyc
is it possible to have multiple parallel quicklisp installation to separate the dependencies of one project from another?
13:41:24
jackdaniel
I think that the funciton quicklisp-quickstart:install has a keyword argument that allows you to specify the path
13:55:14
pyc
here is one thing that confuses me. I want to keep a list of words in my program and I will iterate on those words and do stuff. Those words could be IDs of some table entries or lookup keys or anything else. Should I define them as (defvar *keys* '("title", "tag", "author", "date")) or should I do (defvar *keys* '(title, tag, author, date))?
14:08:06
Xach
beach: the tex source code is quite easy to read, but it would be a bit easier if rendered. is there a PDF or other rendered version available?
15:00:44
Xach
beach: I like your point about grammatical vs. idiomatic. Do you view idiomatic as implying a unique result? Is it improper to say that there are multiple idiomatic solutions for a given problem?
15:01:24
Xach
One challenge of establishing style seems to me to be choosing between multiple arguably-valid choices, and I'm not sure that those choices are appropriately labeled "idiomatic"
15:03:36
beach
I believe that there could be multiple idiomatic solutions. But I can't think of any such cases right now.
15:05:23
beach
And, sure, there are often several choices possible, and it may be that there is no particular idiom for the situation in question.
15:05:40
Xach
Hmm. I am thinking about resolving differences like preferring to use keywords for LOOP grammar vs. not, where the result really seems to be a matter of the weight given to each advantage and disadvantage.
15:06:34
beach
Yes, in this case, I have no particular opinion myself, other than that I choose one over the other. I won't reject code written in the other style.
15:06:35
Xach
Your examples illustrate well the obviousness of how some grammatically valid things are just obviously wrong to a native speaker
15:08:13
beach
Xach: Let me put it this way. If I write a book myself, I would use consistent choices in the entire book. But if I am the editor of a book where different authors are in charge of different chapters, I find it normal that the choices can be different in different chapters.
15:08:56
Xach
beach: Interesting! What if you are at a company and every area of the code may have many different authors over different time periods?
15:09:01
beach
If a "module" is written by someone other than me, it is normal that this code looks slightly different from mine in situations where no particular idiom is called for.
15:09:51
Xach
There is also the issue of "what should a new author do?" where they may not have established preferences to impose
15:09:59
jmercouris
I think as long as the code is cleaer, and each module has a clear API boundary, it can be in whatever style it wants
15:10:18
Nilby
I think there certainly a parallel between code and natural language writing style and style guides.
15:10:35
jmercouris
Except that I don't think writing and reading code is like writing and reading books
15:11:08
beach
Xach: Again, I think there are "idioms" that should always be followed, and "personal differences" that can in fact be interesting, in that you can see who wrote a particular module. Within a module, it is preferable to keep a single style I would say.
15:12:07
beach
jmercouris: I won't accept contributed modules for SICL with any style that does not follow what I consider idiomatic Common Lisp.
15:13:20
jmercouris
now, if you have leaky abstractions, lots of shared state, or a bad API, this approach is not feasiible
15:13:50
beach
Xach: There is another chapter, chapter 32, that is more detailed and perhaps more for newbies and more for SICL. I wrote chapter 31 to be more general.
15:14:27
Nilby
You can have two excellent authors with quite different but good styles, but the average person's style might be pretty bad and could use to closely follow guides.
15:17:35
beach
jmercouris: Natural languages and programming languages do have a lot in common though, like the language-specific idioms I wrote about in chapter 31. And also something that most programmers who have never worked in a team seem to ignore, namely that both are meant primarily as a means of communication between people.
15:17:58
jmercouris
I would argue that programming languages are primarily a means of communication between an individual and a machine
15:18:02
beach
jmercouris: You don't have to look very far back in the #lisp logs to see opinions in that direction.
15:19:08
jmercouris
we could all use engineering diagrams, which /ARE/ meant for communication of such ideas
15:19:24
jmercouris
whereas we all understand the language we are programming in, hence why we use it to convey these ideas precisely
15:19:54
jmercouris
I will note that most pseudocode examples are just that, a pseudo language designed to mimic programming languages for the purpose of conveying information amongst programmers
15:20:06
jmercouris
the key difference here is that these set of programmers do not share a lingua franca!
15:20:46
beach
jmercouris: Look, let me say this again for the nth time: I am not smart enough and not knowledgeable enough to make up my own ideas about programming, so I rely on established literature, smart, knowledgeable, and experienced people who have already done it, and who mainly agree with one another.
15:20:51
jmercouris
I'm not sure where I'm going with this other than to say that I think programming langauges are to make it easier for the programmer to communicate with the computer, not with each other
15:21:26
jmercouris
beach: I understand the appeal you are making, but I have a lot of ideas that disagree with people much smarter than me
15:22:46
beach
jmercouris: The programmers who don't share the same ideas about grammatical vs idiomatic phrases with these smart, knowledgeable, and experienced people i am referring to, are precisely the programmers who write code that will waste a lot of time to the maintainers.
15:23:19
Xach
beach: To some degree. I think there's an interesting difference between volunteers, students, and employees when it comes to contributing to a shared code base.
15:24:58
Nilby
If you are primarily communicating with the machine, you could just write assembly, like the lovely 124 line PDP-1 Lisp GC in assmebly.
15:25:06
Xach
beach: I'm thinking specifically about how an employee will do something they slightly disagree with because they are paid, and students might do it because someone in authority seems to know better, but volunteers can be more likely to simply stop volunteering.
15:25:34
jmercouris
Nilby: you will have a hard time communicating with the machine, in my opinion programming languages are an attempt to make machine language closer to our language, so we can talk to them more easily
15:25:38
beach
jmercouris: And let me also say this for the nth time: If you keep your code to yourself, as far as I am concerned, you can use whatever style you want, following whatever personal ideas you like, but if you expose your code for others to read, like if you ask for help, it is very impolite not to follow these idioms.
15:27:18
beach
jmercouris: Well, the way it should work then, is that when you submit code that violates these idioms, and this is politely pointed out to you, the right answer is to fix your code, and not argue that you can do whatever you please.
15:28:58
beach
Xach: Sure, difficult issues. Especially since the authority (employer, teacher) may not be knowledgeable enough to know the difference between grammatical and idiomatic phrases either. In fact, that's probably rather the rule than the exception.
15:31:29
beach
"Please look at my code and give me help, even though I don't give a damn about respecting the rules that will make it easy for you to understand my code, so please spend 10 times as much time as you should have, just because *I* don't care."
15:32:16
Xach
"i have to get this done for an assignment and after that i will never use lisp again"
15:35:34
jmercouris
and I am wondering how to make it like flet to allow the declaration of several functions
15:35:56
beach
As we recently discussed (me and ebrasca) in #sicl, the reason many programmers don't know the distinction between grammatical and idiomatic phrases is that they do not read other people's code.
15:36:37
jmercouris
that's true, I ready very little code outside of algorithmic snippets in my studies
15:36:45
beach
So how can they tell the difference? It would be like a novel writer who never read books by other authors.
15:37:50
beach
I for one would very likely not appreciate a novel by such an author, much like I don't appreciate the code of someone who has not figured out the idioms.
15:39:19
beach
Again, like I said in #sicl, my (admittedly small) family studied English literature at the university, and they had to read a novel per week as homework assignment.
15:40:29
jackdaniel
people who do not study often read in this pace (if they have 1h a day for that), doesn't seem excessive to me
15:40:38
ldbeth
I just find that sometimes I'm mimicking idoms from other programming languages when I'm rewriting CL
15:41:30
lukego
Hey I want four variables bound to fresh hashtables but I'm not willing to spend four lines of code on let clauses. What's a less crappy solution than this? (destructuring-bind (left right top bottom) (mapcar #'make-hash-table (iota 4))
15:41:54
Xach
but using idiomatic "foreign" phrases with literal translation is a good recipe for confusion
15:41:56
beach
Xach: I used "accent" when I explained this phenomenon to my students. It's a fine use of the word.
15:42:24
beach
ldbeth: We are talking about chapter 31 of http://metamodular.com/SICL/sicl-specification.pdf
15:43:47
lukego
jackdaniel: yeah so what's the fantastic third option that we're not talking about? some great macro in serapeum or something?
15:44:11
Xach
jackdaniel: being monolingual, i can't think of specific examples off the top of my head :(
15:44:42
Xach
jackdaniel: but locally, if the roads are very icy, someone would clearly understand me if i told them "it's just like a bottle outside" - and i don't think that would carry the same meaning if literally translated.
15:45:15
Xach
i suppose the term is idiom, but in a slightly different sense that we have discussed so far
15:47:45
lukego
(Speaking of "accents" I'm basically trying to write (1 to: 4) collect: [ Hashtable new] but in Lisp rather than Smalltalk)
15:53:40
lukego
jackdaniel: yeah. well I already wrote them out by hand, but now I'm rewriting this file for clarity because it got too confusing, and I'm not wild about writing them four times by hand twice :)
15:56:33
ldbeth
"Consider the use of locks to be free. We predict that a technique call 'speculative lock elision' will soon be available in all main processors."
15:59:55
jasom
And it was actually slower than non-speculative if there was a conflict (and conflicts included system calls and interrupts)
16:08:43
lukego
and behold! my cleverly refactored version of the program is incomprehensible and the unrefactoring commenceth
16:14:46
ldbeth
beach: ah, conditions! and of course I can continue reading from the condition handler in CL
16:14:55
Alfr
jmercouris, wrt your flet question above, you may want something like this: https://dpaste.com/FGS5HW5GK
16:15:21
beach
ldbeth: I use sandboxing on a daily basis. SICL code is executed in a first-class global environment represented inside a host Common Lisp implementation.
16:23:56
lukego
Hey what's a neat way to do some final tests on a functions' return value? like I have (calc-foo) and I want (let ((foo (calc-foo))) (check-foo foo) foo) but less verbosely? just do (check-foo (calc-foo)) and make check-foo return the value too? or is there a "prog1" type mechanism that I'm overlooking?
16:24:02
pyc
I am creating some data records hard-coded in the source code. I have to ways to define each record: (1) (list :name "alice" :age 30 :city "london") (2) '(:name "alice" :age 30 :city "london"). Which one is preferred? Are there are any best practices or pros/cons around it?
16:25:25
Bike
lukego: no, that's pretty much it. that's why a lot of for-effect functions in the standard return their argument, like initialize-instance
16:25:37
beach
pyc: What Bike said, but also, I would not use lists for stuff like that. I would use standard objects instead.
16:25:53
lukego
Bike: okay cool works for me, just a bit rusty and wondered if that was more of a Smalltalk'ism than a Lisp'ism.
16:27:13
lukego
Hey - me again - what's the significance of SLIME coloring "check-" functions in a different font-lock color?
16:27:24
pyc
beach: You man objects from CLOS? I haven't learnt that yet. Let me look up a tutorial.
16:28:18
lukego
Bike: okay. So since my function is basically being called for the side effect of signalling an error or not then I guess I should embrace this and keep check- in the name
16:28:39
beach
pyc: Many people call them "CLOS objects", but in fact every Common Lisp object is the instance of some class so that term is meaningless. That's why I used the correct term "standard object" which is what you get when you instantiate a class defined by DEFCLASS.
16:30:06
beach
pyc: You can use lists for now, but what I would do then is to define specific accessors, defined in terms of FIRST, SECOND, etc. And then use the accessors in your client code.
16:31:55
pyc
beach: okay, since I am still learning I will just use lists to play with Lisp right now. It will take me a few days to learn CLOS, so I will follow your advice then.
16:32:37
beach
pyc: Sounds good. If you do that, you can change the implementation easily when you feel more comfortable with CLOS.
16:50:30
lukego
Couldn't resist rolling a macro (check (calc-foo) (check1-foo _) (check2-foo _)) I'm on a bad-takes roll today
16:52:32
lukego
mostly because when I'm hacking away at the REPL I'll often call the callee directly but still want to know if the checks fail
16:53:03
lukego
which I guess is a way to say that the checks belong in the callee i.e. they say whether it is producing well-formed output (independent of the context of the caller)
16:55:19
lukego
Sorry if I've asked before but any happy users of check-it? I'm thinking about trying to use it for all of my testing, even though that seems a bit of an uphill battle, in case it forces me into some kind of a productive design-for-testability mindset. but I dunno if tears await
17:00:08
lukego
(Thank you all for your patience with my thinking aloud thoughts best kept to oneself kind of evening...)
17:12:34
warweasle
A long time ago, before the first Iraq war, there was a DARPA project that used lisp to predict fuel logistics to help with planning. Anyone know more about this?
17:17:00
warweasle
I read that it saved enough money to pay for all the previous DARPA projects up until then.
17:26:44
pyc
We can make a hard-coded list of records like this: (defvar *records* '((:name "alice" :age 30) (:name "bob" :age 31))). But what if I did this: (defvar *records2* '('(:name "alice" :age 30) (:name "bob" :age 31))). Will the second one lead to any problems in practice while further programming?
17:27:23
pyc
We can make a hard-coded list of records like this: (defvar *records* '((:name "alice" :age 30) (:name "bob" :age 31))). But what if I did this: (defvar *records2* '('(:name "alice" :age 30) '(:name "bob" :age 31))). Will the second one lead to any problems in practice while further programming?
17:28:08
pyc
Is the second one that has quoted list inside quoted list uncommon in real world Lisp programming?
17:47:19
pyc
Please provide advice on proper coding style: https://plaster.tymoon.eu/view/2314 From code I have seen I think *records2* is the right style. What about the other two styles? Are they outright unacceptable?
17:49:32
pyc
Josh_2: beach: thanks. so my suspicion was right. I guess I have to get used to this style. I was tempted to put some whitespace to demarcate each record clearly but looks like that's not the style.
17:49:52
pyc
It appears to me that the correct style is to treat the parentheses as invisible. As if the parentheses are just not there, so not worry about them at all.
17:50:42
beach
pyc: Open pretty much any good book on Common Lisp and you will see that these rules are followed.
17:51:28
pyc
Josh_2: yes, but the first record is still attached to the opening '(. I was trying to demarcate that too but looks like that is not a good idea as per coding style.
17:53:10
pyc
beach: you added "well, *almost* never". What is a situation where '(' has a following whitespace or ')' has a preceding whitespace?
17:55:07
pyc
Is there any Emacs/SLIME/Paredit command to take the ugly style of *records* or *records3* at https://plaster.tymoon.eu/view/2314 and automatically reformat them in the *records2* style?
18:07:53
warweasle
I read a study by NAVSEA about comparing various languages. Lisp seemed thrown in as an afterthought and it seemed like they were pushing for Haskell. The Lisp programmer showed up late and then cranked out the code in a few hours and would have won the competition IF they thought lisp was a viable language.
18:39:42
markasoftware
If :lambda-list is passed to ensure-generic-function, and an :argument-precedence-order was previously set, is the argument-precedence-order discarded?