libera/#commonlisp - IRC Chatlog
Search
20:23:13
Bike
that's probably not possible, because lisp arrays usually have header data that wouldn't be in foreign controlled memory.
20:30:28
random-nick
Guest74: mem-aref seems to have a compiler macro which eventually directly calls SBCL's function for accessing memory when the type is constant
20:34:34
_death
the limitations are not inherent, the interface was just sufficient to what I wanted at the time so I didn't bother removing them.. but if the idea makes sense, then one could imagine more powerful mmapped array facility.. say for IPC
20:43:33
random-nick
hmm, why does WITH-ACCESSORS not have the simple variant of slot-entry like WITH-SLOTS does?
20:46:28
random-nick
was the accessor naming style where you don't use a prefix not popular when the standard was written?
20:50:57
Catie
What's the vibe on generics nowadays, have they come around? Or are they still a bit frowned upon?
20:54:45
pdietz
The short name style is nicer with package local nicknames, as you can avoid name collision and use the PLN as the prefix.
20:59:04
Shinmera
I don't know who ever frowned upon generic functions, but whoever it was they were probably making a bad judgement call.
20:59:05
Catie
Generic functions, in particular slot accessors without the class name prefixed to them
21:03:43
hayley
Everyone who first learns CLOS apparently thinks they really need a reader macro for SLOT-VALUE. Then, hopefully they learn CLOS.
21:05:30
jackdaniel
novices don't use clos because they don't understand it, experts don't use clos because they do - or something like that
21:06:04
jackdaniel
(in truth most cl programmers use generic functions and clos protocols some way or another)
21:06:51
yitzi
How about: Novices see objects and slots, experts see generic functions and accessors?
21:16:14
rotateq
pve: I'll take that risk. :) first I shall master the state of being a sorcerers apprentice to the next step
21:17:20
jackdaniel
slot-definition-location is advertised by amop authors as a way to optimize important bits implemented with standard classes (to avoid unnecessary function calls)
21:19:06
jackdaniel
they say that to hack something interesting you either need experience, talent or patience. I'm in the last group. thanks though!
21:19:32
rotateq
pve: there's a nice quote starting "if programming languages were like religions, LISP would be like Buddhism". I think that is one of the timeless points which attract me so much.
21:29:15
pdietz
Generic functions for slot access can be nice because you can combine other methods with them. :around, :before, :after
21:33:11
rotateq
in the beginning of the week i realized a bit more how/when the other method-combinations could be effectively used or that it can be useful the when having SETFs also generic the dispatch can go to the new-value too if needed
21:44:56
NotThatRPG
Allegro offers `EXCL:RECORD-SOURCE-FILE` so that one can record where new kinds of things are defined. E.g., I am making FIVEAM do (excl:record-source-file ',name :fiveam-test) inside fiveam:def-test. Question: do CCL and SBCL have any equivalent of this?
21:53:39
Shinmera
Not sure, but that reminds me it would be great if someone added more backends to https://github.com/shinmera/defititions
22:14:18
NotThatRPG
Shinmera: If this supported Allegro, too, I'd be more excited -- Allegro, SBCL, and CCL are my target implementations....
22:26:50
NotThatRPG
Shinmera: I'm already contributing quite enough to CL open source! I'm tapped out...
22:30:00
NotThatRPG
I would have thought there would be an interface to SBCL's source recording but... apparently not?
22:32:34
Shinmera
That reminds me that I initially created https://portability.cl in the faint hopes it would drive people to try and improve the situation on either library or implementation sides, but as far as I can tell it actually changed nothing at all.
22:33:33
Shinmera
So far my impression writing several of these libraries is that unless you do the painful work of aggregating the info for 90% of the implementations out there that you don't even use, nobody'll bother contributing a backend for even one more.
22:35:56
Shinmera
Yeah Clasp has been an outlier. You folks have been doing a tremendous job increasing support coverage.
22:36:24
NotThatRPG
Shinmera: If you look into the crawling horror that is the ASDF source, you will see what it takes... I don't know that anyone besides Fare has the energy to fight through testing on all the various implementations out there.
22:36:59
Shinmera
NotThatRPG: I have, and as I said I've also written many of these libraries myself.
22:38:29
Bike
a lot of these aren't actually that bad assuming the implementation has support. trivial-extensible-sequences support on sbcl consists of #+sbcl #:sb-sequence for example
22:38:54
Bike
but in that case there's a well defined protocol people pretty much go with, which is not the case with e.g. all the compile-file extensions asdf tries to herd
22:39:24
NotThatRPG
Krystof: Does that let me set the source location myself? I will look again -- I was apropos-ing with source-file, so wouldn't have found any source-location symbols.
22:43:34
Krystof
the pattern we use is something like (defmacro deffoo (...) `(%deffoo ... (source-location))) (defun %deffoo (... source-location) <store source-location wherever you like> ...)
22:43:50
Krystof
then whatever consumes your source locations needs to know where you've stored them; I don't think we have a protocol for that
22:45:16
NotThatRPG
Ah. So one *calls* source location, and it gives you back the source location to do with what you will.
22:54:49
NotThatRPG_
I didn't mean to imply that it's more awful than it needed to be. But awful it did need to be.
22:56:29
Fare
The awfulest parts are those that deal with portability across 17 implementations, in UIOP. Especially the portable run-program facility.
22:58:43
Fare
pathnames are a mindfuck, though. There is a wide gap between that the standard specifies and what is common practice in today's world.
22:59:04
Fare
with plenty of undefined behavior that every implementation does in subtly different ways.
23:00:41
Shinmera
I have often thought about starting a thing for a secondary path mechanism that's more tailored towards modern systems, and adding support for that to implementations, but doing so is too much effort even for me.
23:02:25
Fare
but then you have to hook it up into LOAD and all other primitives that deal with paths.
23:02:33
Shinmera
did it? My idea would have been to allow using cl:open/etc with this new path type.
23:05:08
Fare
Also, anything that binds wrapped low-level resources to high-level variables introduces "interesting" issues to make your program async-safe. No one tries to do that because it's too hard (except for the Erlang guys maybe), but I wonder what an async-safe lisp would look like.
23:06:06
Shinmera
I'd give a lot to have the kinds of convenience that exists in JS and C# with the async keyword.
23:08:18
Fare
(well, I use Gerbil on top of Gambit, but it inherits Gambit's relatively good async behavior)
23:08:39
etimmons
One of these days I want to add environment variable support to run/launch-program. Gonna probably take a while to get it right, though
23:09:43
Fare
etimmons, even more "interesting" to get right portably. You may have to punt on many implementations and/or extend them properly.
23:10:06
rotateq
and how do C# and JS do the async stuff? a friend told me in Rust the async is with some kind of continuations, but idk
23:14:43
Shinmera
rotateq: marking a function async causes its return value to be a kinda closure. The await keyword within an async function marks a continuation/closure chain point. So async foo(){ x = await bar(); } returns a closure that should be called when bar() completes. when invoked, the function then resumes, binding x to the result of bar().
23:15:11
etimmons
Fare: by the way, I don't know how much you've checked out of gitlab emails, but I opened a merge request on reader-interception yesterday
23:15:25
Shinmera
rotateq: This makes async programming 1000x less painful because you can essentially pretend it's still imperative in most cases.
23:15:47
Shinmera
You could potentially do something like this in CL but it would definitely require code walking, and yikes.
23:19:12
random-nick
Shinmera: I think you can do something like that with cl-async and green-threads
23:20:06
random-nick
rotateq: scheme's spec requires call/cc, which means that most implementations support it and/or some saner alternative
23:20:57
hayley
And then you have a whole lot of synchronous CL code to deal with, so you won't get very far with async colouring.
23:21:02
random-nick
I think you can implement coroutines using sleeping OS threads, but that is not exactly resource efficient
23:34:39
mzan
hi, I'm blocked on this "problem". I'm not able to optimize CL code using series. It is not converted to normal loops, and it uses all the RAM. This is an example https://0bin.net/paste/n7fhjDxt#7SLnyit7-VDat6Ae5okgznwv5p1vbRmzqVylJWqK8+1
23:41:17
mzan
Shinmera: I don't know if this can help, because I'm a newbie, but there were this interesting discussion about asyncs https://news.ycombinator.com/item?id=29016796
23:49:22
mfiano
hayley: Hehe, I was referring to Robert Nystrom's article, but I can't argue with the Floyd.
23:50:46
_73
Question about exporting symbols that are only used as arguments to a function: http://dpaste.com/HVTYXNY9G
23:52:30
mfiano
Keyword symbols are self-referential, and suite uses like enum variant testing such as this well, and need not be qualified.
2:38:12
semz_
I'm not happy to ask this, but does there exist a CL implementation that compiles to Javascript?
2:39:28
Guest74
_death: while interesting it wouldn't work. This would be for reading/writing to dumb buffers gotten from drm.
2:42:10
Guest74
bike: shouldn't it be possible to have the header in lisp and simply have the pointer to the data point to foreign memory? Or header and data are contiguous?
3:43:02
dbotton
Wanted to share very early work on CLOGs GUI/Web Builder https://usercontent.irccloud-cdn.com/file/yq1ZLK9b/Screenshot%20(2).png
3:50:31
dbotton
That is all running in a web browser, of course can run "native" by using electron / ceramic, or add the panels to any web page of any framework of any language by a simple include.
4:12:45
_death
like I said, these limitations are not inherent to the approach.. but looking at DRM dumb buffers, it indeed might not work, because you don't get to pick the buffer's offset
4:14:53
Guest74
ah, I just read the readme and haven't looked at the code yet. It might be useful for clx though. X allows you to provide the mmap.
4:17:02
Guest74
it's just something that would be interesting for the future. copying the array to foreign is sort of a poor mans double buffering.
4:17:15
_death
the way it works is to have a page before the pages of interest where the last bytes are the array's header
4:21:46
Guest74
I was just thinking of the shared memory extension, but sounds like it'd possibly work for the buffer as well.
4:24:40
_death
but this header creation etc. really belongs to the implementation.. so it should probably be a contrib or something
4:27:49
Guest74
I think I eventually need to run on something besides sbcl. Maybe once everything is working smoothly.
5:30:32
abrahms`
Hi all. I'm trying to figure out how to iterate across the Nth item of a bunch of lists. I have a list of lists. I want to process the first element of each list, then the second item of each list. I feel like there should be a way to do this without setting a variable and looping index by index.
5:50:00
akater[m]
abrahms`: apply mapcar or apply mapc, or it's unclear what you want, show a form&result snippet.
5:51:46
abrahms`
Then I would want to map over the result, so if it's combined with map, that's great.
5:54:51
abrahms`
T_T I'm terrible at this right now. Spent 2.5hrs on it yesterday in what would have taken me ~20m in python.
5:55:27
abrahms`
I conceptually know what I want to have happen, and I'm fairly certain it's doable (and maybe even a good idea?) in lisp.. I just don't know the incantation for it.
5:56:40
abrahms`
Guest74: Yes. Didn't occur to me that it may spoil things for others until you just asked. :-/
5:57:30
Guest74
The test examples help to find stupid errors. I keep forgetting that and wasting time, finally got it after using the test data.
6:00:58
akater[m]
abrahms`: btw If you have only two list elements, maybe just write a loop with 2 for clauses.
6:08:24
abrahms`
Day one was mostly fine. I was struggling to figure out how to load in a test runner. Day two was spent figuring out how to correctly convert a string into a callable symbol. I had forgotten about funcall. :-/
6:10:40
Catie
Guest74: This is what I came up with, I don't think it looks that bad: http://ix.io/3GQq
6:12:03
Guest74
catie: reverse! why didn't i think of that. Summing also looks nicer, I was dpb'ing bits.
6:17:08
mfiano
bit vectors don't really buy you anything over a fixnum, except more bits, and lots of consing using the result of a bignum
6:18:12
dre
I've got the test solution worked out, https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
6:19:05
Catie
mapcar'ing over many lists in parallel processes their elements in order, similar to how you hard-coded first, second, etc
6:20:02
beach
dre: You need to start paying more attention to your code layout. Sometimes LET is followed by 1 space, sometimes by 2, sometimes by 0. Sometimes COERCE is followed by a newline, sometimes not.
6:20:38
beach
dre: You want to avoid distracting the person reading your code with small stuff like that.
6:32:58
dre
ok, so I can get to a '((0 1 0) (1 1 1) (0 0 1)) list, but how can I sum that into => (1 2 2) ?
7:25:24
pjb
dre: time to read and understand: http://www.99-bottles-of-beer.net/language-common-lisp-114.html
7:43:49
flip214
I guess that (mapcar (alexandria:curry #'reduce #'+) '((0 1 0) ...)) would scale better than an apply
7:52:24
dre
how can I use the debugger effectively? trying to run my code, I come up to an error but if i use BACKTRACE -- I don't know how to parse the output
7:54:12
pjb
dre: assumedly, in the function save-lisp-and-die, there's a function defined with flet, perhaps WITHOUT-INTERRUPTS-BODY-14, and that frame corresponds to the activation of that local function.
8:02:26
abrahms`
dre: https://gist.github.com/justinabrahms/d9d110c55ad5f53288a56d0cc882aa1e - this was may day 3 part 1.
8:06:43
dre
that looks nice actually, blows my mind more than mine. I'm trying to not use packages ( by ignorance, not by intention :P) https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
8:07:36
abrahms`
the packages are literally for writing small tests & logging (b/c I didn't know there was a print function)
8:08:52
abrahms`
I'm trying to do this without just writing a for loop. Think I might be in over my head for #2.
8:10:42
dre
when you get the gamma binary value, you use that as a filter on the list, down to single values. so if the gamma is 10101, filter all the items that start with '1', have you got 1 left? no? then filter down all the items that have '0' in the second spot, have you got 1 left? no? then ....
8:13:18
dre
this is what I've got so far for number 2: ( just updated gist, refresh) https://gist.github.com/Dotrar/dcd4bf24dc4dcec0f11eeb1cfaea2583
8:13:36
abrahms`
going to not click it yet. Haven't given up hope, but the clock is against me b/c I'm tired.
8:14:16
abrahms`
I'm hoping to get this mostly done tonight so I don't just think about this all day at work tomorrow.
8:14:50
dre
does anyone know where my error might be? so when I run the "aoc-process-part-2" - I get past the "princ binary-commons" bit, but somewhere in the filter-down-to-one I get an error.
8:15:16
dre
abrahms`, tbh I was sad that I couldn't chew on yesterday's problem. I solved day-2 too fast.