freenode/#lisp - IRC Chatlog
Search
20:46:43
emaczen`
I'm using CFFI with opencv and I've defined (defcfun "cvNamedWindow" :int (name :string) (flags :int)), and it will open a window with CCL but not SBCL
20:54:25
jackdaniel
emaczen`: one thing is that you must call this function from your main thread (starting one)
20:58:48
jmercouris
any more recent performance benchmarks than these: http://www.cliki.net/Performance%20Benchmarks?
21:00:40
jackdaniel
jmercouris: https://common-lisp.net/project/ecl/static/files/misc/benchmarks/2016-05-bench-all.html
21:28:17
Josh_2
So I have this code http://paste.lisp.org/display/358158 and It currently enters the debugger and lets me choose my restart (division-by-zero-1 ..) however it is written like the example at the top of PCL page 240. I'm a lot confused about this.
21:32:57
jmercouris
like for example a defmacro that expands to a particular code on OSX and a different one on Linux
21:36:36
basket
jmercouris: You want the #+ read macro, you would use it like #+linux (foo) and foo would be evaluated iff :linux is in *features*, otherwise it's as if it were commented out
21:39:03
_death
Josh_2: there are several issues.. you define a DIVISION-BY-ZERO-1 condition, but never signal it.. when the division by zero will occur, a DIVISION-BY-ZERO error will be signaled by lisp.. you use the same name for a restart, which is just confusing; a better name would be, say, RETURN-NIL.. in N-RANDOM, you set up a handler in each iteration, which is unnecessary, you can have it once outside the loop.. you handle DIVISION-BY-ZERO-1
21:39:03
_death
conditions, which are, again, not signaled anywhere.. your handler function takes no arguments, but it should take one - the condition object
21:43:09
Josh_2
I'm very confused and there is so much information in this chapter that I'm finding it hard to ask a specific question
21:51:25
Bike
well this is the main one. if you want to handle a condition, it has to be signaled somewhere
22:00:25
Josh_2
Well I don't have to manually trigger an error of type "division-by-zero" because (mod.. will do that on it's own, so how do I catch that with a (handler-bind instead of a handler-case
22:01:24
Bike
you have the handler specialize on DIVISION-BY-ZERO, instead of DIVISION-BY-ZERO-1 like you have now.
22:02:42
Bike
yes, you'd have to define a condition class called DIVISION-BY-ZERO-1 and signal it yourself, as by ERROR.
22:04:28
Josh_2
Okay, so now now it'll look back on the stack for a handler that can deal a division-by-zero error?
22:05:21
Bike
you can try in your repl (handler-case (mod 7 0) (division-by-zero (c) (declare (ignore c)) (print 'in-handler)))
22:06:10
Bike
i know. i'm just trying to get across how the types in handler-bind and handler-case work. that part is identical between them.
22:07:55
Josh_2
Is it? Because in PCL it says that handler-bind must take a function-object unlike handler-case
22:16:48
Josh_2
I know how to get handler-case to work. I don't know how to put the handler for division-by-zero on the stack.
22:18:18
Bike
you want to handle conditions of type DIVISION-BY-ZERO, so you'll write like (handler-bind ((division-by-zero ...)) ...)
22:23:19
Bike
you had the syntax right before, (handler-bind ((division-by-zero #'(lambda ...))) ...)
22:30:00
Bike
if you are having a specific problem, please elaborate on it, i am not looking over your shoulder
22:32:00
Bike
type is division-by-zero, handler is a function of one argument that invokes your restart, form* is going to call your function that calls mod
0:07:40
MetaYan
scymtym: ironclad timing - full logs: https://pastebin.com/P62a5WR1 (scymtym) and https://pastebin.com/0ErHUQiy (sbcl 1.4.0)
0:21:51
MetaYan
Those pastes are benchmarks for scymtym - some optimizations in SBCL. ironclad compiles in 25s instead of 66s.
2:18:32
jmercouris
I don't want to use lisp to write to it or anything, I just have to make sure it exists
2:19:12
jmercouris
I guess I can probe-file to see if it exists, but is there a way to just do like "touch"?
2:21:15
White_Flame
with with-open-file, it should just be a single clause, probably shorter than most languages
2:26:34
jmercouris
hey everyone, sometimes slime doesn't show the function I'm working on in the message buffer, like it won't show me the current parameter I am on, any reason why that could be?
2:29:54
jmercouris
It keeps putting strange stuff in my messages buffer: error in process filter: Wrong number of arguments: nil, 137
3:05:50
jmercouris
for anyone curious what the issue is, I forgotten I had patched the lisp I compiled on my system to remove the help doc...
3:54:42
jmercouris
didi: I think it should be like deleting a file, right? I mean at least on unix, a directory is just a file
4:11:26
jmercouris
I'm also thinking about how to improve the rendering performance of the actual webview
4:33:31
emaczen`
I've only ever served data that isn't constantly being updated? I'm confused in terms of that constant change
5:45:40
jmercouris
what's the best way to transform from the 1st list, to the 2nd list: https://gist.github.com/237e37287765c1682e889aa39e25236d
5:48:29
beach
jmercouris: There might be simpler solutions, but you have only given one example. Do all the sub-lists in the initial case have a single element? Does the first list always have two sub-lists? etc, etc.
5:57:56
beach
jmercouris: If you draw the box diagram of you first list, you will immediately see the solution.
5:59:01
beach
jmercouris: And if you don't know the structure of that list in the form of box diagrams, you need to learn it. Otherwise, there are some very fundamental things about Common Lisp that you won't understand.
5:59:06
jmercouris
beach: is this a good place to start? http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.html
5:59:48
jmercouris
I don't know, everytime I look at my code it looks just like I've written python with lisp syntax
6:02:10
phoe_
jmercouris: it's possible - it takes some time and a lot of code writing/reading/posting it up for others to review to get used to writing somewhat idiomatic Lisp.
6:04:20
scymtym
MetaYan: thank you, that is about the expected speedup. a bit more than in my experiments even
6:04:26
phoe_
jmercouris: "it takes a day to learn Lisp, unless you know C, at which point it's three days"
6:04:56
phoe_
I have no idea about averages. Just keep on writing Lisp, reading it, and posting it up for review.
6:06:29
whoman
and reading about it; getting into the zone, the mind set of other lisp coders and it rubs off.
6:06:31
beach
To become an expert in just about anything takes around 10000 hours of practice, according to many sources.
6:07:37
beach
That's a necessary, but not sufficient, condition. If you do it wrong, you will still be a beginner after 10k hours, like most professional software developers.
6:08:23
beach
"In software development, people don't have 10 years of experience. They have 1 year of experience 10 times."
6:10:41
beach
But if you mean two such programmers with the same amount of practice, then "intellectual curiosity".
6:11:22
jmercouris
I'm saying something like, what is the difference between an expert and a beginner
6:12:42
beach
jmercouris: So he or she will read code, articles, books, etc. And he or she will try new things, fail, fix it, try again, etc.
6:14:00
whoman
solve problems [efficiently, tactfully, openly, ..] think of construction work on houses. what would be the difference between an expert builder and a beginner. let's imagine the houses they would each build
6:14:20
shka_
"In software development, people don't have 10 years of experience. They have 1 year of experience 10 times."
6:15:20
jmercouris
I've worked with a lot of developers, and they seem to really know their domain, so idk, maybe it is the kinds of people I work with, or perhaps I am one of them and don't know it
6:16:46
beach
jmercouris: Congratulations, you are very lucky. For example, I myself consider it an absolute necessity for a developer who is supposed to write efficient code, to know all about what the compiler is capable of, so he or she needs to know everything about compiler design.
6:16:48
jmercouris
should you just know a little of everything? or be an absolute expert in a domain
6:17:27
jmercouris
I think it can be advantageous to know the compiler, but also DETRIMENTAL to know the compiler
6:17:41
jmercouris
the whole purpose of the compiler is to serve as an abstraction between lower level bytecode and what we're writing
6:17:56
jmercouris
as soon as we break that abstraction, we start writing code outside of the spirit of whatever language it is
6:17:56
beach
jmercouris: But I know very few developers who even care about what the compiler does. Of course, there are jobs where it doesn't matter if you write efficient code or not.
6:18:22
jmercouris
If we wanted the efficiency of things below the compiler, we'd write in assembler
6:18:25
shka_
jmercouris: i would rather say that the purpose of the language is to act as mere interface to compiler :]
6:19:14
beach
jmercouris: I think you misunderstand my point. What I see over and over again are developers who don't know what the compiler is capable of, so they write "optimized" code that is not necessary, and can even be worse than the "unoptimized" version.
6:20:22
beach
jmercouris: And, because they have no idea what the compiler is capable of, they either just guess, or they go by rumors that are sometimes several decades old.
6:21:01
jmercouris
where bad habits carry over from python 2 to python 3 and the performance of things is vastly different
6:21:13
shka_
anyway, I, personally, CONSTANTLY switch domain which comes with a price of being in "I have no idea what i am doing" state most of the time
6:22:36
flip214
jmercouris: I believe the advantage of "advanced programmers" is just that they've seen much more kinds of problems already,
6:22:51
beach
jmercouris: And I am betting that there are still people who replace functions by macros in C for reasons of efficiency, not knowing that 1. The VAX is no longer a relevant platform, and 2. The compiler can inline functions these days.
6:23:28
flip214
what kind of performance different approaches give, what happens when something doesn't work (everything stops, or only some part stops), etc
6:24:49
beach
I also think it is a good fit, because to me McNuggets, McGazpacho, etc, suggest "not quite real nuggets", "not quite real gazpacho", so this is "not quite real CLIM".
6:25:42
jmercouris
I want to make a goto converter that just takes all of your control structures in java and transforms them into gotos
6:26:33
jmercouris
beach: how long have you been programming, how long have you been programming in lisp?
6:30:02
jmercouris
beach: Also I keep thinking about what you said about mixing foreign code with the actual data structures in my program
6:30:26
jmercouris
It was something about having the actual GUI toolkit in a separate thread communicating over some channel so that the state can never be broken
6:31:50
jmercouris
It would be cool if the GUI could entirely crash, and the program would still function, or if it could be daemonized
6:33:27
beach
jmercouris: OK, here is another bit of my experience: Over and over, I find that industry projects decide to use C++ "because we need all the performance we can get". What they don't realize is that that statement is equivalent to this one: "No matter how minuscule a performance advantage we get, we are willing to spend any amount of time, energy, and money, to get it". When they realize that this is what they have actually said,
6:34:46
flip214
jmercouris: to have the GUI and the backend work independently, they'd need to be separate processes.
6:35:01
beach
jmercouris: And here is another one for you: Most professional software developers know nothing about the factors that determine performance. So again, they guess, or they go by rumors, with huge amounts of wasted time and energy.
6:35:05
jmercouris
Well yeah, that's what I'm saying, separate processes with a socket or something between them
6:36:07
flip214
jmercouris: so your browser backend would communicate with the frontend via HTTP? ;)
6:36:11
beach
flip214: Yes, and most professionals are bad. A "professional" is someone who does something for money, and an "amateur" is someone who does something out of love. By definition.
6:36:51
flip214
beach: well, I'm doing IT "professionally" because I have to support me and my family.
6:37:00
jmercouris
flip214: Currently my implementation has them both tightly integrated together, I don't understand enough about the libraries I'm using to know if they are on the same thread or not
6:37:15
beach
flip214: It is very unfortunate that "professional" is misunderstood as "good", simply because that is definitely not the case for most people.
6:37:38
jmercouris
flip214: At any rate, my program can crash (in the lisp sense) and stay running, but if the QT part crashes, it's not nearly as nice of a result :D
6:37:45
flip214
I've seen a MSc that didn't know the difference between array, list, set, and hash-tables...
6:38:26
jmercouris
MSc of IT is not really a software engineer though, they are just system administrators, no?
6:39:40
flip214
beach: well, my previous employer god rid of him again. perhaps a bit because I insisted, too.
6:40:11
flip214
jmercouris: learning it in school. and he was proud of it, so he doesn't deserve any better.
6:40:42
flip214
joking aside, this is a case of people knowing so _little_ about IT that they're not able to make informed comparisons.
6:41:49
jmercouris
maybe the people I imagine I am better than are actually better than me, but I have this illusion that I am better than them because I don't know
6:42:06
beach
jmercouris: Here is another one for you: I think that every professional software developer should know Common Lisp. Not in order to use it in their job, which is unlikely anyway, but in order to know more techniques for structuring code, and in order to know what they are missing when they use whatever they have to.
6:42:40
jmercouris
I mean, is it a good thing if you know what you are missing out on? Maybe ignorance is bliss
6:42:54
beach
So, in summary, a professional software developer who doesn't know about compiler design, and who doesn't know Common Lisp, is not a great professional software developer.
6:43:55
jmercouris
Ah yes, I was always very good at data structures, but never good at time complexity
6:44:31
beach
And I bet the same people who "need all the performance they can get" are typically ignorant about those things.
6:45:27
jmercouris
Like, I had to implement a tree, and I couldn't remember how to do rotation transformation to keep it balanced
6:46:33
flip214
you'll need to know about various data _structures_ - linked lists, double-linked lists, arrays, hash-tables, binary trees, tries, skip-lists, bloom filters, etc.
6:46:37
jmercouris
flip214: Oh yeah, normally you are 100% right, this was a very particular use case
6:46:42
beach
Most professional software developers don't need to implement balanced trees. But they need to be "good consumers", i.e. knowing the performance characteristics so that they can choose the right data structure. But they typically don't, as flip214 pointed out.
6:48:07
jmercouris
It's very fun when you can get some clever tradeoff by combining several strategies together
6:48:28
jmercouris
or even by having the same data reprsented by several structures for performance gains in indexing, search, deletion etc
6:48:40
jmercouris
usually the memory of the data structure itself is so light weight that you can do so much
6:48:43
flip214
AFAICT, the big problem is not "choosing a red-black tree vs. an AVL tree", but "is it < 10 elements? use a list or simple array. is access needed in O(1)? use a hash-table. etc." (simplified.)
6:48:49
beach
shka_: Sure. I am one of them. My Cluffer library is an example of a data structure that I have been working on for a few decades.
6:48:50
shka_
personally i don't understand guys that have no clue about that structures because common, this stuff is awesome
6:52:04
flip214
jmercouris: see eg. https://news.ycombinator.com/item?id=15199642 for some discussions, also the article
6:53:26
beach
I don't think there is a widely agreed-upon definition of "buffer" as an abstract data type.
6:54:35
jmercouris
beach: In computer science, a data buffer (or just buffer) is a region of a physical memory storage used to temporarily store data while it is being moved from one place to another