freenode/#lisp - IRC Chatlog
Search
11:15:56
scymtym
the function CL:READ is for reading Common Lisp code from a stream. also, READ only reads a single form, not everything in the file
11:18:00
scymtym
you can use CL:READ-LINE to read one line (as a string) at a time. there is no builtin function to read a whole file
11:18:46
minion
shangul: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
11:18:50
minion
shangul: please see gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
11:20:35
scymtym
i don't know anything about it personally, but it is often recommended here to people without programming experience
11:21:20
scymtym
shangul: i have to go to a meeting now. good luck and maybe give ALEXANDRIA:READ-FILE-INTO-STRING a shot
11:24:01
minion
Do you like banana: An error was encountered in lookup: Parse error:URI "https://www.cliki.net/Do you like banana?source" contains illegal character #\ at position 24..
11:28:40
minion
do you encode your%3f inputs: An error was encountered in lookup: Parse error:URI "https://www.cliki.net/do you encode your? inputs" contains illegal character #\ at position 24..
12:27:36
hjek
thodg: nice overview. there's not that much documentation when you follow the links to github, or on the cliki itself, so perhaps a few links to relevant resources might be good?
12:31:54
thodg
hjek: well why not but it's a big world with many operating systems conforming more or less to a few APIs
12:34:49
thodg
what is not written is that each package is nicknamed without cffi-prefix so if one day you have a posix implementation in CL the wrapper code still applies
12:43:59
thodg
hjek: what i meant is that unix manuals are available for almost all functions but you're right some documentation is due
12:46:06
thodg
i was wondering about why there are so many cffi wrappers around almost for each webserver, and i found out that the UNIX way of sorting functions in header files is good enough for most purposes
13:07:04
hajovonta
from the beginning and end of the command, definitely; and from the middle of the commands, maybe
13:07:07
thodg
lisp is very fluid so what you write can be very close to actually writing domain language in Lisp
13:13:54
hajovonta
I personally like parentheses, but soon I will demo CL for my colleagues and I want to present some simple and useful examples
13:25:46
jackdaniel
say it is a cool new language inspired by the javascript (but it doesn't work on the browser)
13:25:48
hajovonta
I don't really want to convince them, they are interested in CL already, just want to show how new syntax can be introduced, in some simple way.
13:50:12
hajovonta
i know i will have the question "what are macros good for", and I want to prepare for that specific question
13:51:26
makomo
yup. i got the question that's basically "how is this different from a higher-order function?"
13:52:04
dlowe
You know how sometimes people will write a script to generate code in the build cycle, and it's always terrible?
13:52:10
makomo
but the sorting network example is really great, you just can't do that anywhere else
13:52:37
dlowe
You can generate lisp code during compilation and make it solid enough to be awesome.
13:53:03
dlowe
There's also a macro floating around that does a string-switch with a minimum number of comparisons by analyzing the strings.
13:53:46
makomo
here's the beauty https://github.com/pkhuong/string-case/blob/master/string-case.lisp
13:55:13
makomo
you could show them the once-only macro just to freak them out with lots of backquotes and commas peppered all over the place
13:56:06
jmercouris
https://gist.github.com/8175a511534c5b08608728e1a3e56b91 any idea what's going on?
13:56:46
hajovonta
i expect the idea of pushing new definitions into a running image will be novel enough for the first time
13:58:28
hajovonta
makomo i plan to demonstrate some control execution changing macros, which is unique to lisp
14:00:02
makomo
however, i usually feel that trivial examples do a poor/bad job of explaining to people why something is useful
14:00:46
makomo
i.e. they're usually followed with stuff like "wooow, so what, why not just write 2 ifs, is that so hard?"
14:01:56
makomo
maybe at that point you should emphasize that it's about communicating intent and inventing a new vocabulary, so that the communication between people is "smoother"
14:02:07
schweers
It took me the longest time to really get macros (and there are of course still aspects of it which I don’t yet understand), but I really never understood the hostility some people seem to feel towards the idea.
14:02:16
makomo
i compare it to math a lot of times. mathematicians are great at inventing terminology and languages
14:02:19
hajovonta
Let over Lambda has some nice advanced macro examples, injections, captures, stuff like that. But I'm not sure if it can be simply demonstrated. A few weeks ago we had a discussion when we talked about closures, "they are not really necessary, I could solve all my problems without them so far"
14:03:08
makomo
hajovonta: at that point give them an example which has closures as its canonical solutions
14:03:35
beach
schweers: I can explain that. If a person has spent a significant time with a language without macros like this, they will have had to produce a lot of boilerplate code. Now, if they discover that they could have avoided all that work if they had used a language with such macros, their mind can not accept this idea.
14:03:46
makomo
shrdlu68: that's a good example i'd say. it should also be mentioned along with the RAII idiom
14:04:39
schweers
huh. so you mean I simply got lucky to know about macros before spending my career writing boilerplate code? I guess I have to think about this some more
14:04:40
beach
schweers: So the mind reacts by declaring that this feature is useless. And in fact, these people must declare it so that everyone else is convinced as well. If needed, they will go to great trouble, like ridiculing people for using macros, etc.
14:05:28
makomo
for example, in C++ it's usually implemented as an object which acquires a resource in its ctor, and releases the resource in its dtor
14:06:31
beach
makomo: And if you want to send your object to some other module that might keep it, then you have to copy it, right?
14:06:41
schweers
beach: so you’re saying that people cannot bear the thought that they wasted their life performing RAII over and over again, simply because C++ has neither macros, nor unwind-protect. Sad state of affairs. Do you have a good antidote?
14:07:03
makomo
beach: either that, or you could have just constructed it on the heap in the first place
14:07:27
beach
schweers: Carol Dweck has written a lot about it and she claims that it can be fixed, but the person must have the desire to do it, and that is already not so obvious.
14:07:57
schweers
If the person in question wants to fix it I don’t think there is a problem anymore
14:08:01
beach
makomo: But if you allocate it on the heap and then destroy it automatically, you are in trouble.
14:08:21
makomo
beach: of course. you would allocate it on the heap and preferrably use something like std::unique_ptr
14:08:35
beach
makomo: Yes, and thereby introducing a few orders of magnitude slowdown compared to a language with uniform reference semantics.
14:09:05
beach
makomo: I am always surprised by what C++ programmers are willing to accept, and they accept it thinking that it will speed things up.
14:09:11
schweers
does anyone else find the direction that C++ has taken over the last few years quite undignifying?
14:09:48
hajovonta
what I also noticed is that almost always the #1 design consideration is that the code must be fast.
14:10:05
beach
makomo: Accepting the need to copy objects or introduce smart pointers, thereby slowing things down.
14:10:23
hajovonta
when implementing some new feature, I hear it all along "aha, and this way it can be made faster"
14:11:05
hajovonta
when in fact the newly implemented code will take up only 0.1% of the total running time
14:11:50
makomo
beach: it's a language feature that came with C++11. basically it introduces rvalue references (along with the good old lvalue references) into the language, that allows one to overload functions depending on whether an object is a "temporary or not"
14:11:56
hajovonta
I cited the saying "Premature optimization is the root of all evil." and wrote it on the whiteboard
14:12:48
beach
makomo: I bet. And of course, knowing whether an object is temporary or not is not something that the programmer should be concerned about. Or even could be, in the general case.
14:12:48
makomo
beach: so in short, you can for example, "move" a std::vector, without copying any memory. the move constructor just "steals" the memory of the original vector
14:13:23
makomo
then of course you're left with "an object in an undefined but valid state" in the caller
14:13:24
hajovonta
I personally don't like to optimize the code :) I view it as a necessary bad thing
14:13:37
schweers
makomo: did you also get the impression that the explanations of what move semantics are, are exceptionally bad?
14:14:35
makomo
schweers: hm, i guess so. i spent a lot of time thinking/reading about it, "pieceing" together various bits of information
14:14:45
beach
I keep being surprised about the huge amount of trouble people are willing to go to in order to avoid Common Lisp.
14:15:13
schweers
magic may really be the right term. It is claimed to be awesome, but not explained
14:15:18
makomo
in reality, it's just another type within the language, and the ability to overload your functions based on it
14:15:26
beach
I think that observation shows how strong the psychological forces of the "performance oriented" people are.
14:15:53
shrdlu68
beach: I see "new" languages frequently on HN, claiming to solve old problems in some new way.
14:16:49
schweers
He who does not study Lisp is doomed to re-invent it badly. He who does study it is doomed to watch other people re-invent it badly.
14:17:19
schweers
shrdlu68: which can probably be better described as: need only a very small runtime
14:18:10
makomo
beach: i just had a thought today. do you think the average programmer today would be more skilled/"smarter" had lisp been taught in every university ever?
14:19:03
makomo
or what if all of the resources and time that were spent on improving other languages were spent on improving lisp for example
14:20:00
beach
makomo: Maybe. It would have to be done right. With the current way things are set up, it could very well backfire to teach Lisp.
14:20:41
schweers
This may be seen as heresy, but I have come to think that scheme somehow misses the point
14:20:58
beach
makomo: Universities these days think that their mission is to satisify the desires of industry. The problem with that thinking is that they assume that industry knows what it needs.
14:21:35
beach
makomo: So the students get the impression that what industry requests is the good stuff. In such a setting, Lisp will not be accepted either way.
14:21:42
shrdlu68
makomo: It would probably only serve to fuel the many misconceptions about lisp. Have you noticed that almost everyone knows Lisp's reputation even before learning it?
14:22:00
beach
schweers: They haven't. The new thing is that Universities now believe it, or at least act as if.
14:22:27
makomo
shrdlu68: yeah, another assumption in my hypothetical experiment is "assuming nobody heard of lisp before"
14:22:35
beach
makomo: First, my colleagues need to understand that the knowledge of what industry needs should be acquired at the universities.
14:23:25
beach
makomo: Then, teaching would have to be conducted in that spirit. Not "here is what you need to know in order to work in industry", but "here is what you need to know so that you can improve the situation where you will work".
14:23:26
schweers
I remember that I was unhappy as a student about something or other (bad language, silly document format, something like that) on an assignment. My professor told me that this is training for use in industry. I remember thinking that it is the job of a university or college to teach students how things can be better instead of perpetuating the status quo
14:23:52
hajovonta
yes lisp has objects and the object system is implemented on top of the language without performance loss
14:25:24
shrdlu68
If anything, this "preceding reputation" is probably the primary barrier to wide adoption, because people are otherwise surprisingly open to learning (about) "new" languages.
14:27:31
makomo
well, actually the second, since i wrote the last one in lisp too, but it's a saying :-)
14:28:25
makomo
imo, we need good/"hardcore" examples of stuff written in lisp, not just toy examples that try to convince people why macros are good
14:29:30
makomo
hajovonta: that's why i think demonstrating stuff like the sorting network macros and similar is the best
14:30:00
makomo
stuff like with-gensym, once-only, etc. aren't as good because they're there as utilities
14:31:20
hajovonta
you see, generalized booleans, setf-able places, higher order functions, closures, lexical scopes, etc
14:33:01
Fade
thodg: I'm looking at the asd file for thot, and it depends on "bordeaux-queue", but that system is not illuminated by google, and it is not in quicklisp.
14:33:01
hajovonta
I plan to write some boring code which requires boilerplate, then show how to simplify it with macros
14:33:41
hajovonta
and then at the end, I will show them the advanced examples we've been talking about: cl-ppcre, sorting networks, maybe advanced concepts
14:33:46
shrdlu68
hajovonta: Do it in such a way that they won't say "But I can do that with the preprocessor."
14:34:36
makomo
maybe those are pushing it, idk. instead of aif you could showcase alexandria's when-let though
14:34:37
hajovonta
schweers: I used it for two years for automating manual system engineering work. Now I work with python, which is much less fun.
14:36:18
hajovonta
but it would be hard to find programmers who are capable of working with CL (or willing)
14:38:00
makomo
i thought about how nice it would be if he had something like make, but written in cl (and using cl for its makefiles, of course)
14:38:28
hajovonta
schweers: first I have to familiarize myself with the problem domain, and because it's a big software that we provide a testing framework for, it can take up to 1.5-2 years.
14:39:00
makomo
beach: you talk about writing a paper on bootstrapping in your LOOP talk. has that been done? :-)
14:42:01
hajovonta
schweers: companies start hiring these people now because there is a shortage on developers
14:42:38
shrdlu68
Nothing wrong with that, everyone starts somewhere and we can't all start at the same place. As long as he keeps learning and improving.
14:43:14
hajovonta
schweers: some fundamental things are missing, like knowledge of networks, databases, etc. but otherwise we are lucky because the guy is good
14:43:46
schweers
I didn’t say he isn’t, but imagine what kind of work he could do if he were not denied a proper education?
14:44:28
makomo
beach: aha. could you let me know when you release it, if you can/remember (whether it's a draft or the full thing)? :-) i find the subject of bootstrapping very interesting (both from bootstrapping compilers to bootstrapping stuff like CLOS/MOP)
14:44:38
hajovonta
schweers: he was not denied but studied something else (psychology) and then realized that developing software is his dream.
14:45:51
shrdlu68
I made a fizzbuzz challenge for interns and, of the two that tried my challenge, both had bugs in their code. University-educated.
14:46:05
beach
makomo: I would like to make more progress on the SICL bootstrapping procedure first.
15:00:22
TMA
shrdlu68: i have given fizzbuzz as a question for hiring test. university graduates (masters degree in CS) most have had errors. it was the first time i have seen float based loop from one to 100
15:11:05
schweers
Am I overlooking something or does the hyperspec not state what the default test function for MEMBER is?
15:12:21
specbot
Satisfying a Two-Argument Test: http://www.lispworks.com/reference/HyperSpec/Body/17_ba.htm
15:15:02
TMA
jmercouris: this was (at least nominally c or c++); I left the language choice to the candidates
15:18:41
TMA
shka: off by one (printing 0 to 99 instead of 1 to 100), omitting elses so that both the word and number gets printed, not testing for divisibility by 15 before checking for 3 and 5 while not omitting elses (so that Fizz is printed instead of FizzBuzz), I think there was a puts for printing numbers
15:19:21
schweers
beach: regarding performance vs perfection oriented people: do you too get the impression that our field has this problem more than other fields do?
15:20:07
beach
schweers: I do have that impression, but I think it is wrong. Probably only based on the fact that I am not so knowledgeable in other fields.
15:23:15
TMA
schweers: the hospital management requires measuring average time per "procedure" performed (where procedure is for example "chirurgically remove X") ... maybe there is performance pressure too
15:24:02
schweers
TMA: not what I meant, but yes, it is a problem. Then again, this is not the way things should be.
15:24:09
beach
TMA: Actually, it is unrelated. "performance oriented" is what I call what Carol Dweck calles "fixed mindset".
15:29:20
beach
I did not, no. I didn't "discover" them until I spent a year in New Zealand much much later.
15:31:22
schweers
I understand where you’re going with this essay, but I don’t think it solves the problem you are describing. Take a look at britain to see why.
15:31:48
schweers
disclaimer: I am biased against school uniforms on the basis that I didn’t like them as a child.
16:53:43
akkad
is there a more common solution to serializing say a hash object to a string, without resorting to so say json?
16:54:26
akkad
e.g. leveldb requries strings for the value store. and was looking for a non-json approach
16:55:54
Xach
akkad: I don't know of a common solution, but there are many possible ad hoc solutions that spring to mind.
17:19:35
jmercouris
the readme makes it seem ultra trivial: https://github.com/fukamachi/caveman#start-a-server
17:21:57
akkad
when running images remotely for any length of time, how do you do job control sort of stuff? e.g. redefine a function, and restart a thread running in the background?
17:29:03
akkad
the bt functions all seemed sort of cumbersome, and figured there must be a more job control like interface, that folks used for long running images
17:29:19
jmercouris
well, how would you control threads in lisp to begin with? https://lispcookbook.github.io/cl-cookbook/process.html
17:33:06
innovati
I'm not an emacs user, but I have heard emacs has lisp extensions and I'm _really_ curious about a scriptable editor…are there any good resources for getting started with emacs and elisp for people who are new to emacs?
17:35:34
rpg
innovati: Probably best to ask in #emacs - - you might specify that you are familiar with other lisps.
17:55:01
clintm
Is there a way to get a list of the possible conditions that might be raised from a given function in slime? I'm confident there is not but I still find nuggets of hitherto unknown to me nuggets of utility, so I thought I'd ask.
18:51:56
ealfonso
I have a long-running service that continually adds elements to an array until it eventually runs out of memory and crashes. Is there a library that provides an abstraction to a data structure with a maximum in-memory capacity and the rest backed by disk?
19:00:40
rpg
clintm Bike: I think even if we had some structure like Java, we couldn't do much, because the set of standard conditions in the spec is minimal and weak.
19:01:39
rpg
Even if you knew what set of conditions might be raised by a set of mathematical operations in SBCL, I doubt that would be at all predictive about what CCL or Allegro would do, for example.
19:02:58
rpg
I could imagine that given a small piece of code, and access to the SBCL source code, a sufficiently clever theorem-prover could compute a conservative over-approximation of the set of conditions that could be raised.
19:05:38
ealfonso
dlowe I guess this seems something similar to memory paging or caching, so I wasn't sure if there was something already available
19:09:43
aeth
ealfonso: There are ways to serialize to disk, so it shouldn't be too hard to choose one of them.
19:12:47
ealfonso
I was thinking of implementing this using a virtual array displaced to a real array of fixed capacity, with the real array periodically flushing to disk, and adding a custom handler for negative indices into the real array. I wonder if it's possible and efficient to handle a condition like this in a custom way : (aref (make-array 5) -1) => #<SB-INT:INVALID-ARRAY-INDEX-ERROR expected-type: "(INTEGER 0 (5))"datum: -1>.
19:18:31
rpg
ealfonso: You can make your own condition, which is something like "item paged out of memory," and write a continue handler that would page it back in.
19:19:13
rpg
But it sounds like you need a notion of page or something, which sort of smells like you are reinventing virtual memory. Why doesn't OS VM solve this problem for you?
19:27:27
ealfonso
rpg well, in my case the amount of memory grows continuously, and eventually the process always runs out of memory (including any additional swap space). but you're right that I could increase the amount of swap space without having to change anything else.
19:30:06
rpg
ealfonso: Before trying this new data structure, unless you need it to be portable, I'd check with your lisp implementation to see if there's a way to make it smart about paging a data structure like this. Maybe there's some way to allocate it so that the implementation will handle it well. Or I wonder if you could just make a big array that's mapped on to some block-size of individual arrays, hoping that parts of the array that aren't being used will get paged out
19:34:45
ealfonso
in my particular case, I only care about the latest 'page' being in memory since it accounts for 99% of accesses, so for my use case I don't need to worry about paging, only about not crashing due to running out of memory by periodically flushing to disk or increasing virtual memory.
19:35:59
rpg
ealfonso: Right, but we need to make sure that the lisp implementation correctly discovers this pattern of memory access. So it would help to know if the implementation will, for example, page out parts of large in-memory data structures. If it *won't*, then it might help to do the trick I mentioned above.
19:38:45
ealfonso
rpg that's right. unless I implement it manually and manually flush to disk and only keep one page in memory (which would mean all other accesses outside of latest page would be a miss, which I think is OK in my case)
20:45:51
aeth
Apple deprecated OpenGL. https://www.reddit.com/r/programming/comments/8okg5y/apple_deprecating_opengl_and_opencl_in_macos/
20:46:20
aeth
Direct link but without the emphasis on the big (to us) announcement. https://developer.apple.com/macos/whats-new/
20:47:36
aeth
This is huge. Nearly everything uses cl-opengl and cl-vulkan, the only alternative, is incomplete. Applications that wish to continue supporting 3D on macOS would need to port to Vulkan, cl-vulkan (or some other bindings), and use the MoltenVK library.
21:14:50
aeth
A slight clarification: I'm not actually sure if deprecation means removal in macOS 10.15. It just means that it *could be* removed in macOS 10.15.
21:16:44
aeth
Bike: Well, you'd have to approach it the same way if you want to ensure continued macOS support.
21:18:10
rpg
ACTION remembers "The only thing worse than being talked about is *not* being talked about..."
21:19:12
aeth
rpg: I guess on the plus side, people will finally start abandoning OpenGL 3.3 or OpenGL 4.1 in favor of either Vulkan or newer versions of OpenGL. The macOS excuse will no longer exist and the older drivers/hardware for the other OSes are fading.
21:20:01
rpg
aeth: Seems weird, but I'm kind of a 2D guy, anyway! ;-) Have you checked in with #lispgames?
21:25:26
Bike
you can iterate over hash tables with a variety of mechanisms, such as maphash; the rest shouldn't be too hard depending on your desired semantics
21:26:29
dxtr
Question #2: Are hash tables passed as copies? What I'm basically wondering is that if I modify a hash table within a function will that affect the caller too?
21:27:37
dxtr
Oh, so if I modify *anything* within a function that affects the caller too? This is an area I haven't really thought about
21:28:03
dxtr
I always try to make everything immutable but this time I'm considering if non-mutability is simply easier
21:28:41
rpg
dxtr: most things *are* immutable, but there are things like list structures (if you use nconc or the like), arrays (if you modify their contents), etc.
21:29:37
rpg
e.g. if you change a variable from one string to another, it doesn't harm the original string. It's only if you modify the string's contents.
21:32:42
aeth
What's the best way to ensure sb-ext:*derive-function-types* when building an executable with SBCL but not during development?
21:36:18
aeth
sb-ext:*derive-function-types* is normally NIL, and should normally be NIL, but when compiling an executable for SBCL for applications using my framework, it should be T. It makes SBCL assume that functions won't be redefined to change the function types, which gives more power to the compiler. i.e. Optimizations, compile-time warnings/errors, etc.
21:37:24
rpg
aeth: One way to do it would be to bind that variable around the build process for the executable. You could do that relatively easily, I think, if you were using Fare's ASDF "bundle" stuff.
21:37:55
rpg
That said, I've never used that stuff myself, except to run tests, so I'm not at all familiar with its ins and outs.
21:39:16
aeth
Oh, there is a slight complication in that what I'm doing is an engine/framework thing, so the ultimate executable will be for a system other than the systems that I am writing.