freenode/#lisp - IRC Chatlog
Search
5:20:40
jeosol
people talking about optimization tend to be carried array. very impressive, I need to take a look at the stuff again.
5:21:46
jeosol
I think there are expertise littered around that can be converged which is why I mentioned the effort of the individuals involved.
5:22:19
jeosol
oh I will definitely come to ELS. I submitted an abstract for a conference in China and one due next week for a conference here. This is also the lisp work
9:44:32
beach
jmercouris: It might work with some restrictions, yes. But it would be very implementation specific.
9:44:59
shrdlu68
There are several serialization libraries, perhaps those that do binary serialization could be useful.
9:45:10
jmercouris
beach: "The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure. "Pickling" is the process whereby a Python object hierarchy is converted into a byte stream, and "unpickling" is the inverse operation"...
9:45:48
beach
Sure, you can serialize things. But that's not the same as getting the binary representation.
9:46:18
jmercouris
what is the difference between serializing to binary, and the binary representation?
9:47:27
beach
PRINT is a very good serializer. It produces output in the form of characters. If you convert those to UTF-8 as most Common Lisp systems would, then you serialize to binary.
9:47:39
shrdlu68
jmercouris: Yep, so does ironclad and most packages that deal with networks protocols.
9:48:04
jmercouris
beach: well, I am not necessarily interested in how it is represented internally, just in a way to serialize and deserialize the objects
9:48:18
jmercouris
and to take the serialized form, and be able to input it in some reserializer and create an "identical" object
9:48:19
beach
jmercouris: And, you can de-serialize with READ. But there are restrictions, just like there must be in Python. You can't get an EQ object back.
9:49:02
shka
cl-store works on lists, vectors, instances of classes, structs (for sbcl), hash-tables..
9:49:19
phoe
a human-readable text representation is a very specific case of a binary representation of an object
9:50:10
jmercouris
okay fine, I would then need to take the character representation and turn it into a binary stream of some text encoding and decode it
9:50:47
_death
in many cases, READ is unsuitable.. and serialization of arbitrary objects is often not a good idea anyway.. it's better to think about your external representation without reference to any particular programming language
9:51:52
jmercouris
I just wanted a simple way to get a bunch of bits for some representation of some thing to test with
9:52:34
jmercouris
I know about existing CL QR code libs, I might end up inventing a version of my own, but I just thought it was a cool idea
9:52:45
jmercouris
you could sort of stream a whole bunch of data in video format, to transfer more substantial things
9:53:12
_death
so you can encode the string to an octet vector, then use that to produce a QR code, and do the other way around on the side side
9:53:23
shrdlu68
jmercouris: See also: https://common-lisp.net/~loliveira/ediware/flexi-streams/doc/#strings
9:54:06
jmercouris
shka: yeah sure, there will have to be something in the protocol to show "start of sequence" "end of sequence"
9:54:28
jmercouris
it's effectively a list of 0s and 1s, at least that's what I got from the wikipedia article
9:56:13
jmercouris
beach: I'm a little bit confused, is there some way to do (print "some string") --> 0010101010101011?
9:57:12
beach
jmercouris: There is no standard way (Common Lisp or otherwise) to represent a string in binary form.
9:57:39
jmercouris
beach: Is there a standard way to represent a string in binary form in lisp given a particular encoding?
9:57:41
_death
jmercouris: so, (babel:string-to-octets "foo" :encoding :ascii) gives you an octet vector.. and you can work on it bit by bit if you like
9:58:22
jmercouris
Yeah, I'm going to do that for now, I am just trying to understand a little bit more about what beach is saying
9:58:25
beach
jmercouris: Yes, of course. In the worst case, you have a table with that encoding and you concatenate representations for each character.
9:58:39
jmercouris
Okay, I was thinking for a second there might be a built in lib or something in the standard
9:58:54
beach
jmercouris: If you are lucky, your Common Lisp implementation uses Unicode internally, so that the table is already present.
10:00:26
beach
jmercouris: In which case, you can do something like (loop for char across string do (format ... "...~b" char)
10:04:20
thoxdg
if you use char-code you usually get unicode code points which is not a binary encoding
10:07:34
thoxdg
http://github.com/cffi-posix/ http://github.com/cl-remap/ http://github.com/RailsOnLisp
10:08:31
shrdlu68
A while back I ventured into compression, and wrote an arithmetic coding implementation in CL. It appears modern lossless compression has been reduced to a statistical modelling challenge, i.e, given a stream of bits, try and predict the next bit in the stream. Is anyone interested in creating a prediction function and testing it? I could create a library that makes testing out prediction functions easy
10:11:05
thoxdg
we're only lacking in semantic data about programming languages, they even self compile now
10:12:39
shrdlu68
thoxdg: Not sure, a prediction function simply receives a stream of bits and outputs the probability that the next bit will be 1.
10:15:53
thoxdg
well if you don't represent entropy of your prediction function the model should leak entropy
10:16:01
holycow
i get the following error: Failed to find the TRUENAME of /usr/share/common-lisp/source/cl-cffi/toolchain/package.lisp: No such file or directory
11:02:20
shangul
https://apaste.info/2pWi => I tried to read contents of a file. This is SBCL. Where was I wrong?
11:12:06
shangul
scymtym, I want to learn. if you give me something that I may read more, that would fine
11:13:28
scymtym
shangul: if you know how to use libraries, you can use the function ALEXANDRIA:READ-FILE-INTO-STRING to do exactly that
11:14:31
shangul
okay, but what's wrong in my code? purpose of read and with-open-file is something else than I'm supposing?
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.