freenode/#lisp - IRC Chatlog
Search
0:01:02
DemolitionMan
please how can I encode rfc3339 date time into nanoseconds integer 64? hanks for helo
0:44:18
MichaelRaskin
Of course, nanoseconds eat quite a bit of bits. But 64-bit number should still be able to represent entire 21st century. And 22nd too, if unsigned
0:54:07
MichaelRaskin
I mean, Unix time also doesn't run out in 2038, it's just that some systems store it in a way with not enough space for the next digit
1:22:53
Fare
MichaelRaskin, the problem with nanosecond encoding of something defined up to one-second adjustments is... what happen at leap seconds?
1:24:01
Fare
(That said... it's the time encoding I use in Gerbil's clan/utils/date.ss so who am I to cast any stone?)
5:55:38
loke
;; Compute points to plot for each element of FUN. ;; If no plottable points are found, return immediately from $PLOT2D.
6:00:20
loke
Maxima is really old code, and it's still maintained to support every Lis under the sun. They still maintain GCL compatibility.
6:33:32
blep-on-external
i've finally hit the point where i can write cl-who macros without making mistakes c:
6:34:08
MichaelRaskin
Fare: trust me, the problem also exists when you just use the number of seconds
6:35:23
ealfonso
I was told by someone here that by using cl-json instead of jonathan, I could avoid the hack of adding '("application" "json") to drakma:*text-content-types*... does that person know what cl-json method I should be using?
6:39:09
loke
ealfonso: you do somehting like this: https://github.com/cicakhq/potato/blob/master/src/potato/xkcd-processor.lisp#L17
6:42:13
loke
If the remote server doesn't use the correct content-type, you can always parse it yourself like this:
6:44:39
ealfonso
loke https://sites.google.com/site/sabraonthehill/home/json-libraries this website suggests the hack I've been using. body appears to be some kind of byte array, which "no JSON library knows what to do with it."
6:47:08
blep-on-external
on the topic of json, are there any libraries which decode to hash-maps? cl-json only encodes from hashmaps
6:52:07
blep-on-external
given that getf is symmetrical i'll just use that. thanks for the reccomendation though
7:53:57
beach
DemolitionMan: I find it hard to concentrate on the logic, because I am distracted by the unconventional style.
7:58:20
dim
beach: do you have an opinion on the https://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf document?
7:59:16
beach
dim: Yes, I follow it pretty closely. Especially page 13 where they explain how the expectations are violated in various situations.
8:01:13
beach
dim: The authors are very experience programmers and very experienced Lispers. I find it insulting when some much less experienced person claims that their advice is without merit.
8:02:41
dim
DemolitionMan: read the document I've linked and then decide for yourself, the paper is very good at explaining why it's important
8:06:12
dim
there was another document that I liked very much about programming style, from the Erlang community, which insisted on showing your intentions
8:06:55
dim
in the example they gave they ended up with mostly one-line function bodies and very long function names, and reading the code, it was pretty obvious what they wanted to happen
8:08:34
dim
oh apparently there's a whole Wikipedia entry on the topic at https://en.wikipedia.org/wiki/Intentional_programming
8:09:45
dim
oh and I wrote a Common Lisp related blog post about that in https://tapoueh.org/blog/2012/07/solving-every-sudoku-puzzle/ too ;-)
8:13:14
dim
sorry about the self promotion... remembering and finding again writings of 6 years ago doesn't happen a lot to me
8:16:25
dim
beach: yeah, I like it that I've been able to make it all by myself, but it shows and in a bad way :/
8:17:38
jackdaniel
speaking of blogging, a very interesting use of JSCL: http://blog.klipse.tech/lisp/2018/05/07/blog-common-lisp.html
8:17:54
jackdaniel
you can embed executable CL (with some limitations, JSCL is incomplete) in your blogpost
8:18:09
beach
Anyway, I find it, let's say "interesting" when people ask for help with some code, i.e. they want others to read, understand, and help fix it. But then they can't be bothered to respect even the most basic conventions about code layout and other stylistic rules.
8:18:39
jackdaniel
to be fair many newcomers fix the indentation and patiently wait for further advices
8:20:13
beach
dim: Several indentation problems: Body of MAKE-ARRAY in the first example. Argument of POSSIBLE-VALUES.
8:20:19
flip214
dim: find-position-with-fewest-possibilities: how about using (ITERATE ... (MINIMIZE ...)?) Not sure whether LOOP has MINIMIZE, too.
8:20:40
beach
dim: Useless newline after LOOP, probably because you weren't using SLIME-INDENTATION at the time.
8:21:25
beach
dim: The line starting with IN in the LOOP should be indented to show that it is not a separate clause. SLIME-INDENTATION will do that.
8:22:07
beach
dim: Use of (+ ... 1) and (- ... 1) should be replaced by 1+ and 1-. The rule is to use the most specific construct that will work.
8:22:47
beach
dim: I personally never use WITH-SLOTS because I consider slots to be an implementation detail. I use WITH-ACCESSORS instead.
8:24:38
beach
dim: The naming convention for predicates in Common Lisp is to end the name with `P' rather than `?' as in VALUE-IS-SET-P.
8:25:37
dim
beach: normally the indentation is all done with Emacs/SLIME, I rarely overrule it… in the case of the article, I wonder how much of it is a rendering issue
8:26:53
dim
https://github.com/dimitri/tapoueh.org/blob/master/content/post/2012/07/solving-sudoku.md is the source, but well, I can't suppose you'll be interested that much, thanks already for having had a look; also I don't think I'm going to fix it anyway (too many other things to do)
8:28:27
dim
I liked what pjb had to say about that, that 1+ and 1- are very good when used as function arguments, not so much for computation
8:29:59
beach
dim: If you have (- <very-long-expression> 1) you don't see that it is 1 that is subtracted until much later. So the person reading the code must "push that on the stack" until the second argument of #'- is available. If #'1- is used instead, no additional memory is needed on the part of the person reading the code.
8:31:04
beach
The same thing is true for many of the other instances of the rule "use the most specific construct that will work".
8:31:11
dim
I find it so much easier to then hack around when you have off-by-one bugs or other adjustments to make
8:32:05
dim
I feel a little stupid each time I write (+ -1...), but I thank myself each time I have to revisit such written code
8:32:35
beach
dim: Interestingly, that particular version has the same property that I just mentioned about #'1-.
8:33:18
beach
dim: I.e. once you get to the ... part, you already know that 1 is going to be subtracted.
8:34:16
beach
Many non-native speakers of English find the use of UNLESS problematic. That was the case for me in the beginning.
8:35:46
dim
unless has a special place in my mind, because I used to despise those forms in perl and I really like them in lisp, and I did need some thinking to realize that Perl allowing them after the statement is what I don't like
8:37:33
dim
LdBeth: I don't much care about avoiding nesting, let's optimize for code READING, nesting is a good hint; and if you have too much nesting anyway then just split the code into more “units” (functions, usually)
8:40:31
beach
shka: Bah, just do what I do; submit your code here for people to read. You will get ample feedback that way.
8:42:43
dim
in the past by mentioning problems I had with some pgloader code I got enough incentive to rewrite subsystems entirely, which is good already
8:44:43
dim
the new code is at https://github.com/dimitri/pgloader/blob/master/src/pg-copy/copy-format.lisp by the way, much better than before if you can believe that ;-)
8:54:01
beach
shka: Yes, that's part of the learning experience. Same thing when learning a foreign language. The most efficient way is to start talking and writing, being ridiculed, and then using that feedback to improve.
8:55:58
beach
dim: And you LOOP body is still badly indented, suggesting you are still not using SLIME-INDENTATION.
8:57:32
beach
dim: You can save one level of indentation by replacing (loop for ... (let ((<var> ...)) by (loop for ... for <var> ... ...
9:01:46
_death
dim: my imagined ELIMINATE would closely follow Norvig's, something like https://plaster.tymoon.eu/view/779#779
9:12:34
loke
I've started working on graphs in Climaxima: https://photos.app.goo.gl/XFUYNHbVyEcQKYiL7
9:18:18
beach
dim: So that makes the person reading your code think that there is some subtle difference between different clauses. Perhaps you grep for progn in some other tool, or perhaps you have a code walker that treats the PROGN clauses differently.
9:19:35
dim
I'm not sure I want to fix Emacs/SLIME display of cond clauses so that I don't have to use progn to get the visuals that help me though...
9:22:43
beach
dim: Also, I use #.(format nil ...) for documentation strings that span several lines. That way I can use the ~@ FORMAT directive so that I can align all lines with the first.
9:23:19
beach
dim: I find it very distracting to have documentation strings in column 0, and in fact, Emacs doesn't handle that situation very well either.
9:25:24
beach
dim: Oh, and you can save yet another level of indentation by replacing (LET ((LENGTH ...) (STRING ...)) (LOOP FOR... with (LOOP WITH LENGTH = WITH STRING = FOR.
9:31:32
loke
I have had a hard time finding an example (in C, even) how to draw a simple polygon using xrender
9:31:46
loke
It was easier to find one for text, which is where I started when I did the new text renderer.
9:32:14
beach
Hell, I can't even understand the protocol specification, even though I have tried many times.
9:32:17
loke
That's fine for me acutally. I had to dig into that when I was doing text with xrender.
9:32:53
beach
Good. Then it would be great to make the CLX documentation independent of the xlib and protocol specifications.
9:36:11
beach
I totally hate documentation that requires the reader to read and understand some other documentation and to do some mental translation between them.
9:36:21
loke
I'd really prefer to see a cairo backend actually. Cairo has so much stuff that I'd like to be able to use, instead of having to rebuild it from scratch, poorly.
9:38:47
loke
Looking at this paper now, which is what I need to implement the core operations using xrender: http://ect.bell-labs.com/who/hobby/87_2-04.pdf
9:44:42
loke
This is a problem for my graphs as well, since just drawing a thick line using a rectngle will create very ugly effects near the joins.
9:46:40
loke
I am, but even though I do understand a bit of sthis stuff (having done grasterised graphics effects since the 80's) but I really would like to be able to leverage existing libraries. :-)
10:00:21
beach
DemolitionMan: The purpose was not to give you a hard time, but to give you a chance to improve.
10:01:51
DemolitionMan
beach: anyway, a lot of people that wrote common lisp code for packages (even in quicklisp repository) are worse than me
10:03:16
beach
DemolitionMan: Sure, that is entirely possible. But that's no excuse to rest on your laurels.
10:04:22
DemolitionMan
beach: you know, programs have to be ready before specifications, most of the times :)
10:05:43
DemolitionMan
beach: having more time, it would be nice to talk with you about the code I posted... Seriously
10:08:42
DemolitionMan
beach: do you think design patterns are useful? Can you suggest a common lisp book on patterns?
10:10:45
jdz
DemolitionMan: this might be relevant: http://norvig.com/design-patterns/design-patterns.pdf
10:11:48
schjetne
Maybe if there was a need to rapidly on-board a large number of Common Lisp developers there would be a market for such a book.
10:14:25
DemolitionMan
jdz: are design patterns more suited for such programming languages that lacks some features?
10:17:29
LdBeth
I can’t tell a few “modern” programming languages that doesn’t support higher old functions yet.
10:21:04
edgar-rft
Common Lisp as a "programmable programming language" is a language to *write* programming languages. Therefore Common Lisp *has* no design patterns, instead you *write* design patterns with it. What kind of these design patterns that may be is *your* choice. That's a major difference to other programming languages.
10:24:37
DemolitionMan
shrdlu68: are you still involved with colored spheres, cones, cubes and so on?
10:25:43
shrdlu68
DemolitionMan: I just picked the name coz I like that era of AI. Shoulda gone with LogicTheorist instead.
10:26:08
LdBeth
Well, then, I admit C++ sucks and don’t want to spend much time talk about it. And it might be my fault to bring that into discussion since I had some sort of foreseeing the result.
10:28:41
theemacsshibe[m]
I'm gonna port that and make a Joke<Comparison<ProgrammingLanguage>> iterator now.
10:31:32
LdBeth
We can definitely change brackets into, emm, something like two lambda symbols in CL
10:37:53
flip214
no need for all that. ASCII plus unicode has, what, about 20 kinds of parenthesis pairs? <> () [] {} «» ... enough to differentiate between LET and LAMBDA and PROGN and IF and COND and ...
10:56:55
theemacsshibe[m]
ACTION sent a long message: theemacsshibe[m]_2018-05-07_10:56:54.txt <https://matrix.org/_matrix/media/v1/download/matrix.org/jAkiWhpfZkDEgOaJTDLugnsw>
10:59:16
jackdaniel
please skip the offtopic (or move it to ##lisp which is better suited for lisp-in-spirit discussions)
11:00:17
theemacsshibe[m]
ACTION walks off the #lisp Bad Joke Night stage and sits back down blushing
11:01:02
theemacsshibe[m]
How do implementations of CL make their hash-tables? Binary trees seem like a simple solution but I'm sure there's more magic in it.
11:03:42
theemacsshibe[m]
I can't see much about IRC operators and stuff on Matrix, so what do you do around here jackdaniel? Just curious.
11:04:05
jackdaniel
it varies. I suspect ABCL uses whatever Java provides, SBCL has implementation written in Common Lisp, ECL has implementation written in C
11:05:39
jackdaniel
if you wonder whenever I'm channel operator it happens that I am (though I think I've never used the privilige)
11:07:24
jackdaniel
here is HT implementation used in ECL: https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/c/hash.d
11:16:02
theemacsshibe[m]
Does it make some kind of link to the comment? Never been on the receiving end of one.
11:16:52
foojin
At least it's not a link to an empty page with a huge wad of minified JS. Even curl just prints out the contents.
11:17:52
foojin
It's visible to everyone on the channel, right above your "My God, what have I done?" message.
11:19:24
foojin
theemacsshibe[m]: Ah, so there's a service that converts you messages made through that Matrix thing and posts them here?
11:20:49
theemacsshibe[m]
I use it for a lot of channels. I don't want to feel the wrath of jack, so I'd rather talk about matrix some other place.
11:22:12
foojin
Ok, I won't inquire further then. There are usually bots which do things like these, so that was my first guess.
11:22:49
pjb
DemolitionMan: design pattern are macros. Lisp calls them macros. cf. https://www.informatimago.com/articles/usenet.html#Object-Oriented-Programming
11:24:33
pjb
DemolitionMan: said otherwise, lisp has had design patterns (done correctly) since 1964, while people working with other programming languages had to work 30 years (with teachers, students, "research", PhD, books, editors, and so on, a whole cottage industry, working to archieve… nothing (well, something that was known since 1964, good work guys!)).
11:25:15
pjb
DemolitionMan: of course, in our capitalistic system, all this increases the GDP, so everybody is happy. In the meantime, we're still waitting on our flying "cars", and Moon and Mars bases…
11:26:07
pjb
theemacsshibe[m]: I notice that org-mode has better -to-pdf results (since it goes thru LaTeX, the output is nicer).
11:27:08
pjb
theemacsshibe[m]: I like reStructuredText, but when you write it to generate PDF, you have to add a lot of not-nice "tagging". So I think I'm converting to org-mode.
11:29:17
pjb
theemacsshibe[m]: myThing comes from perl (AFAICS). It's a convention used to denote local variables.
11:30:19
pjb
yes, this comes from C++, where variable members are often prefix with m (or sometimes _).
11:31:17
pjb
This is to avoid shadowing the members by parameters foo(int p){ _p=p; } instead of this->p=p;
11:31:53
foojin
BTW does learning design patterns give one a sort of "architectural insight" into software design?
11:31:54
flip214
schweers: pjb: pandoc can convert RST <=> org <=> Markdown etc., good enough for most uses.
11:32:11
foojin
I often find myself unable to come up with ways everything should fit together, even though I'm quite capable of writing and refactoring functions. Maybe that's one of the reasons I'm still stuck with fixing someone else's code.
11:33:24
pjb
foojin: yes, reading the GoF book is not a bad idea. But as lisper, take it as a good exercise to write the macros corresponding to each design pattern.
11:33:38
schweers
to clarify, I mean the sort of scoping that OO languages often introduce by introducing member variables into the scope of methods. Now that I’ve written this, I realize that this is nothing more than lexical scope. So ignore my question ;)
11:35:11
pjb
schweers: well this is a good question. In CL it's solved with with-slots and with-accessors. It doesn't need to be automatic. So it probably has a name.
11:36:18
schweers
well it is basically lexical scope, but then again, OO languages often have ways to clarify which foo is meant. If `foo' is a member variable, then foo may refer to something different than this.foo. or this.that.something_other.foo
11:36:32
foojin
schweers: IMO in languages like Python, where you can just add members at runtime and have them visible, lexical scoping doesn't really cut it. I think it just uses a dict there.
11:38:29
foojin
flip214: I tried to do that several times but it always ends up with me finding the result too ugly to improve. Lisp macros seem like a nice solution to my problems, so I'll definitely try to write something with it.
11:39:05
p_l
ACTION always got the feel that for supposedly hating monkey patching, python is most full of it
11:40:05
pjb
↻foo↺ ⇽foo⇾ ⎏foo⎐ ⟃foo⟄ ⦦foo⦧ ⦨foo⦩ ⫍foo⫎ there are a lot of left/right pairs in unicode:
11:52:18
flip214
and now, please do the same with UP and DOWN, so that multi-line forms like "(PROGN" and ")" can be properly framed ;)
11:53:32
pjb
flip214: notice already that there are the vertical left/right. I used them once in C programs (with compose in emacs, to substitute for {}). ︠︡︢︣︤︥︵︶︷︸︹︺︻︼︽︾︿﹀﹁﹂﹃﹄﹇﹈
11:54:01
pjb
I mean, since a lot of C style put a single bracket on a line, using ︷ and ︸ made sense…