freenode/#lisp - IRC Chatlog
Search
12:30:42
dim
I have a backtrace that begins with COPY-LIST, which my code doesn't call, I'm not sure how to see what leads to COPY-LIST?
12:31:39
dim
I mean the backtrace has 0: (COPY-LIST <struct instance>) 1: (PGLOADER.CITUS:CITUS-DISTRIBUTE-SCHEMA ...), and citus-distribute-schema doesn't call copy-list
12:58:10
dim
I've spent some time on a bug that was also triggering a bug in my own print-object methods, which isn't that easy to figure out really
13:13:57
flip214
neirac: like the uppercase first character of german nouns I think it's helpful to get a quick overview.
13:15:05
neirac
beach I agree with that, I prefer highlight-sexp package in emacs instead of full syntax highlighting.
13:15:34
beach
neirac: What would be really useful would be to highlight symbols according to their roles.
13:15:46
specbot
Notes about Style for Semicolon: http://www.lispworks.com/reference/HyperSpec/Body/02_ddb.htm
13:16:24
beach
heisig: So, someone who claims to know the language well has no excuse not to follow it. :)
13:30:48
_death
I think it's OK for newbies to read an eccentric program, if that's not the only program they read..
13:35:45
pfdietz
"Then cry as you realize how beautiful their code is, compared to yours, which is so flawed, you imposter."
13:36:03
beach
Of course, it is not unheard of that inexperienced programmers dismiss the LUV slides because the advice given by these highly experienced programmers is contrary to the personal taste of those inexperienced programmers.
13:37:49
jackdaniel
if someone is strongly opposed to some "rule" then I think they shouldn't apply it. this is just an opinion (even if shared by a lot of people)
13:38:18
jackdaniel
i.e experienced programmers may say, that dynamic typing is slow and unsafe, not necessary something we could agree with
13:38:38
jackdaniel
or even following norvig we could decide to switch to python (since he is more experienced programmer and his language choice *must be good*, right?)
13:38:42
dim
those slides are top-notch advices, but I have not implemented enough discipline to follow them
13:39:16
dim
jackdaniel: he said that Python is a good enough Lisp IIRC... well we might disagree on that?
13:39:32
beach
Sure, there is this other problem that programmers who have programmed a long time are not necessarily experienced. As the saying goes, in software development, many people don't have ten years of experience. They have one year of experience ten times.
13:39:50
jackdaniel
dim: exactly my point, I strongly disagree with that opinion of a hacker known for his experience :)
13:40:27
dim
my reading was more that he had to capitulate at Google and they paid enough for him to switch to Python
13:40:52
pfdietz
Are those like 10x programmers? (which are programmers who create enough technical debt to keep 10 others busy)
13:44:26
dim
shka__: https://github.com/dimitri/sudoku and https://tapoueh.org/blog/2012/07/solving-every-sudoku-puzzle/ cover bits of it IIRC
13:57:35
phoe
I want to print a long list, but the printer inserts # in some places. What does it mean?
14:02:05
dlowe
if you want it printed nicely, you can define a print-object method specialized on your object type
16:54:05
verisimilitude
I can agree if you need nonstandard behavior you should use a library that provides a de-facto standard interface to it.
16:54:46
verisimilitude
If you adhere to the standard perfectly, you don't need to test your code and any implementation it fails on would be defective and so irrelevant.
16:56:01
verisimilitude
I thought my documentation did provide some of the history and design decisions and whatnot, so I'd be interested in more detail as to why someone would think it doesn't.
17:00:07
jmercouris
so I'm trying to print a struct to do what we'd been discussing a few days, serializing the key-chords
17:00:36
jmercouris
rather than like this: "#S(KEY-CHORD :KEY-CODE NIL :KEY-STRING l :MODIFIERS (C))"
17:04:31
beach
But then you have to make sure that NEXT package is current when you load the definition.
17:05:33
jackdaniel
if you read file with your serialized definition and package is not 'next, then it will try to read for instance cl-user::key-chord
17:05:39
beach
Presumably, you are printing this definition because you want to read it again at some point.
17:05:53
jmercouris
beach: I am not going to read it, I am serializing it to make the key to a hash table
17:06:55
jackdaniel
wait, you "serialize" a structure name to string to access the key chord in a hash table?
17:07:40
jmercouris
so what I had was a list of key-chord structs, and I was using that list as a key to a hash table
17:08:09
jackdaniel
I don't (and if you think it was me who advised you to do that I'm sure you misunderstood)
17:08:26
jmercouris
jackdaniel: it was not you, it was Xach, and he didn't advise me on that exactly
17:08:26
verisimilitude
You'd get good results serializing a hash table as a plist or alist, instead.
17:08:43
jackdaniel
structure (not string which looks like its readable representation), may be compared with EQ
17:10:12
jackdaniel
what you do sounds terribly wrong, but maybe I'm missing a context. anyway I was leaving to grocery store
17:10:53
jackdaniel
verisimilitude: it is not using structure as a hash table key, but rather (format nil "~a" structure) as a key
17:10:57
Bike
using a structure as a hash table key is fine, but in this case jmercouris is using string representations of structures instead, i think because equalp would make "e" and "E" equal when they should be distinct.
17:11:28
Bike
using a string representation is very weird, but i don't have any better ideas off the top of my head.
17:11:52
jmercouris
there was another idea of being able to use eq by binding things in keyword package
17:14:09
verisimilitude
At this point, I'd like to see precisely what you're doing for myself, if it's publicly available, jmercouris.
17:15:25
jmercouris
it just internally uses format because I didn't feel like writing an actual function
17:15:56
jmercouris
verisimilitude: https://github.com/atlas-engineer/next/blob/master/source/keymap.lisp
17:23:18
jmercouris
verisimilitude: this might be easier to read: https://github.com/atlas-engineer/next/commit/5b154b5d0bf84be587fa1a93be7c2191f4aeebb6
17:23:28
_death
jmercouris: instead write an actual function that is more careful about defining the serialization
17:24:09
_death
jmercouris: then you don't have to rely on aesthetic printing, consistent slot order, particular package being the current one, etc.
17:25:43
_death
if modifiers is a set, the order of the elements within it may also not be consistent
17:26:54
jmercouris
in the meantime, I would appreciate suggestions on how to write a better serialization function, so far I am just thinking about doing string concatentation of all of the elements into one long string
17:32:01
jmercouris
I'm sorry, I will admit, I am prejudiced, but I don't want to use a google product of any kind
17:32:02
_death
"serialization" isn't the best term here.. it's more about creating a hash-table friendly key
17:34:39
jmercouris
so anyways, anything wrong with going through the slots and just making a big string?
17:37:16
_death
jmercouris: your code indicates that KEY-CODE may also be NIL.. I meant a more detailed description.. e.g., you said that modifiers is always sorted.. I suppose (append (list key-code key-string) modifiers) would work, but there's likely a better representation
17:37:59
jmercouris
key-code is currently unused, its a reserved modifier for people who wish to bind things based on hardware key codes rather than actual characters emitted by the keyboard
17:38:47
jackdaniel
I'm asking for practical purposes (i.e what user will be able/ will want to define)
17:38:52
jmercouris
anyways, we haven't set a hard limit on it, a platform port could potentially generate an infinite amount of types of modifiers
17:38:53
jackdaniel
let's assume 16 distinct keys and all their combinations (and we are being generous here imho)
17:39:45
jackdaniel
then you may have eql key as modifiers having 16 first bits and key-code shifted by that
17:42:07
nitrix
Hi. I'm new to lisp; is the separate namespaces for functions and variables an accident or something that's desirable?
17:42:20
jackdaniel
using strings produced from structures as hashtable keys is unimaginably wrong in my eyes, so basically anything else is a progress
17:43:32
jasom
nitrix: I have a preference for it, but I don't think it's a huge deal either way. In many non-programming languages, words can be verbs or nouns depending on context.
17:44:21
jasom
nitrix: There is an aesthetic argument to being able to name a variable for which nothing is special other than it being a list "list"
17:44:31
nitrix
That's comforting. Just to add onto that, (#double 10) would interpret my 2 from earlier as a function and likely crash, correct??
17:45:45
nitrix
jackdaniel: I've seen REPLs in videos receive some kind of interrupt, nice to know that the runtime's just as cool :)
17:46:02
jmercouris
_death: thank you for the advice: https://github.com/atlas-engineer/next/commit/fc136e0d647a71b91cd59c1021228fb7d63970dc
17:46:12
jackdaniel
I think that a person who suffers most from crashes in CL implementations is pfdietz (but he asks for it himself!:)
17:46:16
jasom
nitrix: in a lisp-1 (let ((double 2)) (double 10)) will signal some sort of error, in a lisp-2 it will call the function named double.
17:47:11
jasom
nitrix: not really levels, lisp-1 vs lisp-2 is just a shorthand for asking if variables and functions have a different namespace
17:47:23
jackdaniel
Xach: didn't you want to highlight jmercouris? it is unfortunate our nicks are of the same length and start with the same letter
17:50:15
jasom
jackdaniel: so if we assume n is 1, then we are fine calling them lisp-1 and lisp-2 :)
17:51:10
jasom
jackdaniel: or arguably the X in lisp-X is answering "How many namespaces do variable bindings and function bindings exist in" in which case 1 and 2 are the correct numbers period.
17:51:18
jmercouris
just out of curiosity, has anyone in this channel tried Next since the latest release? any bugs?
17:51:21
nitrix
Last question for the moment; I get the idea that Lisp programs are themselves modifiable data structures and you're able to create/modify functions during runtime. That seems like an area where JIT compilers would excel at, specifically tracing JITs. Are there implementations that currently do this?
17:51:41
jmercouris
nitrix: I think beach is working on something with regard to optimizing this specifically
17:52:09
jasom
nitrix: that is when you (re)define a function it immediately (re)defines it on the spot, rather than JITing it when it is called.
17:53:26
nitrix
That's a bit overwhelming. The community doesn't have an implementation of choice it seems.
17:53:52
jasom
nitrix: for free implementations, SBCL is more or less on top. (apologies to jackdaniel who maintains a quality implementation that isn't sbcl).
17:54:03
jackdaniel
nitrix: do you make a fuss about that C community can't chose between clang and gcc?
17:54:03
nitrix
Means I have to do some research to know what tradoffs I'm making; or better yet, build my own :P
17:54:20
jmercouris
build your own? you don't know anything about the language yet, why would you build an implementation?
17:57:22
jasom
nitrix: also it is more proper to say that in lisp you can *only* define functions at runtime. There are some non-conforming implementations of most of the standard that compile in the way you think of C programs compiling (CLICC being a well known one), but as the spec is written, functions are defined at runtime.
17:57:33
nitrix
jmercouris: I'm comfortable writing toy compilers, but you're right that I'll be learning the language first, of course.
17:58:27
jmercouris
I don't know if you understand the magnitude of what it takes to write an ansi compliant common lisp implementation
17:58:40
jasom
writing a non-toy lisp implementation is non-trivial; I can write a faux-scheme in a day.
17:59:23
jasom
but even a basic common lisp interpreter is a massive amount of work just because of the size of the standard.
17:59:57
jmercouris
arrogance is the application of ignorance, but you are right, apologies for judging you so harshly, and so quickly
18:02:05
pfdietz
If one wants to contribute to Lisp, curating and perhaps writing libraries is probably the most useful thing one could do. Adding useful capabilities to existing Lisp implementations could also be useful, but is harder to get started on. A new toy lisp implementation? No.
18:02:32
jackdaniel
all depends on time you are willing to put in the effort. I don't see why one person wouldn't be able to build a common lisp implementations. whwnever it is a useful endavour, ditto.
18:03:01
nitrix
I think I grap the core idea about Lisp, though from what I get, Lisp is nowaday understood as Common Lisp, which is a whole lot bigger. Facilities that have been developped over many decades.
18:04:23
jackdaniel
if you decide to write a new implementation, please call it "Newly Implemented Lisp", that will be a lot of fun with commented out code
18:07:33
pjb
verisimilitude: perhaps because they didn't read it? the url at http://verisimilitudes.net/2017-12-31 doesn't provide correct Content-Type https://pastebin.com/raw/a4C72GJc therefore unassuming browsers (eg. w3m) can't display it nicely.
18:07:46
pjb
verisimilitude: and in the source code, the comment contains only a license, not the doc.
18:11:02
jmercouris
neirac: gar kein problem, you can also take a look at web frameworks to get an idea
18:11:21
jmercouris
see what they use, and you get an idea of what is good/not good, its like a shortcut, they audit things for you
18:11:43
jmercouris
however, shinmera suffers from NIH syndrome, so you'll have a little bit less luck there
18:13:07
neirac
jmercouris thanks a lot!. I'll do so, also I found this great read https://sites.google.com/site/sabraonthehill/home/json-libraries
18:14:05
jackdaniel
neirac: from my experience cl-jsown is the most performant and yason is very well designed (api-wise)
18:18:21
pjb
jmercouris: this is a very bad idea to convert anything to a string to be used as a key in a hash-table!
18:19:15
jmercouris
pjb: you'll be glad to know I take the slots of the struct and put them in a list per _death's advice rather than simply convert to a string
18:19:21
pjb
jmercouris: a lot if implementations will compute hash-values for sequences including strings for their hash tables, using only a few elements of the sequences (such as, the length, the first, the last and an element in the middle). For structures you're bound to have only collisions!
18:20:44
jmercouris
luckily, should my approach prove to be very dumb, I can easily change a single function, and voila!
18:21:14
jackdaniel
also I have my doubts if your abstraction is right if you need to have things addressed with a structure
18:21:30
jackdaniel
but it is hard to tell without looking at the code (what I'm not willing to do right now)
18:22:12
verisimilitude
Now I've gotten around to reviewing your code, jmercouris, and I agree that it needs improvement; as it stands, SERIALIZE-KEY-CHORD unnecessarily uses FORMAT and your LOOK-UP-KEY-CHORD-STACK similarly needs refactoring.
18:22:59
verisimilitude
I just use the key that converts between viewing source and displaying as HTML in other browsers, pjb.
18:23:06
jmercouris
verisimilitude: unfortunately you are looking at an old version of the code already
18:23:37
verisimilitude
Also, there is a single comment in CL-ECMA-48 that isn't the license, yes, but I always write documentation strings.
18:26:53
verisimilitude
Your SERIALIZE-KEY-CHORD no longer does any serialization, so it should be renamed.
18:28:10
jmercouris
I'm going to leave it for now, its 6:30 here, which means I'm done working for the day
18:28:58
jmercouris
and as much as I would love to play this song: https://youtu.be/zL8G5pBZ5CI?t=144
18:29:10
jmercouris
to a hollywood montage of me furiously typing overnight, I'd rather get some rest :D
18:29:26
jmercouris
verisimilitude: I would be interested in them yes, you can email them to john@atlas.engineer, and I will get to them tomorrow
18:30:41
jmercouris
pjb: interesting, feels a lot like I'm doing the job of make hash table by making a hash of the ojbect :D
18:30:47
verisimilitude
I host my own email and Google doesn't like that, so I wouldn't be able to email you if that's the case.
18:31:56
pjb
jmercouris: actually there are a few questions. Why do you keep the modifiers as a list of symbols? You could keep a small integer. Isn't there some redundancy of information between the code and the string? Why is the code NIL in the example?
18:31:59
verisimilitude
I'll make certain to email you later, then, although I may not have much to comment on the code.
18:33:03
pjb
verisimilitude: we have to show white paw to google, microsoft, etc. But the requirements are documented, we can implement them, it only takes time. Perhaps too much time?
18:34:10
verisimilitude
Good on you for not building in an arbitrary limit to your program, jmercouris.
18:34:24
jmercouris
I know its very iffy affffy and probably part of the same logic that gave us the shity cl pathname conventions, but I want to be totally "future proof" lol
18:35:26
verisimilitude
Oh; well I just don't care enough to capitulate to Google's arbitrary and changing demands, pjb.
18:35:32
jmercouris
pjb: but should someone wish to do so, they could bind based on the key code so that the key position is the same regardless of whether they are using azerty or qwerty keyboard, for example
18:35:59
verisimilitude
It's caused me some trouble, as you may know, but that just makes me more resolved to carry on.
18:39:15
jmercouris
I'm thinking about releasing it for general use by the public, but I don't think anyone would care, and they would probably want a ton more ffeatures
18:39:38
jmercouris
pjb: I'm not familiar with that syntax, does that provide some compiler optimization?
18:40:14
jmercouris
verisimilitude: source.atlas.engineer is a clone of github, why would I necessarily license it for public use? we use it internally at at atlas
18:40:16
pjb
key-code :type (or NULL integer) comes from (defstruct key-chord (key-code :type (or NULL integer)) …)
18:41:34
pjb
jmercouris: some implementation may use it to type-check the values you store in there. Some other may use it to infer typing, and optimize.
18:42:06
pjb
Safety counts more than speed: computers nowadays are very fast, and if you need faster, you use GPU or quantum computers.
18:42:58
verisimilitude
If you actually hit a memory or speed barrior on a modern machine, I think you'd need to rewrite your program to not be so wasteful.
18:44:41
jmercouris
now, before we go into this raging debate about sandboxes, it is supported in the latest release
18:44:54
pjb
nitrix: in natural languages, verbing nouns and nouning verbs is common. It is therefore normal to be wanting to allow those two namespaces in programming languages.
18:46:01
verisimilitude
I think Common Lisp would be a good language to implement a WWW browser in, entirely, but I'm far too lazy to do something such as that.
18:46:29
verisimilitude
As an example, you wouldn't need a complex JavaScript implementation; simply have a compiler that transforms JavaScript into a limited subset of Common Lisp and you're done.
18:47:03
jmercouris
if Next can make any money, then I would sponsor some projects in the CL community, and I would think really hard about whether I want to try to make a renderer of my ow
18:48:26
_death
verisimilitude: no, but there was an early JavaScript interpreter (or was it compiler?) in CL
18:51:53
verisimilitude
I just meant you could do it relatively easily and without security issues, _death.
18:52:46
verisimilitude
The WWW is an excellent example of how badly things can go wrong when there are too few implementations.
18:52:51
_death
verisimilitude: there are always security issues.. that's why I have js disabled by default
18:53:23
verisimilitude
I'd rather have something such as IRC or Gopher, where it's so easy to write clients that you can't have this happen nearly so easily.
18:53:26
pjb
And furthermore, webassembly can be translated more efficiently than normal javascript.
18:54:31
verisimilitude
The WWW is also a good example of how poorly implemented ideas get piled on to make up for deficiences.
19:40:20
zigpaw
Webassembly will usher a new-old era for software development, we'll be able to drop those reactive, semi-functional cloud-native architectures and return to old and well known monolithic application designs with backend tightly fit into a single uber-serverless-function having >200k LOC and doing all the important stuff while abandoning server-sid
19:40:20
zigpaw
e sanity checks of frontend data, cause noone sane would reverse engineer our monolithic sphaghetti ridden frontend code!) :P
20:14:09
borodust
I'm not sure if Ron is right here atm (i think im running out of apologies today), but here he is doing AMA thread atm: https://www.reddit.com/r/lisp/comments/a7156w/lisp_and_the_remote_agent/ebzkgwe/
20:25:32
aeth
You can't just write a program that simply translates JavaScript to Common Lisp because even though Common Lisp is much faster than JavaScript the resulting implementation would be much slower than JavaScript because JS is semantically designed for JIT and the fast CL implementations are AOT, with fast programs giving lots of extra hints to the compiler where that makes sense.
20:26:01
aeth
I think you would have to use runtime compilation to recompile the JS and essentially JIT it.
20:29:25
aeth
e.g. Every number in JavaScript is a double. This is very bad (and would be pretty slow with a naive translation to CL because of the boxing). So JS implementations have to know when to make something not a double.
20:36:39
verisimilitude
I figure a rather naive implementation would be more than good enough, aeth.
20:56:39
aeth
JavaScript the language was thrown together in a hurry and patched around to try to fix it ever since then. JavaScript the code you'll actually see in practice assumes a JIT implementation to be fast.
20:59:35
no-defun-allowed
Also yes, XQuartz is very laggy and only got 100 rectangles/second on the rectangle drawing benchmark.
21:00:10
aeth
Common Lisp is a language designed to be efficiently implemented. Languages like JS and Lua aren't, so you can't just do a naive translation and expect to be anywhere near competitive in performance.
21:00:31
aeth
Of course, if your only goal is to run JS, and it doesn't matter if it's 20x to 300x slower, then that doesn't matter.
21:02:47
verisimilitude
Considering that implementations of JavaScript in WWW browsers have deoptimized in order to avoid memory timing attacks, scraping the pixels of a page with CSS, and other nonsense, that wouldn't really be a bad thing.
21:27:49
eminhi_
Why does trace output print arrays, even after setting *print-array* to nil? Are they on different threads?
21:31:35
ralt
I am trying to display a PNG image in an CLX/xlib window. I've found thousands of ways to take an xlib window and save it in an image, but not the other way around. I'm not well versed enough in the png specifications to figure out how to massage a png file into the data that clx expects.
21:33:18
jackdaniel
ralt: you need to create a pixmap and convert your pixel array to the format of that pixmap
21:34:40
jackdaniel
if you want to have example which actually reads png and puts it on a screen you may look at how McCLIM does this
21:35:53
jackdaniel
but generally the idea is as follows: you load png with opticl, allocate pixmap and write data in this pixmap format as it is written in this demo
21:36:15
ralt
this whole displaying a png image thingie is just a small part of what I want to do, and it looks like it's the most time-consuming part, which has been fairly demoralizing so far
21:36:51
ralt
(it's actually a PDF page I want to show, but I gave up on that and use pdftoppm to convert the pdf into a png)
21:37:50
ralt
yeah, I want to render a pdf to the screen though, rendering a pdf to file is something every other lib seems to know how to do :)
21:38:02
jackdaniel
(see Examples/drawing-tests.lisp and see how all demos are written to these files)
21:39:12
ralt
err, I just want to do something that will let me select a part of a PDF and put a signature in there. i.e. electronically "sign" PDF files.
21:39:56
jackdaniel
ah, I thought that you are baking a PDF viewer in CL (something I have in plans for distant future:)
21:43:37
ralt
jackdaniel: just fyi, I don't want to pursue this further _right now_, but trying to load mcclim is showing this error: "no translation for #P"SYS:DEFLATE.FAS"". The system has been downloaded so I can read the source, but I thought I'd let you know.
21:44:57
jackdaniel
this 1. looks like ECL, 2. looks like not all files from the ecl compilation are installed
21:45:10
jackdaniel
or that they are installed in a different directory than claimed when it was compiled
21:45:58
jackdaniel
(so this "no translation" is not related to the system, rather ECL installation)
21:48:03
jackdaniel
but since it is not ECL and it is highly unlikely it has anything to do with McCLIM, I'll call it a day and wish you a good luck :)
22:31:46
pjb
ralt: actually, there's an opportunity to do something with all those "nightmarish" projects such as a PDF viewer. With CL, we could implement better software than with other programming languages. Building better tools, we should be able to sell them to demanding customers.
22:46:41
aeth
pjb: I think the past 20 years of software has shown that people will gladly accept something that's inferior but $0
23:12:56
phoe
How can I split a list into sublists? I have (1 x 2 3 x 4 5 x 6 x 7 x 8) and I want to get ((1) (2 3) (4 5) (6) (7) (8)) as a result.