freenode/#lisp - IRC Chatlog
Search
21:34:02
AeroNotix
What's the best way to create a "union" value like in C, I want to have a 16 bit value be addressable via the two bytes.
21:44:03
pjb
AeroNotix: C unions don't make sense in lisp, since the type is not associated to the variables, but to the values.
21:44:37
AeroNotix
pjb: right but the concept is what I meant. I can't believe I derped over just using logical operators
21:44:40
pjb
AeroNotix: so union { int i; float f; char* s } v; is just: (let (v) (setf v 42) (setf v 3.2) (setf v "foo"))
21:46:46
pjb
But again, it's very bad, because in lisp numbers are not mutable, so dpb creates a new integer.
21:47:53
Shinmera
There's binary-types, but I don't know if it allows using its facilities on integers directly.
21:47:54
AeroNotix
I'm writing a Z80 emulator for fun (I've had four months away from computers entirely) after a solid 5 years of 80 hour weeks.
21:48:27
AeroNotix
For the 16 bit registers where they're made up of two other registers. A union in C is how you typically would implement that.
21:51:04
AeroNotix
another question - for accessor functions for slots. Can I point a variable that accessor function?
21:51:13
pjb
(defstruct register 16-bit-value low-8-bit high-8-bit) when you write a byte, you set the 16-bit-value to nil and vice versa, and when you read, if it's null you compute it from the other slots.
21:52:22
pjb
accessor functions defined by CLOS are generic functions. As such they are functions. Functions are first class objects in lisp, so you can store them in variables.
21:53:31
AeroNotix
oh right the accessor tag just creates the function already. For some reason I thought I'd need to pull the accessor function off the class instance and bind it to a variable
23:10:21
jmercouris
assuming one started at the level of assembler, how much of a standard common lisp implementation can be implemented in pure lisp?
23:17:43
pjb
jmercouris: there's an infinite number of ways to bootstrap a system. Which one do you prefer?
23:17:49
jmercouris
before someone mentions the spec, I would like to point out that it is not a manual
23:19:07
Bike
it's like how you can prove normal mathematical theorems from a variety of axiom systems.
0:04:00
cmos
I'm having trouble getting slime to run on OSX. Last I used it was about a year ago, and now when I try to boot it up I get an error to do with compiling the SB-VM package
0:10:58
cmos
looks like my slime is from a couple of years ago, but the most recent one indexed by melpa (or whichever package index emacs is pulling from)
0:11:43
cmos
worth using a local, up-to-date version? (if so, how can I tell emacs to use this rather than the version indexed by the package manager?)
0:14:06
cmos
hmm, tried installing through quicklisp and got "The function ASDF/INTERFACE::OPERATION-FORCED is undefined"
0:28:35
cmos
aaaaand re-running (ql:quickload "quicklisp-slime-helper") seems to have fixed the issue, whatever it may have been
0:28:56
cmos
thanks, both, for your help…though I'm still pretty fuzzy on what the issue was in the first place
1:46:47
black_13
but are there lips statements that will cause a variable to be gc if that makes sense
1:53:11
mange
Generally speaking, you shouldn't assume that things will be garbage collected within a particular timeframe. It's probably more helpful to speak of being eligible for collection.
1:53:22
black_13
and you can add c language types to this i wanted to know when does the the gc come along
1:54:40
Bike
there are no guarantees about when it's collected because you have no way to tell if it's collected.
1:56:40
mange
Just briefly reading about S7, it seems to have weak references which allow you to tell whether something has been collected.
2:07:01
mange
Yeah, it will collect its own wrapper (with the type/info), but I don't think it will collect the thing pointed to by the C pointer. Attempting to do so could break things pretty horribly (eg, if you passed &x[1], how would it free one item in the array?).
2:10:48
black_13
is this statement "s7_c_type_set_free(s7, dax_type_tag, free_dax);" that makes me wonder when it will be called
2:19:17
mange
Maybe they have some way to include them in the GC process. It looks like you can define a few hooks to let S7 work with your C data. That won't give you any guarantees about GC timing, though, it just hands over control for the lifetime of the object to the system.
2:27:06
black_13
ok maybe ... If I have a pointer to top-level struct (god object) and this is wrapped by s7 and can be used frankly prevented from being gc-ed
3:04:19
edgar-rft
The CLHS says that "setf {pair}* => result*" where result* are the multiple values[2] returned by the storing form for the last place.
3:04:19
edgar-rft
Simplified question: in (setf a 1) can I take for granted that the result* will be 1? The CLHS doesn't say so clearly enough IMO.
3:05:35
Bike
well, i suppose you need to know that storing forms are supposed to return the input values.
3:07:47
edgar-rft
Bike, loke: thanks, sometimes reading the CLHS just simply makes me getting paranoid :-)
3:09:25
edgar-rft
no, I only have one storing form, but it just simply saves me a lot of LET bindings if I can pass the result of a SETF to another SETF
3:23:39
loke
I'm building a new generic component that consists of a main pane, along with a set of supplementary panes that can slide in and out from the sides (similr to how IntelliJ IDEA works).
3:26:26
loke
Here is one with the drawer on the bottom https://www.i-programmer.info/images/stories/News/2
3:28:16
loke
(well, you can't see the dragging, but the two pictures have different sizes of their drawers)
3:32:33
loke
a descriptive name would be something along the lines of root-pane-with-attached-drawers, but it's a bit too long
3:32:51
mfiano
I guess look at what it's called in Swing then, or whatever java toolkit it's actually using.
3:33:35
loke
It's a jetbrains object, so I guess it'll be hiodden somewhere in their code base. Don't know if I feel like going on a hunt for it :-)
3:39:24
beach
loke: Also, whenever I have naming problems and I ask for advice, I find that I am totally unhappy with the suggestions I get.
3:39:48
loke
beach: I agree. But then, I leave it for a bit and then I realise that the suggestions were't bad
3:42:03
loke
kirkwood: My intent is to make the hidden drawers have buttons along the side (note the second screenshot I sent, it has the title written vertically along the side)
7:24:52
LdBeth
Is there any data structure optimized for fast concatenation and subsequence operation?
8:52:45
beach
LdBeth: Any balanced tree will do, but splay trees are particularly good, though only statistically so.
8:57:09
schweers
Is Sonya Keenes book on CLOS really that good? Especially if one has already read and understood the relevant chapters from PCL and uses CLOS casually?
8:58:34
schweers
I somehow struggle with proper OO design given generic functions and MI. I always thought that “OO design” was a fad, and think that it is in mainstream languages. But thanks to CLOS I can see what I’m missing.
9:01:30
beach
Yes, that too. You can look at Cluffer for instance. It has documentation and tests too.
9:05:00
schweers
thanks for the tip, especially about cluffer. I see that you have 35 pdf pages worth of docs :)
9:05:23
phoe
I actually learned a lot about object composition by reading and analyzing Shinmera's parachute library
9:10:39
beach
schweers: I do recommend the CLIM II specification. It is not quite as good as the Common Lisp HyperSpec, but the low-level parts are quite well specified.
9:11:49
schweers
beach: I’ve made a note of that. I guess I’ll first read at least the pdf documentation on cluffer.
9:12:38
beach
True, but is a stratified design, so it consists of a large number of independent "modules".
9:13:16
phoe
take it slow with the CLIM documentation - just start in one point and try to understand what it does, and then expand it by reading about an adjacent class/function/thing
9:24:23
adlai
schweers: have you read AMOP? it's a great insight into the "CLOS philosophy", even if you don't end up using any of the extra flexibility
9:26:06
schweers
I have the feeling that I understand CLOS well enough to see that OO does have some merit, but not well enough to use it to its full potential
9:27:20
adlai
you could teach yourself how to see this potential through the painful approach: start building a large system without using OO, and list the points where you regret that omission.
9:28:35
jackdaniel
"cognitive baggage is proportional to the potential of technology in question" – JD's rule of CLOS :-)