<verisimilitude>
You can simply MAP the predicate and then have a SEQUENCE of where it does and doesn't aply, sjl.
<sjl>
... how does that get me the position numbers?
<sjl>
that just gets me a sequence of generalized booleans
<verisimilitude>
You could easily transform such a SEQUENCE into positional numbers or skip this intermediate step entirely.
<verisimilitude>
I'll prepare a basic example for you.
<verisimilitude>
Does this need to work on all SEQUENCEs or is just lists fine?
<sjl>
The example I wrote above works with all sequences, so let's say yes.
<verisimilitude>
Alright.
<sjl>
Preferably it should use O(elements that satisfy the predicate) memory too, though I could live without that
<sjl>
Mapping the entire thing and transforming will allocate memory even for stuff that doesn't satisfy the predicate, which is a waste if only a couple of things do
Essadon has quit [Quit: Qutting]
<sjl>
But I could overlook that if there'sa simple one-liner that would do what I want
<verisimilitude>
Here is a basic implementation of what you want:
<verisimilitude>
if (predicatep (elt sequence nth)) collect nth)
<verisimilitude>
(loop for nth from 0 below (length sequence)
<sjl>
That would be... not fast for lists.
<verisimilitude>
I write LOOP assuming COLLECTING is O(1), which any decent implementation would use.
<verisimilitude>
In any case, you could always collect the list differently.
<sjl>
it's the ELT that makes it slow for lists, not the collect
<verisimilitude>
Oh, I suppose you're right.
<sjl>
But yeah, I'll just use my util function that I pasted earlier. It's efficient and works
<verisimilitude>
This is, again, just a basic implementation, of course; it works for what you want.
<sjl>
and it's not like I don't already have a giant utils library. what's one more function thrown on the pile
<verisimilitude>
It's unfortunate I was no help, then.
<verisimilitude>
Is there anything else you'd want help with, sjl?
<sjl>
No, I think I'm okay for now. Just playing catch-up on Advent of Code after travelling.
<sjl>
Thanks though.
<verisimilitude>
It's no issue.
Necktwi has joined #lisp
Mr-Potter has quit [Quit: Leaving]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
elfmacs has joined #lisp
notzmv has joined #lisp
MoziM has quit [Quit: WeeChat 2.3]
sabrac has joined #lisp
<sabrac>
Is there any way to write defmethods that are different for alists and plists?
<Bike>
nope, they're both of class list. you'll have to do something extra.
<Bike>
well, class cons
<sabrac>
That is what I thought. Thank you.
Lycurgus has joined #lisp
ealfonso has quit [Ping timeout: 250 seconds]
hectorhonn has joined #lisp
<hectorhonn>
good morning everyone
arescorpio has joined #lisp
adam4567 has joined #lisp
pierpal has joined #lisp
arescorpio has quit [Remote host closed the connection]
jackhill has joined #lisp
FreeBirdLjj has joined #lisp
psq has joined #lisp
themsay has joined #lisp
abbe has quit [Quit: “Everytime that we are together, it's always estatically palpitating!”]
chipolux_ has quit [Quit: chipolux_]
chipolux has joined #lisp
nchambers has joined #lisp
rnmhdn has joined #lisp
<alandipert>
is there a way to define a local function that has the function value of some expression? so that it can be called locally without funcall
<verisimilitude>
I've also written it to assume nothing about the character set the implementation uses, so it performs some tests for suitability and optimizes in the case of ASCII.
Cymew has joined #lisp
FreeBirdLjj has quit [Ping timeout: 244 seconds]
<PuercoPop>
pfdietz: Been skimming over the fuzzy-testing code in your ansi-test repo. Pretty cool. One question, what would 'something useful' on package errors be? build a list of the symbols that caused the package errors?
<pfdietz>
You mean, when reading? I was just sticking it in *package*.
akoana has joined #lisp
FreeBirdLjj has joined #lisp
<pfdietz>
For the reader, it would suffice to have a restart so the code invoking the reader could suggest a package.
<pfdietz>
The goal of that was to stripmine a large corpus of Lisp for forms that are sort of reasonable.
robotoad has joined #lisp
<pfdietz>
And then mutate those and recombine them and throw them at the SBCL compiler, trying to get the compiler to signal errors.
<PuercoPop>
to serve as a sort of training data set?
<pfdietz>
Just raw material for test generation.
<pfdietz>
No fancy learning going on.
Cymew has quit [Ping timeout: 250 seconds]
Lord_of_Life has quit [Ping timeout: 250 seconds]
Lord_of_Life has joined #lisp
<pfdietz>
I pulled in code from the entire quicklisp distribution and a bunch of other public lisp programs.
* PuercoPop
nods
<pfdietz>
I would have liked to have read everything in the actual packages, but that's not possible if I want to read all of quicklisp, as there are many package name collisions.
rnmhdn has quit [Ping timeout: 250 seconds]
ggole has joined #lisp
abbe has joined #lisp
dddddd has quit [Remote host closed the connection]
<beach>
Good morning everyone!
<ebrasca>
Hi beach
orivej has quit [Ping timeout: 250 seconds]
orivej has joined #lisp
Necktwi has quit [Quit: leaving]
Necktwi has joined #lisp
<hectorhonn>
hi beach
meepdeew has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
quazimodo has joined #lisp
quazimodo has quit [Client Quit]
quazimodo has joined #lisp
<verisimilitude>
What do you think so far, psq, if you've taken a look yet?
<beach>
Do you have a GIT repository so that one doesn't have to download the entire source?
meepdeew has joined #lisp
<beach>
verisimilitude: Top-level comments start with three semicolons.
<beach>
Commented-out code gives a very strange impression. What is the person reading the code supposed to think?
<beach>
Comments inside top-level expressions to be aligned with other expressions take two semicolons.
meepdeew has quit [Ping timeout: 250 seconds]
<beach>
Instead of using reader labels #= and ##, define an abstraction like a function or a macro. Code like that is quite unreadable.
<beach>
Your functions are way too big.
FreeBirdLjj has joined #lisp
<beach>
verisimilitude: I think it was a mistake to recommend your code as the first code for psq to read.
<beach>
verisimilitude: It is not idiomatic and it is way too hard for a beginner to follow.
<verisimilitude>
I don't use git, no, beach.
<equwal>
wut
<verisimilitude>
ACUTE-TERMINAL-CONTROL is still a work in progress, but I will defend CL-ECMA-48 as something that is rather finished and good.
<equwal>
Use git.
<verisimilitude>
Why should I?
<beach>
verisimilitude: Why do you recommend unfinished unidiomatic code to read for a beginner?
<beach>
psq: I think you should start with something more idiomatic.
<verisimilitude>
I recommended ACUTE-TERMINAL-CONTROL because they also wanted something interesting.
<verisimilitude>
I told them to read CL-ECMA-48 first, anyway; do you have any criticisms that apply to that, beach?
<beach>
I do, yes.
<beach>
Same thing about comments.
<beach>
Your function and macros are way too big. They should be less than one screen.
<equwal>
versimilitude: Because you need version control and git is the best version control system.
<verisimilitude>
Comment conventions are irrelevant, I think.
<beach>
verisimilitude: Your code seems to use car/cdr/rplaca/rplacd a lot. That indicates a lack of abstraction.
<verisimilitude>
The code in DEFCS could be cleaned a tad by introducing more variables to store some results, and I may do that, but it's still fine and nice.
<equwal>
whoa your code is in all caps
<beach>
verisimilitude: They are not irrelevant. If you want to expose your code to others, especially to newbies, make sure you follow the established conventions.
<verisimilitude>
That's just how I formatted the examples in the documentation, equwal.
<verisimilitude>
I will follow no convention I don't care about, beach.
<equwal>
I stopped reading when I saw it was all caps.
<verisimilitude>
Besides, it's not as if anyone else gave any recommendations.
<beach>
verisimilitude: I respect that, but then don't expose your code to others. Especially not to newbies.
<beach>
verisimilitude: It would be better to wait for a more idiomatic recommendation than to expose unidiomatic code.
<equwal>
verisimilitude: I don't have recommendations because I'd rather use my time doing something other than reading that.
<equwal>
No all caps.
<verisimilitude>
That's what the code actually looks like, equwal, and the actual program isn't written like that.
<beach>
psq: If you could tell us your current level of knowledge, the kind of code you would be interested in, and what other languages you already know, better recommendations could be given.
<verisimilitude>
I'd like to see some ``better recommendations'', yes.
<equwal>
Are you on a PDPS?
<verisimilitude>
I'm using UNIX derivative, so it's close enough, equwal.
<equwal>
no
<alandipert>
i have a cyclic relationship between a struct and its :print-function (the print function uses accessor functions created by defstruct). is a "forward declaration" like (declaim (ftype (function (t t t) t) print-node)) the most reasonable way to muffle complaints about undefined functions?
<equwal>
Best recommendation: Make a git repo, put your code in Emacs, M-x downcase-region the code.
<verisimilitude>
Again, the actual cl-ecma-48.lisp isn't like that, equwal, if you'd actually look at it.
<verisimilitude>
I'd rather rid myself of torvalds' software than become more dependent on it, equwal.
<Bike>
alandipert: i think you should just be able to (defstruct ... (:print-function foo) ...) (defun foo ...) and that will be fine
<equwal>
lol Emacs?
<Bike>
alandipert: if they're in the same file at least
<psq>
verisimilitude: Haven't had a chance to look at your code yet, got a bit distracted
<beach>
psq: There are several freely available books with excellent code examples in them.
<beach>
minion: Please tell psq about PCL.
<minion>
psq: have a 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).
<alandipert>
Bike thanks, that works, but sbcl emits a style warning about the undefined function that i wish to suppress
<equwal>
Yes reading code as a novice seems like a boring waste of time, read a book.
<Bike>
alandipert: are the definitions in the same file?
<alandipert>
Bike yes
<beach>
psq: I seriously think you should skip the code that verisimilitude recommended. It is not idiomatic and verisimilitude doesn't think it is important to follow established convensions.
<Bike>
huh. weird.
<Bike>
i dunno then.
<verisimilitude>
From what I recall, Seibel uses CLOS too much for my tastes.
<beach>
psq: But to a beginner, it is absolutely essential that the code follow established convensions.
<alandipert>
oh, duh, they're in the same file but i'm not loading the file. i'm evaling things form by form manually in slime
<alandipert>
i can see how it wouldn't bother me if i loaded the file. thanks Bike
<beach>
verisimilitude: You don't get it do you? It is not about your taste. It is about established conventions.
<verisimilitude>
You can read my program and see a rather finished, well-documented, well-used, and entirely portable Common Lisp library or you can follow the vague suggestion to read programs in a book, with no particular examples, psq.
<equwal>
beach is not saying to make your code clos, he is saying to make it not bad.
<psq>
beach: I've looked at the books, I was thinking more along the lines of a project that I could wrap my head around
<psq>
maybe even contribute to later on
<beach>
psq: OK, do you have a particular taste?
<verisimilitude>
Well, I still recommend my programs, psq, although I'm not looking for contributions.
<beach>
psq: Like what domain? Web stuff? Compilers? GUIs?
<beach>
verisimilitude: Please do not recommend unidiomatic code to beginners.
<psq>
Compilers would be nice actually, also graphics (I've seen CEPL)
<beach>
psq: McCLIM is a GUI library with plenty of examples in it.
<no-defun-allowed>
would it be a good idea to split out any protocol defining code like defgenerics into another file?
<beach>
verisimilitude: What source did you use to determine the idioms of Common Lisp? Since you don't agree with my assessment, that means you think your code is idiomatic. Or do you think you are so good that you can establish the idioms yourself?
<psq>
Thanks for the suggestions, I'll check them out. I'd love to get into SBCL, I have a feeling I'll have to work up to that though
<beach>
psq: Yes, that might be tricky. If you want some compiler code, Cleavir will be easier to understand.
<verisimilitude>
I think your bemoaning my comments is irrelevant, considering there's few of them and the conventions you mention are, at best, a suggestion mentioned in passing.
<verisimilitude>
Documentation strings are better than comments and there's plenty of those.
<verisimilitude>
I'd be more interested in where you got your list of idioms, beach.
marusich has joined #lisp
<verisimilitude>
If you look at the original question, psq asked for ``approachable'' codebases.
* no-defun-allowed
reads source
<no-defun-allowed>
i don't think it's very approachable
<no-defun-allowed>
the #1# and #2# require quite a bit of memorisation
Bike has quit [Quit: Lost terminal]
<verisimilitude>
You're talking about the examples I gave in the documentation, no-defun-allowed?
<no-defun-allowed>
the sources linked in the documentation
<no-defun-allowed>
and if you're going to call xterm r*tarded you should do it at the bottom of the docs preferably in a low-contrast colour scheme
<no-defun-allowed>
also yea use ;;; for big top level comments please
<verisimilitude>
I will concede that, at least at this point, ACUTE-TERMINAL-CONTROL isn't necessarily approachable, sure.
<verisimilitude>
I think CL-ECMA-48 is fine, though; I have five macros that do all of the work and everything's well-documented.
<no-defun-allowed>
i wouldn't suggest that to beginners though
psq has quit [Ping timeout: 256 seconds]
<aeth>
Wow, I have never seen &aux used before. I had to look it up.
<aeth>
I think it's a lot clearer to use (list) (destructuring-bind (foo) list ...) instead of (list &aux (foo (car list)))
psqueak has joined #lisp
<verisimilitude>
I suppose I could change that to FIRST instead.
<aeth>
I don't think &aux should really be used. It doesn't even save a line in most cases. If your lambda-list is too long then each element should be on its own line so (... &aux (foo 42)\n(bar 43)\n(baz 44)) doesn't actually give you more lines over just having a let.
beach has quit [Ping timeout: 252 seconds]
<aeth>
In fact, it probably should be &aux\n(foo 42)...
<aeth>
So you actually use one *more* line over the let, although you do have less indentation and one fewer level of parentheses
<aeth>
And that's probably why I've never seen &aux before.
<verisimilitude>
If I'm to choose between a LET* to start the body with or an &AUX, I'm always going to choose the latter.
orivej has quit [Ping timeout: 240 seconds]
<verisimilitude>
It usually does save a line; can be considered more clear since you no longer need to see if the LET* applies to the entire body or not; and it does result in less indentation, which is good.
<aeth>
It only saves lines if you use your horrible style of (foo bar baz foobar\nquux foobarbaz barfoo) multiline lambda lists that should fail any code review.
<verisimilitude>
You can make the argument that properly-indented code does make it easy to see if a LET* always applies, but with an &AUX it doesn't matter if the code is well-indented; you know it applies to the entirety.
<aeth>
&aux encourages function-level scope for variables, which should be used as rarely as possible. Everything should have the tightest scope possible.
<aeth>
The latter behavior really makes it easier to refactor into smaller functions is a function grows too big
<verisimilitude>
We just disagree, I suppose.
<ebrasca>
verisimilitude: You probably disagree with all here.
<aeth>
I just did a search and only a handful of libraries seem to use &aux (including stumpwm, unfortunately)
<verisimilitude>
If you're referring to the functions my DEFINE-CONTROL-FUNCTION generates, then there's clearly no need to refactor, since they're all automatically generated, and all I use the &AUX for is some special variables that are harmless to bind like this.
beach has joined #lisp
<verisimilitude>
I'm not insulting you, but I do find it a tad odd to not be aware &AUX exists and then to decry its usage.
<aeth>
I'm sure many people here would have to look up PROG
<verisimilitude>
I learn languages by mostly reading standards and reference material beginning-to-end, so I don't tend to use a language until I'm at least well acquainted with all or most of it.
<beach>
verisimilitude: I would like to know YOUR source of idioms since you claim your code is idiomatic.
<verisimilitude>
So, what I mean is I never used CL:LAMBDA without being aware of &AUX, I don't believe, or at least not for long.
<aeth>
When people very familiar with the language have lack of familiarity with a feature, it might mean that that feature is discouraged idiomatically, like PROG or &AUX.
<verisimilitude>
I really don't see what's particularly unidiomatic about my programs, beach. All I'm doing is using what the language provides.
<aeth>
I learn by reading and writing a lot of code. If I've never encountered something at this point, that probably means that (almost) no one uses it.
<beach>
verisimilitude: I see. You don't understand the difference between grammatical phrases and idiomatic phrases. That's very interesting.
<verisimilitude>
I'd argue it's far worse to bring in a library such as ALEXANDRIA for trivial purposes. I'm not familiar with this ALEXANDRIA and I see so many programs that bring it in for such trivial things. This is just an example.
<verisimilitude>
I do, beach.
<aeth>
verisimilitude: Idiomatic usage of the language is writing code that other people are able to read and that other people would be able to take over maintaining if you stopped writing it. It's probably the most important part of using any programming language.
<verisimilitude>
In case it's not clear, I don't really spend much of my time reading other Common Lisp programs. I'm using the language well and in clear ways and never concerned myself much with patterns I didn't want to make macros.
<beach>
verisimilitude: Er, you just said you use what the language provides. That would be the grammatical phrases. Yet, you claim your code is idiomatic?
<verisimilitude>
My code isn't obfuscated, aeth.
<aeth>
I mean, my programs aren't particularly idiomatic, either, but that means I have to document things heavily. (length (documentation 'define-function 'function)) => 2565
<equwal>
lol yes it is
<beach>
verisimilitude: Oh, so you just said that you don't care whether your code is idiomatic or not. So you DO agree with my assessment, but you don't care.
<aeth>
I try my hardest not to surprise people even though a lot of my code isn't very idiomatic because of my custom macros, and I do that with substantial documentation (and I don't document enough). But I know the idioms and intentionally violate them in places, e.g. using 'foo?' instead of 'foop'
<verisimilitude>
I'm being told that using a standard lambda list keyword is unidiomatic, so I really don't care for what's considered idiomatic, then.
varjag has joined #lisp
<aeth>
I'm perfectly capable of writing 100% idiomatic CL, and I do that in many programs when I don't want to pull in my extensive libraries and/or when I want to share it.
<verisimilitude>
I find your ideas to be wrong, beach.
<beach>
verisimilitude: Good for you.
<psqueak>
Doesn't seem like this is going anywhere guys
<verisimilitude>
Oh, yes, using ``p'' and ``-p'' for predicates is one of the few conventions I'm aware of and always follow.
<equwal>
Learn to code plebian.
<aeth>
verisimilitude: There are a lot of bad conventions and ideas in Common Lisp due to compatibility with historic Lisps. e.g. names like rplaca
<verisimilitude>
I find it amusing that you're calling my code unidiomatic while not even following that convention, aeth.
vms14 has joined #lisp
<aeth>
verisimilitude: The difference is that I know the idiomatic conventions, though.
<verisimilitude>
There are very few and I really don't care if someone thinks I don't use enough semicolons.
<aeth>
Programming is art, and the best art breaks the established rules in places, but the artist first needs to learn those rules in order to violate the rules properly.
<verisimilitude>
So now I don't know the rules of the language, but I know more about the language than you do, it seems?
<aeth>
You overuse one obscure feature of a lambda list. That doesn't mean you know more of the language than I do.
varjag has quit [Ping timeout: 250 seconds]
Necktwi has quit [Ping timeout: 268 seconds]
nchambers is now known as Rudolph
<verisimilitude>
I can hazard a guess.
<equwal>
Anyone can access the CLHS.
<aeth>
There are plenty of people here who might know more of the language than I do. beach and Bike, for instance.
<verisimilitude>
Now, why don't you make a list of these idioms, beach, and I can tell you how many I've internalized and just didn't recall offhand and how many are just things you happen to like, such as your mistaken ideas concerning protocols.
<beach>
Because I don't think it will make a difference.
vlatkoB has joined #lisp
<ebrasca>
verisimilitude: Do you have git repo with your code?
<aeth>
That's probably what beach was saying about the functions being way too large.
<aeth>
verisimilitude: I would definitely throw quite a few DESTRUCTURING-BINDs in there. "caddr", "cadr", etc.
<aeth>
I caught a few bugs when I switched my style from CXR to using DESTRUCTURING-BINDs just about everywhere.
makomo has quit [Ping timeout: 246 seconds]
<ebrasca>
cl-vulkan have long functions but it include some comments to help.
<aeth>
all stuff like CAADR do is hide implicit structure that DESTRUCTURING-BINDs can make explicit.
<LdBeth>
Sup
<aeth>
Additionally, those functions don't check the tail. With DESTRUCTURING-BIND, you have to explicitly ignore the tail like (destructuring-bind (foo bar &rest rest) (declare (ignore rest)) ...) which (if you don't do that) means you can catch non-conforming syntax you wouldn't otherwise catch.
marusich has quit [Ping timeout: 260 seconds]
<aeth>
verisimilitude: You may or may not have more cover-to-cover knowledge of the standard, but you don't know *when* to use what if your code is full of CAADRs imo.
<verisimilitude>
I actually do account for things such as improper lists, aeth.
<verisimilitude>
However, I didn't want to glut the code with frivolous checks, so I wrote the DEFCS code to carefully generate invalid code that would be caught by CL:LAMBDA, if my rules are violated.
<aeth>
And instead of ,@(mapcar 'caddr g) you should either (1) use destructuring-bind to reduce the problem so you're using a simpler function (in this case, car?) or (2) name it as an inline (if you care about performance so much) accessor macro like (defun foo (x) (caddr x))
<aeth>
(And if you do reduce it to a car with #1 you can use #'first instead of #'car)
makomo has joined #lisp
jack_rabbit has quit [Ping timeout: 250 seconds]
rumbler31 has joined #lisp
marusich has joined #lisp
vms14 has quit [Remote host closed the connection]
<verisimilitude>
The code in DEFCS could be improved, yes, although I'd thought my documentation made up for it. I'll try to get it cleaned by the end of the year so I don't add more years to the copyright notice.
<verisimilitude>
I'd thought that by showing the macro usage and the code it generates, that was enough to sate most and would be a good aid to anyone wanting to fully understand it. I document the main cases of code generated.
vms14 has joined #lisp
beach has quit [Disconnected by services]
makomo has quit [Ping timeout: 250 seconds]
beach has joined #lisp
rippa has joined #lisp
Inline has quit [Quit: Leaving]
rumbler31 has quit [Remote host closed the connection]
vms14 has quit [Ping timeout: 250 seconds]
makomo has joined #lisp
orivej has joined #lisp
rnmhdn has joined #lisp
skeuomorf has joined #lisp
skeuomorf has left #lisp [#lisp]
robotoad has quit [Quit: robotoad]
* dim
waves “hi there”
atgreen_ has quit [Remote host closed the connection]
atgreen_ has joined #lisp
shka_ has joined #lisp
Josh_2 has quit [Remote host closed the connection]
JohnMS_WORK has joined #lisp
shka_ has quit [Ping timeout: 250 seconds]
robotoad has joined #lisp
<splittist>
hello all
* akoana
quit
akoana has quit [Quit: Leaving]
<phoe>
morniing
<zigpaw>
morning :)
<phoe>
verisimilitude: sure, your code is standard, but &AUX isn't used in most contemporary code, as agreed by means of an informal consensus of a bunch of lispers that has been perpetuated for some time now. Therefore a newbie who encounters that code might be confused about the features that are rarely used elsewhere. Sure, it's a good training in "this is standard Common Lisp", but it's a poor training in "that's
<phoe>
what the majority of contemporary Lisp code looks like and therefore what you can expect to see".
varjag has joined #lisp
<phoe>
Which is why, to me, &AUX lands in the same place as symbol property lists, rplaca/rplacd, and a bunch of other things I can't recall off the top of my head at the moment - stuff that I won't use in code I write now.
<dim>
I've mostly seen &aux used for boa constructors in defstruct when handling with inter-dependent slot values being computed at instanciation time
<dim>
that's quite specific ;-)
<phoe>
Yep, but that's already boa constructors. They're a weirdness of their own. (:
<dim>
fair
<verisimilitude>
My CL-ECMA-48 also makes use of symbol plists.
<verisimilitude>
They're convenient for metadata and whatnot.
orivej has quit [Ping timeout: 250 seconds]
elderK has joined #lisp
<elderK>
Hey all!
Cymew has joined #lisp
<jdz>
I've recently grown fond of &AUX.
mrcom has quit [Read error: Connection reset by peer]
<verisimilitude>
It's nice to see I'm not the only one.
mrcom has joined #lisp
<verisimilitude>
I've been thinking about what it means for there to be an idiom in Lisp, due to this conversation. I think there really aren't many idioms that are commonly agreed upon. The predicate naming came as one that few disagree with and I recalled a reason why that's the case: It's supported by the language itself through DEFSTRUCT.
<verisimilitude>
It's not a requirement to name predicates in this way, making doing so a convention, but it is nonetheless reinforced by the language.
<jdz>
There are also quite a few predicates defined in the language following that convention.
<verisimilitude>
There really aren't many idioms that qualify for this. Though I do recall one fellow getting rather angry at me when I told him Common Lisp was a language that supported English first, as it has facilities for generating English in FORMAT; that's a thought.
<verisimilitude>
Yes; NULL is the exception that comes to mind, jdz.
themsay has quit [Ping timeout: 250 seconds]
<jdz>
Yes, it just so happens that NULL is not included in the "quite a few" set.
<verisimilitude>
Yes; I was just listing the sole exception that came to mind immediately, for effect.
<verisimilitude>
Another idiom would be the WITH- macros. I'd think Lisp has fewer idioms not only due to the freedom permitted, but also because macros eliminate repetitive code.
robotoad has quit [Quit: robotoad]
wglb has quit [Remote host closed the connection]
wglb has joined #lisp
<jdz>
ATOM is similar.
<jdz>
My _guess_ is that those are the way they are for historical reasons.
<verisimilitude>
But, really, I find it absurd to have people here tell me my code is unidiomatic because it uses things they don't like or weren't even aware of.
<verisimilitude>
It rubs me the wrong way and I'm glad I made my own understanding of Lisp rather than just asking others for their thoughts.
<beach>
verisimilitude: Your assessment of what people tell you is wrong.
<verisimilitude>
I'd also figure that, yes, jdz.
<phoe>
ATOM, too.
<phoe>
Oh right, someone mentioned it.
<verisimilitude>
As an example, this is #lisp, but there's no official Common Lisp IRC channel.
heisig has joined #lisp
<verisimilitude>
Similarly, I just don't get the impression there's much of a set of established idioms.
<phoe>
Well, this channel is as official as you can get.
<beach>
verisimilitude: This is the agreed-upon Common Lisp channel.
<phoe>
There won't be an official Common Lisp channel because there's no one to make it official.
rumbler31 has joined #lisp
<jdz>
Some people ignore the commenting conventions (different number of semicolons); I find reading the code painful.
<verisimilitude>
What I mean is it's not like, say, Rust, where there's an official subreddit, mailing list, and other garbage.
<phoe>
So social constructs is as close as Lisp can get when it comes to idioms, conventions, and so on.
<phoe>
And these are fragmented by nature.
<verisimilitude>
Sure, beach, but I used Common Lisp for years, in my own Lisp community, without being aware this one even existed.
<verisimilitude>
Common Lisp is very decentralized, in this respect.
<phoe>
Common Lisp regionalisms, eh? (:
<verisimilitude>
Sure, phoe.
* phoe
runs off for work
<beach>
verisimilitude: I think you are missing something essential. What is idiomatic and what is not, is rarely decided by some central power. And that goes for natural languages as well as programming languages.
rumbler31 has quit [Ping timeout: 250 seconds]
<beach>
Just as a novelist must follow conventions of typography, of character building, etc, in order to be understood by readers, a programmer must use the conventions established over many years by experienced users in order for the code to be understood and appreciated by others.
<beach>
There is no central place where there is a list of idioms, not in natural languages and not in programming languages. Instead, you learn these idioms by years of studying what other authors do (something you refuse to do, apparently).
<verisimilitude>
You can buy a book containing the known idioms of a language, beach.
<verisimilitude>
I even have some.
<beach>
Great!
<beach>
Can you give an example?
<verisimilitude>
Can I give an example of a book of idioms?
<beach>
Of a book.
<verisimilitude>
Can I give an example of any book?
<verisimilitude>
Sure; I've been reading ``Programming in Ada 2012'' by John Barnes lately.
<flip214>
"The Visual Display of Quantitative Information"
<flip214>
by Edward Tufte is very nice
<verisimilitude>
Unlike Common Lisp, Ada is a language that actually enforces some conventions, at which point they stop being conventions.
<flip214>
not really programming-related, though
<verisimilitude>
It would be easier to discuss what isn't idiomatic Common Lisp, beach, and the main example that comes to mind is modifying the reader table greatly, since that's very uncommon.
<verisimilitude>
As for conventions of programming in general, I'm not going to respect the conventions of a field that is less than a century old and still does many things wrong. So, I feel perfectly within my common sense and whatnot to do whatever I want when it comes to programming.
* beach
smiles.
<verisimilitude>
There is very little in programming, compared to the whole, that is actually worth doing, because there's so many idiots writing software who don't know what they're doing.
<verisimilitude>
Of the Common Lisp that I do look at, I find that a great deal of it doesn't follow the standard perfectly, by assuming whatever SBCL does is the standard, assuming ASCII or even UTF-8 is the character set, or something else I find stupid.
<flip214>
verisimilitude: that's the same in every programming language, as far as I can tell.
<flip214>
verisimilitude: even if the field is not that old, there are still people that have been working in it for 40 or more years - and so they have a bit of experience.
<flip214>
of course that experience has not settled down to every single person involved --
<verisimilitude>
So, I'd much rather write a program that perfectly adheres to the standard where possible, even if it can get messy, and that seems relatively uncommon, where programmers are content to have it work on three or four implementations and don't care about the rest.
<flip214>
but when building a house there are still people who don't know what they're doing, and we've been doing _that_ for a few thousand years now ;)
<dim>
wow, this rant reminds me of my favorite Dilbert of all times: The direction acknowledge that we have a problem of communication in this company, but doesn't want to speak about it.
<verisimilitude>
It unsettles me when I look at a Common Lisp program and the main comment is ``This works on SBCL. Don't know about the others though.'' for something that has no place being unportable.
rnmhdn has quit [Ping timeout: 240 seconds]
<flip214>
verisimilitude: unless CFFI, SB-* packages, etc. is involved, chances are very good that it's portable.
<verisimilitude>
The point is that it seems an unfortunate amount of Common Lisp code is only ever tested on SBCL and I'm perfectly happy not following the crowd when it comes to that.
<jdz>
verisimilitude: I've missed the beginning of this discussion. Can you point me to your code that started this?
<flip214>
verisimilitude: on the other hand, CL _has_ a standard - and a few implementations claiming to be compatible. so what's the point of testing standard-conforming code on every implementation?
<verisimilitude>
Well, I meant that people both don't know the standard and also don't test their code on multiple implementations.
yvy has joined #lisp
<verisimilitude>
Now, a primary difference between programming and building houses is people actually care when the average house doesn't work, because that usually means someone died; programming has no same level of rigor for the average case.
<flip214>
verisimilitude: uh, yeah, but a small badness multiplied by a few million times is a big badness again (think smartphone app crashing)
<verisimilitude>
I'm not arguing it's a good thing; why do you think I'm learning Ada?
<shka__>
good morning
<verisimilitude>
I have an iteration of a program in Common Lisp, but there's no standard way to recover from a STORAGE-CONDITION, which is one reason it's not quite reliable enough for my tastes.
jochens has joined #lisp
<shka__>
verisimilitude: standardizing such thing wouldn't be a good idea
<shka__>
it is very, very, very implementation dependentent
<verisimilitude>
I agree, but that doesn't change the fact, of course.
<flip214>
verisimilitude: how would you recover from out-of-space in a C or ADA program?
<verisimilitude>
That really just means if you want to be able to handle memory exhaustion, your options are using implementation-specific mechanisms or not using Common Lisp.
<verisimilitude>
You'd handle Storage_Error in Ada, flip214.
<jdz>
verisimilitude: Your code looks very hard to read to me. All-caps, really? If you're going for the old-school terminal feel, why are your lines longer than 80 columns?
<verisimilitude>
For a C program, the popular handling method is to continue with garbage or die immediately.
<jdz>
Code could use some DEFCONSTANTs.
<flip214>
yeah, but you can't do better than to close the file you're writing to, delete it (as it's half-written anyway), log an error, and hope for admin help.
<verisimilitude>
That's just the documentation, jdz.
<verisimilitude>
Well, that depends on the program, flip214.
<verisimilitude>
I have a program design that can handle it, actually, because it only uses unbounded memory consumption for a few things.
<shka__>
verisimilitude: well, you CAN just die
<jdz>
And I'd agree with anybody complaining about using sharpsign equal-sign reader macro in the code.
<verisimilitude>
That's just so the reader can tell exactly what would be there.
<flip214>
well, of course you can use (RUN-PROGRAM "resize2fs" ...) etc., but that might not be a good idea generally. So the options for handling "external" errors are limited anyway.
razzy has quit [Read error: Connection reset by peer]
<verisimilitude>
What happened was I'd obsessed over a design, mulling over its memory behavior, and decided I should make it resistant to memory exhaustion since it could be made resistant.
razzy has joined #lisp
<flip214>
but you won't stop other processes from allocating memory and running the whole _machine_ OOM. so non-consing is all good and nice, but you still have to plan for external interference - not all of which can be handled.
schweers has joined #lisp
<verisimilitude>
I understand what you're telling me, flip214, but I don't want to bloviate about my particular program, the design of which can and will account for these things in the Ada reimplementation.
<jackdaniel>
phoe: aux is a very fine mechanism to avoid whole-body let, I don't buy your argument that some vague lispers consensus deemed it bad
<jackdaniel>
it is not uncommon in working code you can observe even in new libraries
dddddd has joined #lisp
<flip214>
jackdaniel: but the &aux should be indented quite a bit, which limits its available width for expressions
nowhere_man has joined #lisp
<jackdaniel>
flip214: I don't understand, could you rephrase?
<jackdaniel>
you mean a situation where you have a long function name and start arguments in the same line, so when you start newline for &aux variables it is not at the same level as body?
jochens has quit []
<jackdaniel>
I'm not saying aux is perfect or any kind of silver bullet, I'm just saying that it is not as obsolete as phoe pictured it
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
<dim>
people, if you are interested in a nice design of a C program that knows how to handle both Out Of Memory and File System Is Full conditions, may I direct your study to PostgreSQL? it is very good at handling that (service does not stop, works again as soon as disk space is made or memory is back available)
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
<flip214>
jackdaniel: which indentation would you prefer?
<Cymew>
I remember someone said that to study good C for style, tex.c was a good start. Maybe PostgresSQL is also a good study object?
hhdave_ has joined #lisp
<jackdaniel>
flip214: I personally would take the second one
<jackdaniel>
like you have named arguments you have auxilliary arguments
<jackdaniel>
as of how long aux is, the same concerns apply to &key and &optional arguments
ggole has quit [Ping timeout: 260 seconds]
hhdave has quit [Ping timeout: 268 seconds]
hhdave_ is now known as hhdave
<jackdaniel>
if your initialization is long, then it is long
<jackdaniel>
(and that may be a hint, that maybe too much is done in there)
<dim>
Cymew: I think it is yes
<Cymew>
I got the crazy idea last week that I might want to try my hand at writing C again. I wonder how fast the wonder fades?
<dim>
it's one of those few software projects that has been incrementally improved year after year for more than 20 years now, with constant refactoring and new features, so it shows several techniques allowing for long term project maintenance
<dim>
Cymew: for me it fades the day you start again, really
<jackdaniel>
writing in C is fine until you start feeling this burning desire to use a closure ;-)
<Cymew>
*chuckle*
<verisimilitude>
I had a conversation with a C programmer about how some interfaces are baroque and unamicable to writing software that works correctly in all instances.
<verisimilitude>
His response was, paraphrasing, ``Who wants to write software that works correctly in every instance?''.
robdog has joined #lisp
robdog has quit [Read error: Connection reset by peer]
<Cymew>
dim: That sounds interesting. I might have a friend of mine who write C++ for a living, and mostly does maintenance, what he thinks of the code base.
robdog has joined #lisp
<Cymew>
....eh. Missing a verb there.
<dim>
for me the first C-c C-c or C-M-x is usually a good sign I'm missing CL interactivity
<dim>
exploring your program as you go is underrated
mingus has quit [Ping timeout: 240 seconds]
<Cymew>
It's wonderful.
yvy has quit [Read error: Connection reset by peer]
orivej has quit [Ping timeout: 245 seconds]
mrcom has quit [Read error: Connection reset by peer]
ggole has joined #lisp
FreeBirdLjj has joined #lisp
scymtym has quit [Ping timeout: 250 seconds]
atgreen_ has quit [Ping timeout: 244 seconds]
yvy has joined #lisp
Lycurgus has quit [Quit: Exeunt]
<ogamita>
jcowan: But precisely; using portability libraries should be done sparingly. Or at least, orienting the dependencies so that the core of your code doesn't depend on it.
pierpal has quit [Ping timeout: 245 seconds]
<ogamita>
sjl: there's com.informatimago.common-lisp.cesarum.array:positions and positions-of-subsequence
<Cymew>
verisimilitude: Sounds like a programmer you should not hire.
<ogamita>
sjl: but I don't have a positions-if yet.
ioa has joined #lisp
<ioa>
good morning
<verisimilitude>
What has you writing that, Cymew?
<beach>
Hello ioa.
<Cymew>
verisimilitude: "Who wants to write software that works correctly in every instance?" to me sounds like a very sloppy programmer.
<verisimilitude>
Oh; I agree.
<flip214>
Cymew: well, if "correctly" means eg. "on out-of space, write an error to the console and the syslog, wait for a human to help out, and tell me to recover" vs. "bug out with an error", I'd typically choose the latter ;)
<jcowan>
Yet if you are writing a network server, just for instance, then nonstandard code is at the very heart of your application. As I said before, this is not about non-portability, as a program can be quite portable without being standard.
<Cymew>
flip214: Granted.
yvy has quit [Read error: Connection reset by peer]
<phoe>
Does CL-JSON have any means of pretty-printing JSONs it encodes?
<flip214>
phoe: I believe it doesn't. for display purposes I quite happily use the 'jq' utility for that.
jcowan has left #lisp [#lisp]
<aeth>
verisimilitude: I assume 64-bit and ASCII or ASCII-compatible Unicode, as well as assuming that optimizing for SBCL doesn't de-optimize for other implementations. This isn't because I'm a bad programmer, it's because you have to make assumptions somewhere and you can't support every possible CL implementation, only the ones you can test on.
<ogamita>
What's bother me more about cl-ecma-48 (and the same would apply to my own com.informatimago.common-lisp.cesarum.ecma048 and other libraries, when presented as read material to newbies, is the lack of specifications. psq could read and compare both libraries, but it would be rather useless, given that neither give very explicitely and clearly the specifications that led to their structure and implementation choices.
<aeth>
The thing is, making those assumptions can make things much easier and much more performant, and it's easy to go back and fix it if it causes issues on any actual implementation, rather than a hypothetical standards-conforming one
<ogamita>
The style and idiomaticity seems to me less relevant.
<ogamita>
Therefore my advice, would be to read PAIP, since it gives complete examples of code, but explaining where it comes from.
<aeth>
verisimilitude: The behavior of float-features is completely outside of the CL standard, but it becomes in a sense its own de facto standard by trying to portably run in every possible implementation. And then you just have to worry about a library, not sb-foo, ccl-foo, etc.
<ogamita>
verisimilitude: your first use of #=/## in cl-ecma-48.lisp is very inefficient, since you will insert in the code a mapcar 3 times, that will have to be evaluated 3 times in each situation listed in the eval-when. Instead you could have just defined a lexical variable!
<aeth>
Though, yes, lots of libraries use something lazy like #| fast route |# #+sbcl sb-int:with-float-traps-masked #| slow route |# #-sbcl progn
<no-defun-allowed>
You could also just call the function you define in that let too, and maybe remove the let and make the let values defvars as they seem fairly important.
<aeth>
verisimilitude: Oh and as long as you never use upper case anywhere, you could just do *print-case* to :downcase when generating your documentation code, if that's what's making it upper case.
<ogamita>
&AUX should only be used in macros, to add a lexical variable for a body, without having to parse its docstring and declarations to insert the LET.
v0|d has quit [Ping timeout: 268 seconds]
<aeth>
ogamita: no, boa constructors for defstruct seem to be another good place
<aeth>
In fact, I think I've seen them in defstruct before, and only there, and that's why I was surprised that they weren't just a defstruct thing
* shka__
is frequently using &aux for stuff like (lambda (value &aux (value (funcall key value)))
pierpal has joined #lisp
<ogamita>
Some conventions are enforced by tools, eg. emacs will indent comments differently according to the number of semicolons. Those convention are better respected.
<ogamita>
aeth: they're in the context of the defstruct macro; so yes. ;-)
<aeth>
ogamita: in which case, &aux is perfectly fine within the defun macro
<ogamita>
But I feel that for formal languages such as programming languages, idioms are very much less essential, because any valid form as a specified semantics.
<aeth>
"idiomatic" in programming is more about "if I post this to #lisp or /r/lisp or usenet or http://planet.lisp.org/ or wherever can other people read it?"
<ogamita>
Most of the grammatical natural language sentences are meaningless. Only idioms and conotations may give them some kind of meaning. And when you dig a little, often it's not even much of a meaning anyways.
<ogamita>
Technical aspects such as readability of #1# vs characters, or efficiency, or risk of errors (#=/## let you build circular sexps, and it's not conforming to give circular code to a CL compiler or interpreter!), are more important (and the only valid basis for "idiomaticity" in programming languages, IMO.
<ogamita>
)
<aeth>
Imo, all of the cleverness in Common Lisp should be reserved for certain special macros.
<aeth>
I'm removing most of the #. from my code.
<aeth>
Most of the time where you use #. you can do something similar with a macro at macro time.
<ogamita>
Did them make a clone of me, without me knowing it?
<aeth>
I'm not sure there's much use for any reader cleverness at all, except perhaps for literally embedding another language within CL (and whether or not that's a good idea, that can be debated)
<ogamita>
jdz: printers have had 132 columns at least, since forever!
<aeth>
e.g. Some people use reader macros for literal hash table syntax. I tried a library that used #H for that and it wasn't very good. It's imo better just to have a (hash-table* :foo 42 :bar 43 ...) macro
orivej has joined #lisp
<jdz>
ogamita: I don't print code on paper.
<ogamita>
jdz: defconstant is of very limited use in CL. It's just to let the compiler perform a small optimization of inserting fixnum or character literals as immediate data in the binary code.
<aeth>
(I think you'd only need literal hash table syntax if you wanted to print a hash table readably.)
<ogamita>
jdz: but our screen can show them! (and more).
<jdz>
But I do like to have multiple (usually 2) code files open one next to the other.
<ogamita>
Nobody use 80x25 anymore.
<jdz>
ogamita: Don't tell me what I do or don't do.
<aeth>
ogamita: but most constants are numbers (not just fixnum/single-float) or characters or keywords or symbols, and they tend to work correctly as constants
<ogamita>
jdz: you can always do (let ((*print-right-margin* 72)) (pprint the-code))
orivej has quit [Ping timeout: 240 seconds]
<ogamita>
aeth: Actually, for bignums and symbols, some processors allow full addresses as "immediate" values in the instruction codes, but notice that some other processors (usually risc, such as powerpc), need 2 instructions to load an address!
<ogamita>
In any case, defconstant is specified only for this purpose. For example, it doesn't play well with CASE.
<aeth>
ogamita: defining your own CASE is so common there should be a DEFINE-CASE-MACRO just like how there's a DEFINE-MODIFY-MACRO
<ogamita>
verisimilitude: your friend is wise: he's learned not to want what he can't attain (with C).
dddddd has quit [Remote host closed the connection]
rnmhdn has joined #lisp
wigust has joined #lisp
wigust- has quit [Ping timeout: 244 seconds]
adam4567 has left #lisp ["ERC (IRC client for Emacs 24.5.1)"]
hectorhonn has quit [Quit: Page closed]
shifty has quit [Ping timeout: 250 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
jochens has joined #lisp
rnmhdn has quit [Ping timeout: 245 seconds]
cvoxel has joined #lisp
rnmhdn has joined #lisp
cvoxel has left #lisp [#lisp]
m00natic has joined #lisp
rnmhdn has quit [Ping timeout: 250 seconds]
atgreen_ has joined #lisp
wilfredh has quit [Quit: Connection closed for inactivity]
igemnace has quit [Quit: WeeChat 2.3]
frgo_ has quit [Remote host closed the connection]
<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?
<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
<jdz>
dim: An inline function?
<jdz>
I mean inlined?
<dim>
oh found
<dim>
loop append
<dim>
ok make sense, I commented out something that returns a list usually
<dim>
and now I've broken my loop
milanj has joined #lisp
orivej has joined #lisp
<flip214>
better than the leg ;)
neirac has joined #lisp
<dim>
hehe
``Erik has quit [Ping timeout: 272 seconds]
<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
frgo has joined #lisp
<pfdietz>
"Your function and macros are way too big. They should be less than one screen."
kajo has quit [Ping timeout: 250 seconds]
orivej has quit [Ping timeout: 268 seconds]
<pfdietz>
But my functions are healthy bois that grow and grow.
<beach>
Oh, page 41 of the LUV slides actually mention the semicolon-count convention.
<neirac>
Do you use syntax highlighting when coding? as I grow older I started avoiding it.
<beach>
neirac: It is actually not that helpful the way it is currently done.
robdog has quit [Remote host closed the connection]
<flip214>
neirac: like the uppercase first character of german nouns I think it's helpful to get a quick overview.
<neirac>
beach I agree with that, I prefer highlight-sexp package in emacs instead of full syntax highlighting.
<beach>
neirac: What would be really useful would be to highlight symbols according to their roles.
<heisig>
The semicolon-count convention is even mentioned in the standard.
<beach>
heisig: So, someone who claims to know the language well has no excuse not to follow it. :)
<_death>
I think it's OK for newbies to read an eccentric program, if that's not the only program they read..
<beach>
Page 109 of the LUV slides is also interesting in view of recent discussions.
<beach>
"Read Other People's Code"
<pfdietz>
"Then cry as you realize how beautiful their code is, compared to yours, which is so flawed, you imposter."
<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.
<schweers>
I just have to ask: LUV slides?
<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)
<jackdaniel>
i.e experienced programmers may say, that dynamic typing is slow and unsafe, not necessary something we could agree with
<schweers>
Ah, thanks
<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?)
<dim>
those slides are top-notch advices, but I have not implemented enough discipline to follow them
<schweers>
I have that open, didn’t know it was known as LUV
<jackdaniel>
that said these style guidelines are very good imho
<shka__>
neither did i
<dim>
jackdaniel: he said that Python is a good enough Lisp IIRC... well we might disagree on that?
<pfdietz>
I recommend just one rule: document your damned code. Future you will thank you.
<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.
<dim>
hehe, I like that saying
<jackdaniel>
dim: exactly my point, I strongly disagree with that opinion of a hacker known for his experience :)
atgreen_ has quit [Ping timeout: 268 seconds]
<dim>
my reading was more that he had to capitulate at Google and they paid enough for him to switch to Python
<shka__>
regarding norvig style guide, i must admit that he really knows how to make a point
<dim>
Norvig's Python style in his sudoku solver in particular is not great
<shka__>
his examples are really top-notch
<pfdietz>
Are those like 10x programmers? (which are programmers who create enough technical debt to keep 10 others busy)
<neirac>
beach thanks for LUV link I have never read it, doing now.
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
nicksmaddog has quit [Ping timeout: 246 seconds]
SaganMan has joined #lisp
shka__ has quit [Quit: WeeChat 1.9.1]
orivej has joined #lisp
Josh_2 has joined #lisp
gxt has quit [Quit: WeeChat 2.3]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
LiamH has joined #lisp
Josh_2 has joined #lisp
Inline has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
vms14 has joined #lisp
akoana has joined #lisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
Lord_of_Life has joined #lisp
griddle has quit [Ping timeout: 268 seconds]
pjb has quit [Ping timeout: 252 seconds]
FreeBirdLjj has joined #lisp
shka_ has joined #lisp
griddle has joined #lisp
robotoad has joined #lisp
FreeBirdLjj has quit [Ping timeout: 246 seconds]
Josh_2 has joined #lisp
sjl_ has joined #lisp
vms14 has quit [Quit: Leaving]
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
nowhere_man has joined #lisp
rnmhdn has quit [Ping timeout: 246 seconds]
Zianic has joined #lisp
Essadon has joined #lisp
kajo has joined #lisp
robotoad has quit [Quit: robotoad]
Bike has left #lisp [#lisp]
Bike has joined #lisp
Zianic has quit [Quit: ERC (IRC client for Emacs 26.1)]
Zelmin has joined #lisp
schweers has quit [Ping timeout: 250 seconds]
pjb has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
ebrasca has joined #lisp
shifty has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
frgo has quit [Remote host closed the connection]
pierpal has joined #lisp
frgo has joined #lisp
orivej has quit [Ping timeout: 245 seconds]
frgo has quit [Read error: Connection reset by peer]
frgo_ has joined #lisp
akoana has left #lisp ["Leaving"]
pierpal has quit [Read error: Connection reset by peer]
Lycurgus has joined #lisp
varjag has joined #lisp
robotoad has joined #lisp
pierpal has joined #lisp
scymtym has quit [Ping timeout: 250 seconds]
jkordani has joined #lisp
<verisimilitude>
I can agree if you need nonstandard behavior you should use a library that provides a de-facto standard interface to it.
simendsjo has joined #lisp
<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.
<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.
kushal has quit [Read error: Connection reset by peer]
kushal has joined #lisp
scymtym has joined #lisp
rnmhdn has joined #lisp
graphene has quit [Remote host closed the connection]
jmercouris has joined #lisp
graphene has joined #lisp
<jmercouris>
so I'm trying to print a struct to do what we'd been discussing a few days, serializing the key-chords
<jmercouris>
however, it always prints with a prefix that has my package
<jmercouris>
like this: "#S(NEXT::KEY-CHORD :KEY-CODE NIL :KEY-STRING l :MODIFIERS (C))"
<jmercouris>
rather than like this: "#S(KEY-CHORD :KEY-CODE NIL :KEY-STRING l :MODIFIERS (C))"
<jmercouris>
is there a way to print without including the package? or something?
<jmercouris>
or will I have to write my own serialization?
<beach>
Bind *package* to the NEXT package.
<jmercouris>
like in a let or something?
<beach>
Yes.
<jmercouris>
let me give that a try
Zaab1t has joined #lisp
<jmercouris>
that did the trick!
Tristam has quit [Excess Flood]
Tristam has joined #lisp
<beach>
But then you have to make sure that NEXT package is current when you load the definition.
graphene has quit [Remote host closed the connection]
<jmercouris>
when you say "current"
<jmercouris>
what do you mean?
<jmercouris>
I did this: (let ((*package* (find-package 'next)))
<jackdaniel>
key-chord is a symbol in next package
<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
hiroaki has joined #lisp
<beach>
Presumably, you are printing this definition because you want to read it again at some point.
<jmercouris>
beach: I am not going to read it, I am serializing it to make the key to a hash table
<beach>
So it is going to stay on disk?
<jmercouris>
for a struct to be case sensitive
graphene has joined #lisp
<jmercouris>
as a key to a hash table
nowhere_man has quit [Ping timeout: 246 seconds]
<jmercouris>
sorry there is a lot of missing context here
<beach>
Hmm, OK, forget I asked.
<jmercouris>
but don't worry, I won't be reading again
Lycurgus has quit [Quit: Exeunt]
<jmercouris>
so it is not a problem
<jackdaniel>
wait, you "serialize" a structure name to string to access the key chord in a hash table?
<beach>
OK.
<jmercouris>
jackdaniel: yes, do you not remember the discussion? 3 days or so ago?
orivej has joined #lisp
<jackdaniel>
s/structure name/structure/
<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
<jmercouris>
my hash table was using :equalp as the comparison operator
<jmercouris>
which is fine, but equalp does not distinguish between "s" and "S"
<jackdaniel>
I don't (and if you think it was me who advised you to do that I'm sure you misunderstood)
<jmercouris>
jackdaniel: it was not you, it was Xach, and he didn't advise me on that exactly
<verisimilitude>
You'd get good results serializing a hash table as a plist or alist, instead.
<jmercouris>
he said to do something more clever
<jmercouris>
however, I'm doing something less clever, as I am less clever
<jackdaniel>
structure (not string which looks like its readable representation), may be compared with EQ
<verisimilitude>
You could then convert it back upon READing it in.
<jackdaniel>
are you sure you were not advised to have structure objects as keys?
<jackdaniel>
(and not strings)
<jmercouris>
Yes, I am completely sure
<jmercouris>
a key-chord struct describes a key-chord the user presses
<jmercouris>
they are generated at run-time all the time
<jmercouris>
I need to compare them to a hash map to see if they already exist
<jmercouris>
it would fail EQ
<jmercouris>
because they would not be the same instance
<jackdaniel>
what you do sounds terribly wrong, but maybe I'm missing a context. anyway I was leaving to grocery store
<verisimilitude>
I don't see anything wrong with using a structure as a hash table key.
<jackdaniel>
so don't mind me
<jmercouris>
ok
<jackdaniel>
verisimilitude: it is not using structure as a hash table key, but rather (format nil "~a" structure) as a key
<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.
<jmercouris>
Bike: Yes, EXACTLY!
<jmercouris>
if you see the conversation that I've linked to above, you'll see what I mean
<Bike>
using a string representation is very weird, but i don't have any better ideas off the top of my head.
<verisimilitude>
Oh, well that is poor, jackdaniel.
<jmercouris>
there was another idea of being able to use eq by binding things in keyword package
<jmercouris>
so that it would be a much quicker comparison than string comparison
<jmercouris>
however, I decided to just use strings
<verisimilitude>
At this point, I'd like to see precisely what you're doing for myself, if it's publicly available, jmercouris.
<pfdietz>
jmercouris: you could write your own print-object method for that structure class.
<pfdietz>
(answering a question asked upstream)
<jmercouris>
pfdietz: which is what I have done
<jmercouris>
it's called SERIALIZE-KEY-CHORD
<jmercouris>
it just internally uses format because I didn't feel like writing an actual function
<jmercouris>
verisimilitude: yes, it is publicly available
anewuser has joined #lisp
<verisimilitude>
Provide a link and I'll give my thoughts.
<_death>
jmercouris: instead write an actual function that is more careful about defining the serialization
<jmercouris>
_death: why?
graphene has quit [Remote host closed the connection]
<_death>
jmercouris: then you don't have to rely on aesthetic printing, consistent slot order, particular package being the current one, etc.
rumbler31 has quit [Ping timeout: 244 seconds]
<jmercouris>
fair enough, I shall rewrite it
graphene has joined #lisp
<_death>
if modifiers is a set, the order of the elements within it may also not be consistent
<jmercouris>
it is a list, and I always sort it
<jmercouris>
whenever I create a key-chord
<jmercouris>
well, it is also a set, as there are no duplicates
<jmercouris>
one moment, brb
orivej has quit [Ping timeout: 250 seconds]
<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
jochens has quit [Remote host closed the connection]
<_death>
do you have a description of what each slot of KEY-CHORD means
<jmercouris>
jackdaniel: what do you mean specializers?
<jackdaniel>
modifiers*
<jmercouris>
are you asking how many type of modifiers exist?
<jackdaniel>
sorry
<jmercouris>
a potentially infinite amount
<jmercouris>
it' a list of variable length
<jmercouris>
s/it'/its
<jackdaniel>
don't give me that. I'm asking how many, not how many potentially
<jmercouris>
I guess you would need a very large keyboard
<jmercouris>
my answer is being serious
<jmercouris>
so, on macOS, we have, super, shift, command, control, alt
<jasom>
9 keys is the maximum chording on USB
quipa has joined #lisp
<jmercouris>
but on Linux it could be anything else
<_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
<jmercouris>
I also think you can use xmodmap to define your own modifier keys ??
<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
<jasom>
oh sorry it's 14 on USB but 8 of them have to be C/S/A/windows
<jasom>
(there are separate left/right versions of those 4)
hhdave has quit [Ping timeout: 244 seconds]
<jmercouris>
jackdaniel: the point is, the number depends on OS
<jackdaniel>
I'm asking for practical purposes (i.e what user will be able/ will want to define)
<jmercouris>
anyways, we haven't set a hard limit on it, a platform port could potentially generate an infinite amount of types of modifiers
<jackdaniel>
let's assume 16 distinct keys and all their combinations (and we are being generous here imho)
<jmercouris>
jackdaniel: that's probably overkill, but yes
snits has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
<jackdaniel>
then you may have eql key as modifiers having 16 first bits and key-code shifted by that
<jackdaniel>
without key-string, no?
<jmercouris>
sure, I could make it so
notzmv has quit [Ping timeout: 250 seconds]
<jmercouris>
what would be the some reason why I might wish to do that?
<jmercouris>
over let's just say the approach _death has proposed
nowhere_man has joined #lisp
nitrix has joined #lisp
<nitrix>
Hi. I'm new to lisp; is the separate namespaces for functions and variables an accident or something that's desirable?
<jackdaniel>
using strings produced from structures as hashtable keys is unimaginably wrong in my eyes, so basically anything else is a progress
<nitrix>
e.g. (setq double 2) then (double double)
<jmercouris>
we've all committed our war crimes
frgo_ has quit [Remote host closed the connection]
<jackdaniel>
nitrix: it makes certain optimizations easier for the compiler
<jmercouris>
nitrix: nothing in Common Lisp is an accident, start with that premise
<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.
<jmercouris>
and you'll be right 99% of the time
frgo has joined #lisp
<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"
<nitrix>
That's comforting. Just to add onto that, (#double 10) would interpret my 2 from earlier as a function and likely crash, correct??
<nitrix>
s/\?\?/\?
<jasom>
nitrix: did you typo your example?
<jackdaniel>
nitrix: it may signal a condition if function is not defined
<jackdaniel>
Common Lisp implementations rarely crash
<Xach>
lol!
<nitrix>
jackdaniel: I've seen REPLs in videos receive some kind of interrupt, nice to know that the runtime's just as cool :)
<jackdaniel>
jasom: technically speaking they are lisp-n and lisp-(1+ n)
<jasom>
jackdaniel: so if we assume n is 1, then we are fine calling them lisp-1 and lisp-2 :)
<jackdaniel>
to be more prciese, n>1
<jackdaniel>
precise*
<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.
<jmercouris>
just out of curiosity, has anyone in this channel tried Next since the latest release? any bugs?
<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?
<nitrix>
I'm the crazy nut that'll be attempting to do OpenGL with Lisp.
<jmercouris>
nitrix: I think beach is working on something with regard to optimizing this specifically
<jasom>
nitrix: most lisp implementations are incrementally compiled
<jmercouris>
nitrix: you are not alone, there is someone who wrote some opengl cl interface
<jmercouris>
nitrix: I wish I could remember the name to tell you
<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.
<jasom>
nitrix: SBCL does do some JITing for method dispatch I believe.
<nitrix>
That's a bit overwhelming. The community doesn't have an implementation of choice it seems.
<jmercouris>
what? why is that overwhelming?
<jmercouris>
you prefer a hegemony?
<jasom>
nitrix: for free implementations, SBCL is more or less on top. (apologies to jackdaniel who maintains a quality implementation that isn't sbcl).
<jackdaniel>
nitrix: do you make a fuss about that C community can't chose between clang and gcc?
<nitrix>
Means I have to do some research to know what tradoffs I'm making; or better yet, build my own :P
<jackdaniel>
no apologies needed
<jmercouris>
build your own? you don't know anything about the language yet, why would you build an implementation?
<beach>
nitrix: You just ask here, and you give the kind of properties you need.
notzmv has quit [Ping timeout: 250 seconds]
<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.
<nitrix>
jmercouris: I'm comfortable writing toy compilers, but you're right that I'll be learning the language first, of course.
<nitrix>
I'm coming from Haskell (:
<nitrix>
(With C, Go and PHP backgrounds too)
<jmercouris>
writing a lisp implementation is non trivial
<jmercouris>
I don't know if you understand the magnitude of what it takes to write an ansi compliant common lisp implementation
<jmercouris>
its very arrogant to assume that you will write one
<jasom>
writing a non-toy lisp implementation is non-trivial; I can write a faux-scheme in a day.
<jasom>
but even a basic common lisp interpreter is a massive amount of work just because of the size of the standard.
<nitrix>
jmercouris: Probably ignorant more than arrogant. Let's not judge unknowlingly.
<jmercouris>
arrogance is the application of ignorance, but you are right, apologies for judging you so harshly, and so quickly
<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.
<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.
<jackdaniel>
implementation*
<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.
<nitrix>
So that's probably the chunk that I'm missing :P
<nitrix>
I'm reading on it though.
<jackdaniel>
nitrix: people here are mostly common lisp programmers
<pfdietz>
##lisp is for lisps in general
<nitrix>
It makes sense. No one really wants to re-invent Common Lisp out of lambda.
<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
quipa has quit [Read error: Connection reset by peer]
<jmercouris>
lol
<jmercouris>
how long have you been waiting to use that jackdaniel ?
<jackdaniel>
exactly 3s from idea conception to putting it on screen
<dlowe>
jackdaniel: pretty sure there's already a NIL
<jmercouris>
that's dissapointing, I was hoping this was your time to shine
<jackdaniel>
neirac: from my experience cl-jsown is the most performant and yason is very well designed (api-wise)
<pjb>
jmercouris: this is a very bad idea to convert anything to a string to be used as a key in a hash-table!
m00natic has quit [Read error: Connection reset by peer]
<jmercouris>
pjb: there is no other solution
<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
<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!
<pjb>
You could as well use a list.
<jmercouris>
pjb: I am in fact now using a list
<pjb>
Lists are not better, if they're more than 2 elements…
<jackdaniel>
jmercouris: I've just presented you other solution
<jackdaniel>
about half an hour ago
<jackdaniel>
so don't give us "there is no other solution" ;-)
<jmercouris>
ok, yes, I misspoke, there are other solutions
<jmercouris>
luckily, should my approach prove to be very dumb, I can easily change a single function, and voila!
ebrasca has quit [Remote host closed the connection]
<verisimilitude>
Verisimilitude is the appearance that something is real or true.
<jackdaniel>
also I have my doubts if your abstraction is right if you need to have things addressed with a structure
<jackdaniel>
but it is hard to tell without looking at the code (what I'm not willing to do right now)
<jmercouris>
jackdaniel: that's ok, no problem, I appreciate the critique regardless
<jmercouris>
helps me think a little bit more critically about my code
<jmercouris>
I want to write the best code I can of course
pierpal has quit [Quit: Poof]
<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.
pierpal has joined #lisp
<verisimilitude>
I just use the key that converts between viewing source and displaying as HTML in other browsers, pjb.
<jmercouris>
verisimilitude: unfortunately you are looking at an old version of the code already
<verisimilitude>
Oh, one of those hip new TLDs is it?
<verisimilitude>
This doesn't just redirect to a gmail does it, jmercouris?
<jmercouris>
pjb: interesting, feels a lot like I'm doing the job of make hash table by making a hash of the ojbect :D
<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.
<jmercouris>
but it could work, I will save that snippet
<jmercouris>
verisimilitude: no, I don't participate in the evil google empire
<verisimilitude>
What a nice attitude to see shared in this channel, for once.
<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?
<verisimilitude>
I'll make certain to email you later, then, although I may not have much to comment on the code.
<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?
<verisimilitude>
Rephrase that, pjb.
<jmercouris>
pjb: the list is of unknown length
mrcom has quit [Read error: Connection reset by peer]
<pjb>
jmercouris: in X there can be at most 8 modifiers.
<jmercouris>
sure, but what if we port to a non X system in the future?
<verisimilitude>
Good on you for not building in an arbitrary limit to your program, jmercouris.
<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
<verisimilitude>
That's good.
<verisimilitude>
That's the proper way to do things.
<pjb>
verisimilitude: for example, google like to have a TXT and SPF record in your domain.
<jmercouris>
pjb: key code is the hardware key code, not currently used ffor binding
<verisimilitude>
Oh; well I just don't care enough to capitulate to Google's arbitrary and changing demands, pjb.
<pjb>
jmercouris: perhaps it can be ignored as key in the hash-table then.
<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
<verisimilitude>
It's caused me some trouble, as you may know, but that just makes me more resolved to carry on.
<pjb>
verisimilitude: We'd need a gateway between normal internet and the web-internet :-)
<jmercouris>
verisimilitude: I even have my own source code source.atlas.engineer
<jmercouris>
I don't use gitlab nor github, I wrote it in CL
<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
<jmercouris>
pjb: I'm not familiar with that syntax, does that provide some compiler optimization?
<verisimilitude>
Shouldn't it already be licensed for public use?
<pjb>
jmercouris: you said that key-code = int, but no, it can be nil!
<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
<pjb>
key-code :type (or NULL integer) comes from (defstruct key-chord (key-code :type (or NULL integer)) …)
SaganMan has quit [Quit: WeeChat 1.6]
<jmercouris>
pjb: right, but does that do type checking for me? performance gains?
<jmercouris>
I'm still very ignorant about a lot of things ... :D
<pjb>
I don't care; it's to tell the programer what can be stored in the slot.
ealfonso has joined #lisp
<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.
<pjb>
But this is not my concern.
<jmercouris>
I see
<pjb>
Safety counts more than speed: computers nowadays are very fast, and if you need faster, you use GPU or quantum computers.
<jmercouris>
makes sense
<jmercouris>
hints to the developer
<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.
<jmercouris>
don't worry, my program uses about 10mb of ram per tab
<jmercouris>
and the complete lisp program is 50mb loaded into memory
<jmercouris>
so if you have 100 tabs open you'll use 1gb of memory
<jmercouris>
I'm quite a bit better than the abomination known as chrome
<verisimilitude>
I suppose that is strictly better, yes.
<jackdaniel>
do I remember correctly that you use webkit?
<jmercouris>
yes
<jmercouris>
now, before we go into this raging debate about sandboxes, it is supported in the latest release
<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.
<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.
<jmercouris>
if I had infinity money, tell you what, I would
<jmercouris>
but I don't, not yet at least
frgo has joined #lisp
<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.
dddddd has quit [Ping timeout: 250 seconds]
<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
<jmercouris>
just look at fireffox and servo
<jmercouris>
what a disaster, lots of benefits in quantum, but absolute money sink
pfdietz has quit [Remote host closed the connection]
<jmercouris>
my keyboard is a 2017 macbook pro keyboard, has a few issues...
<_death>
but why would you want your browser to run javascript... ;)
<jmercouris>
but why would you want your server to run javascript?
<jackdaniel>
it seems that macos and macbook has a lot of issues (keyboard, lags, crashes)
<jmercouris>
yet here we are 2018, node is a thing
<jmercouris>
no lag or crashing, just the keyboard
<verisimilitude>
I just meant you could do it relatively easily and without security issues, _death.
<jmercouris>
it was working fine until about like a month ago...
<jackdaniel>
you've said that x11 crashes on your macos ,)
<jmercouris>
that has more to do with the implementation of xquartz than macOS itself :D
<verisimilitude>
The WWW is an excellent example of how badly things can go wrong when there are too few implementations.
<_death>
verisimilitude: there are always security issues.. that's why I have js disabled by default
<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.
<pjb>
And furthermore, webassembly can be translated more efficiently than normal javascript.
<verisimilitude>
The WWW is also a good example of how poorly implemented ideas get piled on to make up for deficiences.
<verisimilitude>
As I like to write, the WWW is the UNIX of the Internet.
vtomole has joined #lisp
jmercouris has quit [Ping timeout: 240 seconds]
mrcom has joined #lisp
psqueak has quit [Remote host closed the connection]
ggole has quit [Quit: ggole]
Lycurgus has joined #lisp
Arcaelyx has joined #lisp
ealfonso has quit [Read error: Connection reset by peer]
ealfonso has joined #lisp
neirac has quit [Quit: Leaving]
kajo has quit [Ping timeout: 250 seconds]
dyelar has joined #lisp
kajo has joined #lisp
<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
<zigpaw>
e sanity checks of frontend data, cause noone sane would reverse engineer our monolithic sphaghetti ridden frontend code!) :P
vhost- has joined #lisp
hiroaki has quit [Ping timeout: 250 seconds]
rnmhdn has quit [Ping timeout: 250 seconds]
hiroaki has joined #lisp
hiroaki has quit [Ping timeout: 245 seconds]
graphene has quit [Remote host closed the connection]
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
vlatkoB has quit [Remote host closed the connection]
<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.
<aeth>
I think you would have to use runtime compilation to recompile the JS and essentially JIT it.
Zaab1t has quit [Quit: bye bye friends]
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
<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.
dddddd has joined #lisp
<verisimilitude>
JavaScript wasn't designed for JIT compilers.
<verisimilitude>
It was barely designed at all.
<verisimilitude>
I figure a rather naive implementation would be more than good enough, aeth.
Jesin has quit [Quit: Leaving]
permagreen has quit [Remote host closed the connection]
Jesin has joined #lisp
graphene has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt]
permagreen has joined #lisp
graphene has joined #lisp
varjag has joined #lisp
<no-defun-allowed>
Webasm would be nicer if it weren't horrid for implementing CL in.
<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.
sodaal has joined #lisp
<no-defun-allowed>
Also yes, XQuartz is very laggy and only got 100 rectangles/second on the rectangle drawing benchmark.
<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.
<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.
<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.
eminhi has joined #lisp
simendsjo has quit [Ping timeout: 240 seconds]
Josh_2 has quit [Ping timeout: 240 seconds]
graphene has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 246 seconds]
orivej has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
graphene has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
eminhi_ has joined #lisp
<aeth>
verisimilitude: Well, on the plus side, there should be plenty of benchmarks for you
graphene has quit [Remote host closed the connection]
eminhi has quit [Ping timeout: 246 seconds]
graphene has joined #lisp
pierpal has quit [Ping timeout: 250 seconds]
griddle has quit [Ping timeout: 268 seconds]
notzmv has joined #lisp
hiroaki has quit [Ping timeout: 240 seconds]
<eminhi_>
Why does trace output print arrays, even after setting *print-array* to nil? Are they on different threads?
ralt has joined #lisp
<ralt>
hi
<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.
<jackdaniel>
ralt: you need to create a pixmap and convert your pixel array to the format of that pixmap
<verisimilitude>
The output of TRACE is implementation-dependent, eminhi_.
<Bike>
eminhi_: it might rebind variables
<jackdaniel>
ralt: see demo/image.lisp:image-test-put-image function
<verisimilitude>
So there's no particular reason it would obey certain print values.
<verisimilitude>
It could just rebind them, yes.
<ralt>
jackdaniel: thanks, looking
<eminhi_>
Is there any way to suppress this in SBCL
<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
<ralt>
oh, yes
<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
<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
<jackdaniel>
then just grab mcclim and start from there ;-)
<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)
<ralt>
kk will do, thanks
<ralt>
(ql:quickload :mcclim)
<ralt>
err.
<ralt>
sorry
<jackdaniel>
what I can add is that McCLIM can render directly to PDF
<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 :)
<jackdaniel>
(see Examples/drawing-tests.lisp and see how all demos are written to these files)
<jackdaniel>
ah, sounds cool
themsay has joined #lisp
milanj has joined #lisp
<jackdaniel>
if you do it in McCLIM I'd love to be notified where do you host the repository
<jackdaniel>
(when you are done)
<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.
<ralt>
"signature" being a prepared image
<ralt>
so far, cl-pdf is good at editing a pdf to add an image at a predefined position
<jackdaniel>
ah, I thought that you are baking a PDF viewer in CL (something I have in plans for distant future:)
themsay has quit [Read error: Connection reset by peer]
<ralt>
the hard part is "selecting a part of a PDF"
<jackdaniel>
in distant*
themsay has joined #lisp
<ralt>
if I could avoid making a PDF viewer... I'd rather :)
<ralt>
writing a PDF renderer sounds like a nightmare
Jesin has quit [Quit: Leaving]
<verisimilitude>
Don't forget the PDF standard includes some form of JavaScript.
<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.
<ralt>
verisimilitude: I think I want to forget that
<jackdaniel>
this 1. looks like ECL, 2. looks like not all files from the ecl compilation are installed
<jackdaniel>
or that they are installed in a different directory than claimed when it was compiled
<jackdaniel>
I will check that though, thanks
<jackdaniel>
(so this "no translation" is not related to the system, rather ECL installation)
<ralt>
nope, sbcl
<jackdaniel>
SYS:DEFLATE.FAS ?
<jackdaniel>
I can assure you that this is ECL (or some close cousin like clasp) fasl file
<ralt>
hmmm some leftover file then?
<jackdaniel>
so maybe ASDF on SBCL has gone wild, can't tell
<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 :)
<jackdaniel>
good night
<ralt>
fair enough :)
<ralt>
good night
Rudolph has quit [Ping timeout: 240 seconds]
kajo has quit [Ping timeout: 250 seconds]
sodaal has quit [Quit: Leaving]
nowhere_man has joined #lisp
shifty has quit [Ping timeout: 250 seconds]
scymtym has quit [Ping timeout: 260 seconds]
kuwze has quit [Ping timeout: 256 seconds]
kajo has joined #lisp
psqueak has joined #lisp
Josh_2 has joined #lisp
robotoad has quit [Ping timeout: 250 seconds]
robotoad has joined #lisp
<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.
robotoad has quit [Ping timeout: 245 seconds]
robotoad has joined #lisp
orivej has quit [Ping timeout: 250 seconds]
LiamH has quit [Quit: Leaving.]
<aeth>
pjb: I think the past 20 years of software has shown that people will gladly accept something that's inferior but $0
<aeth>
The only exception seems to be some professional tools like Photoshop
<aeth>
But that's probably because people are taught Photoshop, not image editing
<aeth>
Actually you want to return (values foo bar)
<aeth>
Then you write an outer loop
Bike has quit []
<aeth>
The loop I gave splits it to (X 4 5 6 7 8) and (1 2 3) except I forgot to also return bar
<aeth>
Then you'd take (X 4 5 6 7 8) and redo the loop on the CDR until ENDP
pierpal has joined #lisp
<aeth>
phoe: This splits on one X, and since it returns the second part, it's easy to extend it to split until NIL. (loop :for sublist :on (list 1 2 3 'x 4 5 6 7 8) :until (eql (car sublist) 'x) :collect (car sublist) :into first-part :finally (return (values first-part (cdr sublist))))
<phoe>
aeth: I think I got it. It's too late for me to write that loop correctly though. I need to sleep first.
luhuaei has joined #lisp
pierpal has quit [Ping timeout: 250 seconds]
<aeth>
In case you want to make this sequence-generic, the vector version is actually easier: (let ((i (position 'x v))) (if i (values (subseq v 0 i) (subseq v (1+ i))) (values v (vector))))
<aeth>
This would copy more, though, so you'd probably want to split it all in one function, instead of repeatedly applying a simple split.
<aeth>
(It copies the tail.)
vtomole has quit [Ping timeout: 256 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
<phoe>
I only want it for lists.
Jesin has joined #lisp
jack_rabbit has joined #lisp
<aeth>
oh, oops, in case anyone reads my code later, you actually would want (valus v (subseq v (length v))) for the case if there is no match so that the empty vector is the same type (not counting length) as the provided one, e.g. (type-of (subseq (make-array 3 :element-type 'single-float :initial-contents (list 1f0 2f0 3f0)) 3)) => (simple-array single-float (0))
<aeth>
phoe: you can get rid of the setf by starting the loop with the line :for list := list :then tail
<aeth>
(unless loop doesn't know that list refers to the outer scope, in which case you'd have to call the variable list*)
<aeth>
I think you'd also have to move the end condition up
<aeth>
hmm, yes, you'd have to call the inner list list*
<aeth>
(the end condition would go after the binding of list*, not where it currently is)
yvy has quit [Read error: Connection reset by peer]
<aeth>
i.e. (loop for list* := list :then tail until (endp list*) for (head tail) = (loop for sublist on list* until (eql (car sublist) delimiter) collect (car sublist) into first-part finally (return (list first-part (cdr sublist)))) collect head)
<aeth>
(except without that ugly style mix of keywords and symbols)
<aeth>
This version works even if an empty list is given.
<aeth>
phoe: until (endp list) can go after the first for, unless that's SBCL-specific behavior
<phoe>
I think it's non-standard.
<phoe>
standard LOOP doesn't allow UNTIL to be mixed in between FORs.
mrcom has quit [Read error: Connection reset by peer]
<aeth>
Works in SBCL, CCL, and ECL. Either way, it shouldn't make a difference, though, because the split should be able to handle being run on an empty list.
<phoe>
(loop for x on '()) will terminate straight away
<phoe>
so that works
<aeth>
yeah, it'll add one tiny check (the inner loop terminating right away on '()) but not really noticable if you profile it
Oberon4278 has quit [Ping timeout: 240 seconds]
<pjb>
phoe: (split-sequence:split-sequence 'x '(1 x 2 3 x 4 5 x 6 x 7 x 8)) #| --> ((1) (2 3) (4 5) (6) (7) (8)) ; 13 |#
anewuser has quit [Ping timeout: 272 seconds]
psqueak has quit [Remote host closed the connection]
anewuser has joined #lisp
<aeth>
pjb: I'm not sure pulling in a library for 8 lines is a good idea
<phoe>
pjb: d'oh
<phoe>
obviously
<phoe>
how could I have forgotten of the famous SPLIT-SEQUENCE