freenode/#lisp - IRC Chatlog
Search
18:59:46
Bike
sure. actually i'd call it a great thing, depending on what you mean, because otherwise every non-fixed function call would actually be two function calls.
19:03:05
Jonsky
But what's the difference between inline and macro then? Apart from that macros do not evaluate the arguments
19:05:23
drmeister
Bike: I'm working towards adding dynamic-extent closures and it would be easier to recognize when I can use them if I inlined FUNCALL
19:34:17
kenanb
I am writing a metaclass that will hold a slot for initargs that is going to be prompted to application user while initializing an instance of such class. So it is a class option that looks similar to default-initargs (actually it defaults to default-initargs) but it is interactive, and there will be various interfaces of query, some might prompt for them one by one, some might add an input-field in application GUI for each of them and
19:37:46
kenanb
eventually the only assumption that holds about what is going to be done with those initargs is that they are going to be filled by the app user in some unspecified way, depending on the interface
20:32:33
PuercoPop
is is a call ensure-class guaranteed to result in a call to finalize-inheritance?
20:44:55
PuercoPop
kenanb: that what I thought, but 'User-Level language crafting' by Andreas Paepcke says otherwise; And postmodern 'attach'ing methods on finalize-inheritance insinuates otherwise as well https://github.com/marijnh/Postmodern/blob/master/postmodern/table.lisp#L69
20:55:25
PuercoPop
kenanb: yeah, stuff like that is why I thought that. The document from Paepcke is from before '93, so it is not authoritative in anyway
20:56:31
kenanb
PuercoPop: it is outside the scope of ensure-class to also ensure finalizing inheritance of the class, you cannot modify a class with forward referenced superclasses if ensure-class would always finalize
21:01:18
kenanb
PuercoPop: afaik Dmitry's answer here also applies to ensure-class http://stackoverflow.com/questions/17934605/class-finalization-how-to-avoid-creating-dummy-instances
21:11:58
learning
has anyone here used incudine? (http://incudine.sourceforge.net/) I'm trying to run the examples, but it says that sbcl can't find the scratch package. i tried copying it into my quicklisp local-projects dir, but no cigar.
21:12:36
learning
the install file says i need to go into my registry and symlink the asd file, but i'm on osx, so that doesnt make any sense to me
21:15:41
Bicyclidine
you should probably be able to copy it into local-projects. try calling ql:register-local-projects
21:16:32
learning
yeah osx has symlinks, but its not clear where i'm supposed to create a symlink from. ill try calling it
21:17:17
Bicyclidine
a symlink in local-projects to whtever you put incudine. obviously it shouldn't be necessary if incudine is already there.
21:27:52
kenanb
learning: I just cloned the repo to my local-projects and did (ql:quickload :incudine) and it loads
21:29:39
Bicyclidine
if it's in local projects quickload will load it there. did you load it before trying to run an example? because you need to do that.
21:30:07
kenanb
when in your quicklisp local-projects directory in terminal, do a "git clone git://git.code.sf.net/p/incudine/incudine" then load using quickload with (ql:quickload :incudine) from your lisp implementation
21:30:56
kenanb
learning: it is not in quicklisp, you clone the repository into your local-projects before calling it with quicklisp, quicklisp first search for local version of a repo before downloading anything
21:31:26
learning
im getting some sort of cffi error. when trying to load it now. im gonna try to debug it
21:32:31
learning
i understand now bicyc. it was pretty dumb of me to try to run the examples without seeing if i could load the package first lol
21:32:35
kenanb
learning: that is probably because you are missing some libraries in your system, search for the library name and install the libs necessary
21:39:53
learning
yeah you're right, there are libraries i need to dl that are listed on the webpage
21:40:34
kenanb
learning: it is layers upon layers, for a good reason, it is a complex task, quicklisp is not mentioned there because it didn't exist back then, but is just another layer on top of ASDF, which downloads the system if absent, and uses ASDF to load it. So once the "system" can be located locally, it is pretty much just ASDF loading it in the background. It is much easier to build a new system you found online once you familiarize yourself
21:43:01
kenanb
learning: yeah but you do not just "write" audio files, you compute them, write them, interact with them through open channels on audio server, play them back etc.
21:43:02
p_l
Theoretically it's pretty simple (ALSA gives you access to hw), but then PC sound hw had to regress to bare minimum of *nix workstations
21:43:50
kenanb
one application may be using only a small subset of those stuff, but since all those stuff is seperate things, the libraries needed by the small subset is almost always the complete relevant library stack
21:46:53
dlowe
you can with arduino kits and stuff. Just twiddle a bit on an I/O line hooked directly to a speaker.
21:47:28
dlowe
But yeah, like Bicyclidine said, these days there's just an unimaginable amount of metal.
21:47:52
Bicyclidine
on my board there's two op amps and a bunch of other junk between the GPIO and speaker. WAY too high level an interface!!
21:48:33
jasom
/dev/dsp gave you pretty close to the metal audio, but then only one process can output audio at a time, which isn't what most people want
21:59:00
learning
i was having issues with one lib, so i googled and someone said they used homebrew. turns out all of the libs are installable via homebrew
22:01:14
alandipert
jackdaniel, so i found the `--disable-shared` option and build ECL and saw .a files. but when i run ecl again and call compile-file with `:system-p t`, it emits a .fasc instead of a .o
22:44:35
mr_yogurt
that's one of the other questions I had. How similar are the different "dialects" of lisp?
22:45:48
pillton
They are quite different in terms of specification and in terms of community. This channel discusses common lisp.
22:46:06
learning
to get the basics I would recommend lisp koans https://github.com/google/lisp-koans
22:49:05
antoszka
mr_yogurt: you might also join #clnoobs if you decide to stick to Common Lisp (which most here will recommend anyway ;))
22:50:37
learning
i would give PCL a shot, if you find that its too much text use the koans, and for more advanced topics I liked lisptips.com
22:53:48
pillton
my_yogurt: In my experience, your previous experience will hinder you rather than serve you.
22:56:42
pavelpenev
after a few languages it becomes easier and you realize that most langs are just some combination of algol, lisp and smalltalk with a weird syntax
22:57:12
pavelpenev
but if you only know a few languages, you tend to write code the same way you wrote in your first
22:59:03
kenanb
it really depends where your previous experience will put you, Carmack is learning lisp really nicely so far :)
23:00:07
pavelpenev
kenanb: Carmak has been at it for a few years now, hasn't he? Plus he's "rocket science" smart :) I'd expect him to be able to learn pretty much anything properly
23:00:21
PuercoPop
when learning something new it is best to try to avoid 'learning' it in terms of things you already know ('by analogy'). It is a surefire way to avoid learning altogether
23:00:49
mr_yogurt
are you guys talking about john carmack or someone else I'm not familiar with? (granted i'm not really familiar with john carmack either)
23:01:21
p_l
mr_yogurt: john carmack of id3 software, yes. He is currently writing VR software in Lisp (racket specifically)
23:02:20
kenanb
pavelpenev: that was actually exactly what I meant, so many C++ programmers write C++ for years very aware of the problems with the paradigm by experience, when they do the switch they quickly grasp most of the concepts involved because they were inventing similar versions in their heads for years now
23:03:25
pavelpenev
kenanb: yes, every C programmer has implemented linked lists and vtables :) I'd imagine there's a list of stuff every C++ programmer implements eventually :)
23:04:39
p_l
pavelpenev: I wonder how much of that comes from C++'s utterly atrocious native virtual calls :D
23:05:15
kenanb
pavelpenev: yeah, those are good examples. not all C++ coders are completely brainwashed by the language, many of them are using it because they have to, and they keep using it after they learn lisp because, again, they have to.
23:05:54
p_l
I've seen a job advert that talks about lisp, but unfortunately also C++ in Visual Studio. Visual Studio I can stand, C++ scares me tbh
23:07:33
pavelpenev
* every once in a while gets the urge to write C++ code. It passes after a few minutes, but that moment is scary
23:32:49
p_l
https://www.reddit.com/r/retrobattlestations/comments/464nep/my_current_battle_station_supporting_frantic_work/ <--- wow
0:28:35
fiddlerwoaroof
Fare: I think there's some sort of unspoken rule that every Lisper must use his own test library, documentation generator and html generator
0:31:07
Fare
not a documentation extracter, though, just a better way to write web pages with footnotes.
0:36:20
pillton
Fare: I am currently doing the following to accommodate the case where the source code is deleted.
0:37:21
pillton
It isn't a bad idea because the tests confirm that the user hasn't messed with resolving dependencies of shared libraries.
0:39:27
Fare
but it requires a patch to sbcl that was reverted because it didn't work on all platforms.
0:40:42
pillton
The paste I pasted disables the loading of source code. Is this something worth considering in ASDF?
0:41:07
fiddlerwoaroof
* is going to build a library that makes Lisp comments relevant to the program's execution, so he can have the sort of fun in Lisp that he's having in PHP.
0:42:30
dreamaddict
as in, I made some functions in a program defpuns, and now the (time) readout for the program shows much more CPU usage, but twice as long running time and a number of seconds for "total run time" that is WAY off
0:43:09
fiddlerwoaroof
dreamaddict: I suspect that it's summing the runtime per core, or something like that.
0:43:36
dreamaddict
but the part where the program now takes 14 seconds to run, instead of 5, still doesn't make sense :P
0:44:03
dreamaddict
unless the explanation is...I don't know what I am doing trying to add multithreading to my code!
0:45:25
fiddlerwoaroof
There's probably some way to tell how much time is being spent on messaging, locking and such and how much time is spent actually running.
0:48:46
Fare
but with some :around methods and a special variable, you should be able to achieve the same effect portably
0:49:20
pillton
Fare: I'm interested in the goal, not the implementation. There is no point pursing portability if you aren't interested.
0:52:49
Fare
support for working in multiple images isn't complete in ASDF3, even though all the basics to make it possible are now there.
0:54:02
dreamaddict
I don't know yet...I've never tried multithreading anything before, this is all a science experiment right now :P
1:00:17
Fare
pillton, if you're interested in making ASDF4 happen, I'm sure everyone will be happy to let you become the new maintainer
1:33:55
dreamaddict
wow, it looks like about 90% of the run time is overhead from the parallelization
2:40:37
drmeister
If I allocate a closure on the stack (dynamic extent) under what conditions can I allocate the cells on the stack as well?
2:42:01
Bike
I don't understand how the cells could be needed outside of the dynamic extent of the closure itself? I mean, unless you're talking about multiple closures with the same environment, I guess
2:43:36
drmeister
In situations like (compile 'foo (lambda (a) (funcall (lambda (x) (list a x)) 1)))
2:57:47
drmeister
(clasp-cleavir:cleavir-compile 'foo '(lambda () (let ((x 1) (y 2)) (values (lambda (xx yy) (setq x xx) (setq y yy)) (lambda () (cleavir-primop:funcall (lambda (z) (list x y z)) 3))))) :debug t)
3:01:27
drmeister
It looks like since G7434:12 and G7426:14 are inputs for two "enclose" instructions they have to have indefinite extent.
3:05:04
Bike
but if those functions were used in something and were dynamic-extent then you could allocate the cells on the stack.
3:09:10
drmeister
(clasp-cleavir:cleavir-compile nil '(lambda () (let ((x 1) (y 2)) (cleavir-primop:funcall (lambda ( z) (list x y z)) 3))) :debug t)
3:12:01
Bike
Every time you call (lambda () ...) it makes a closure that returns the same x and y. if you don't just optimize out the funcall entirely, anyway. so the x and y have to be stored somewhere between calls.
3:13:49
Bike
(lambda () (funcall (lambda (z) (list 1 2 z)))) or (lambda () (list 1 2 z)) would be equivalent even if 1 and 2 were side effectful complex forms, so yeah the cells can be on the stack. proof by sledgehammer rewrite
3:14:18
drmeister
Cleavir doesn't optimize this stuff out. So I'm looking into putting the closure created by this enclose on the stack.
3:15:52
Bike
i think it's basically just that the cells can be dynamic extent if every closure they're in is dynamic-extent, still.
3:19:03
drmeister
(clasp-cleavir:cleavir-compile 'foo '(lambda () (let ((x 1) (y 2)) #'(lambda () (cleavir-primop:funcall (lambda ( z) (list x y z)) 3)))) :debug t)
3:19:51
drmeister
Calling (foo) returns a closure - but the cells for x and y are bound in the (foo) call, not each time the closure is called.
3:23:26
drmeister
The "enclose" that the red arrow points to is the one that I can make dynamic extent.
3:24:49
drmeister
The inner one is the one created by (cleavir-primop:funcall (lambda (z) (list x y z)) 3)
3:25:37
drmeister
Yes, I believe that I can dynamic extentify it. Because that closure cannot escape.
3:26:01
Bike
It can't escape from the #'(lambda () ...) closure, which has already escaped from the dynamic extent of the let, is what i mean, see?
3:27:10
drmeister
Here's my current problem. Everytime I call the #'(lambda () ...) closure another closure is consed.
3:28:00
Bike
i think that might be inevitable, if you don't just collapse (funcall (lambda ...)) instead.
3:28:44
Bike
the bindings there have to be on the heap. if associating existing bindings with a body to make a closure is an allocation, well, no luck
3:30:01
drmeister
Well, I could do this. I could alloca space on the stack for three slots, pointers to the two cells G8376:36 and G8371:39 and the function pointer to named-enter(LAMBDA):48 - and then replace the circled "enclose" instruction with an instruction that initialized those three stack slots and passed this stack allocated closure to funcall.
3:31:06
drmeister
The bindings will still be on the heap - they were created in the outer function (foo) by Create cell:11 and create cell:13
3:32:41
drmeister
What's the alternative? To sort of "inline" the named-enter(LAMBDA):48 function where the circled "enclose" and funcall:45 are - isn't it?
3:34:01
Bike
the two choices for optimization i see are the stack thing you just said, and just inlining the lambda to get whatever #'(lambda () (list x y z)) compiles to.
3:36:03
drmeister
Right, except the lambda-list can have &optional, &rest, &key and &aux - the inlining would have have to handle those.
3:38:55
drmeister
I think it's relatively easy to add dynamic extent closures and recognize when they can safely be used. When cleavir can do the inlining it will gracefully bypass it.
3:39:51
drmeister
dynamic extent closures will also be useful for call-with-variable-bound for special variables and cleavir will probably never inline those.
3:50:00
_z
Do you guys know of any tool that goes through a program step by step until it's finished, show what values it changes, stores etc? Having a hard time understanding https://pastee.org/hv9vd
4:09:11
|3b|
_z: sbcl can do a bit of that with slime, if you compile with full debug settings. there are also some separate libraries implementing it. you might also find TRACE useful, it just shows the arguments and return values every time the traced function is called, but that is usually enough for simple functions like that
4:10:14
|3b|
(just keep in mind you aren't allowed to TRACE functions defined by CL itself, since they might have been used to implement TRACE in which case you have a problem)
4:12:08
_z
|3b|, trace isnt really that detailed, its simply showing me the values getting bound to vars, and the output returned.
4:22:59
beach
drmeister: [I am reading the logs] Escape analysis is tricky business. I advise against attempting some temporary kludge like I did with REMOVE-USELESS-VARIABLES. What is needed is a complete dataflow analysis.
4:23:01
beach
Unfortunately, in the literature, they assume simple languages such as C with no nested functions, so there is research to be done. If you are willing to help me with the research, that's great, but it shall have to wait until after I finish my ELS papers.
4:34:07
drmeister
beach: Hi - I understand. I'm looking at the trivial case of (funcall (lambda (...) ...) ...)
4:37:31
drmeister
We were talking about this a couple of days ago. I thought if an enclose instruction has a single output and it feeds into the first input of a MVC or FUNCALL that the closure could be allocated on the stack.
4:39:27
beach
drmeister: You can attempt it if you want, but I am just telling you that it is VERY HARD STUFF.
4:42:09
|3b|
^ is the official specification of the function, but whatever text you are reading might have an easier to understand description
4:50:26
beach
_z: So, first your function checks whether A is in list-1. That call returns (A) which is true, so REMOVE-IF-NOT keeps the A. Then it checks whether S is in list-1. That call returns (S R A) which is also true, so REMOVE-IF-NOT keeps the S as well. For all the other calls to the predicate, it returns false, so no other elements are kept.
6:38:31
jackdaniel
alandipert: to build a static library from *within* the ECL, you have to provide :type :lib to asdf:make-build
6:39:23
jackdaniel
alandipert: https://common-lisp.net/project/ecl/manual/ch26.html#table.make-build and https://common-lisp.net/project/ecl/manual/re55.html