freenode/#lisp - IRC Chatlog
Search
4:56:38
jmercouris
I remember many times where I was the only person in the room who actually likes objective-c
4:58:44
jmercouris
If all of the things I've read about it are true, then yeah, it seems like a very nice integration
4:59:54
emaczen
jmercouris: it uses the MOP, so you can use a slight variant to CLOS (which is the point of the MOP)
5:05:40
emaczen
by default in commonlisp class objects defined by you are instances of standard-object
5:08:23
sjl
jmercouris: https://mitpress.mit.edu/books/art-metaobject-protocol is a really good book to work through if you want to wrap your brain around the metaobject stuff
5:10:25
sjl
jmercouris: you can get it for around $25 if you don't mind buying used: https://www.amazon.com/gp/offer-listing/0262610744/ref=tmm_pap_used_olp_sr?ie=UTF8&condition=used&qid=&sr=
5:11:54
sjl
it's a good, mind-bendy book. I don't touch the metaobject stuff almost ever, but it was good to read anyway
5:12:30
jmercouris
Yeah, it is certainly nice to understand kind of what is going on behind the scenes
5:13:37
beach
jmercouris: Warning, though: Even as an experienced Lisper, I had to start reading it three times. The first two times, I was completely lost, so I had to put it down.
5:14:21
beach
jmercouris: So, what I am saying is that, even if you are lost, don't give up. You might have to try again.
5:15:05
beach
And people here in #lisp would probably be very happy to give some explanations. For you and for others who might be interested.
5:16:01
jmercouris
One thing that I've really liked about the lisp community is that it seems much smaller and friendlier than the others
5:17:08
beach
Sure, but we draw the line when we have to correct indentation and spacing for the umpteenth time, as would be required for some people who come here.
5:17:35
aeth
jmercouris: Most Lisp programmers use Emacs, but (afaik) most Emacs users don't program in Lisp, beyond perhaps some basic configuration elisp stuff.
5:19:58
jmercouris
I think that makes sense, part of being respectful of the time of other people is making sure that you have the basics down, and that you aren't wasting their time
5:20:37
jmercouris
Especially if you are asking on a public forum, whether it be stack overflow or otherwise, you should really focus on reducing the mental burden of the other person to understand your problem and help
5:21:06
beach
Right. Especially since #lisp is not, as some people think, a "Lisp support channel". Newbie questions are tolerated as long as there is some indication that progress is being made.
5:36:03
loke
Right. So what you need is some memory for the structure allocated. There are two ways of doing so: Either on the heap using basically malloc, or on the stack which has dynamic scope.
5:38:40
loke
Then, you can simply set fields in the stuct using (setf (cffi:foreign-slot-value FOO '(:struct NAME-OF-STRUCT) 'FIELD-NAME) THE-NEW-VALUE)
5:39:46
loke
emaczen: yes. But then you have to make sure you free the memory properly later. Sometimes you can use TRIVIAL-GARBAGE to create a weak pointer so that you can free as paert of garbage collection. It depends a bit on circumstances.
5:42:56
loke
There is a plist representation of a struct value, but that's only used when you pass around literal structures. It's actually quite rare, and most C API's work with pointers to structs.
5:43:00
emaczen
loke: I forget that things inside main are just like any other function and would be dynamic
5:43:57
loke
If you want to see an example of a lot of complex struct processing which also includes heavy use of literal structs, you can take a look at my cl-rabbit project.
5:45:58
loke
In that function, RESULT is a literal struct (plist representation) as returned by a CFFI function that returns a literal struct.
5:46:47
loke
You really need to understand what is going on on a low level, or you'll get mighty confused.
5:48:34
loke
struct foo { ... }; Foo someFunc(Foo x); ← Takes a literal struct as argument and returns another literal struct
8:18:13
beach
I think I have a working CST-to-AST system, modulo silly mistakes of course. Now I am thinking of a system for computing indentation from a CST. Such a system would be structured in much the same way as a CST-to-AST system, i.e., it would determine whether a CST represents an atom, a function call, a special form, or a macro call. Function calls are simple.
8:18:15
beach
Special forms are fairly simple, because they have fixed indentation rules. For a macro call, the macro lambda list determines the indentation of the argument expressions, but then, whether an argument expression is a form or something else, can only be determined by expanding the macro.
8:19:09
phoe_
Are you going to expand the macros each single time then? What if they have side effects?
8:19:33
Shinmera
It's also often desirable to be able to give further hints as to how a macro should be indented as the lambda-list by its own does not provide sufficient information about that.
8:20:11
phoe_
But then again, some macros like OPTIMA's and CL-PPCRE's expanders can be really freaky.
8:20:30
beach
I think the Common Lisp HyperSpec has some paragraph about how it is not known how many times a macro can be expanded.
8:21:57
otwieracz
beach: To be honets, my feeeling is that the editor will be broken if it wont work with something allowed in the language.
8:22:02
pjb
As long as you expect your macro side effects to be obtained at "random" times and multiple times…
8:23:21
beach
otwieracz: There is a difference between what the language "allows" and what it defines the effect of.
8:25:05
pjb
one guarantee by 3.2.2.2 is All macro and symbol macro calls appearing in the source code being compiled are expanded at compile time in such a way that they will not be expanded again at run time. It doesn't mention edit-time…
8:34:23
beach
Shinmera: Definitely very useful. If I use a structure similar to that of CST-to-AST, it will be trivially possible to customize the indentation of macro forms.
8:39:20
antoszka
beach: is that editor of yours already available for checkout/building/testing anywhere?
8:43:41
beach
Yes, but I have separated the GUI from the rest as much as possible, so it ought to be possible to use something else.
8:45:21
Shinmera
I know that the expansion of macros can happen multiple times, and I distinctly remember reading that in the CLHS, but I can't find it for the life of me
8:45:23
beach
CLIM/McCLIM makes so many things much simpler, though. I can't see myself re-implementing things like presentations for a different toolkit.
8:45:53
beach
Shinmera: Yeah, I know exactly what you mean. It is always very hard to find such things.
8:49:55
jackdaniel
yes, but I don't think that it is a must for a decent book to mention this particular thing
8:50:23
jackdaniel
for instance I don't think I've encountered such statement in CL Recipes, yet I think it is a very decent book
8:54:58
phoe_
Shinmera: https://github.com/xach/dpans/search?utf8=%E2%9C%93&q=%22multiple+times%22&type=
8:55:14
phoe_
I've been grepping the dpans3 sources for "multiple times" and were unsuccessful so far.
9:02:53
phoe_
"Macros intended for use in top level forms should be written so that side-effects are done by the forms in the macro expansion. The macro-expander itself should not do the side-effects. "
9:10:42
Shinmera
I mean, it's implicit in the sense that the spec never says that it is only expanded once either.
9:15:31
phoe_
Basically, edit-time will be equivalent to compile-time then, since macros will need to be expanded, so their macro functions will need to be called.
9:16:28
phoe_
Gah, this problem is an issue of type "can God create a stone too heavy for him to lift".
9:17:01
phoe_
We got a language powerful enough to turn its source code into Brainfuck and we're looking for an even more powerful tool to handle its power.
9:44:56
eminhi
from clhs prog2 description: prog2 evaluates first-form, then second-form, and then forms, yielding as its only value the primary value yielded by first-form
11:04:54
dim
is it safe to conclude they already had copy/paste at the time when writing the spec? ;-)
11:53:14
pjb
So it probably pre-existed unix ed, after all, unix is but a simplified clone of older systems and software…
12:51:05
pjb
shka: you have to look at early computers. Later, punched cards were copied first on an input spool tape (using a secondary computer), before being fed to the mainframe.
13:56:41
pjb
shka: the thing is that they were built with strong material. Like 5 mm steel. Just like a tank!
14:06:30
Josh_2
In On Lisp there are two examples as shown in this paste http://paste.lisp.org/display/358509 where one function takes a variable x as an argument to a function and that variable is considered bound, and then another example which takes the variable n as an argument to a function but that variable is considered free. This seems contradictory, is it?
14:08:46
mxb
Hi all. Anyone have experience with binary-types package? I'm struggling to try to define a binary-struct which references an earlier field and I'm not sure if it's possible to do so. (Basically parsing {type,length,data[length]} blobs
14:09:11
beach
Josh_2: Because it is used in a function, but it is not a parameter of that function.
14:11:44
mxb
phoe_: I'm learning binary-types with PNG file format - my code is here http://paste.lisp.org/display/358510
14:12:08
mxb
PNG spec is here if it helps: https://www.w3.org/TR/2003/REC-PNG-20031110/#5Chunk-layout
14:13:43
phoe_
I never used binary-types myself, but hopefully someone up there can take a peek at your code.
14:14:45
mxb
phoe_: yes, during macro expansion of define-binary-string size is LENGTH, which is not of type (INTEGER 1 *)
14:21:32
phoe_
Since this a macro, then SIZE must be an integer before its evaluated - so it cannot be a variable.
14:22:00
Bike
oh, so this isn't gigamonkeys's? i'm pretty sure his could do that, since it's so common for binary formats
14:23:47
mxb
phoe_: Yes, it seemed like there are signed/unsigned binary integer types, and 'strings', which I took to be arbitary lengths of data
14:26:09
Josh_2
I don't particularly understand lambda calc just like I don't understand normal calculus. However I found this sentence "The abstraction operator, λ, is said to bind its variable wherever it occurs in the body of the abstraction."
14:27:06
Josh_2
I'm sure if I put some serious effort in I could learn some Lambda calc just like I could with normal calculus
14:27:12
Bike
well, and i suppose integration and differentiation can involve binding variables and so on
14:27:28
beach
Josh_2: The concept of free variables is very important to the compiler writer, because, in general, they can't be treated as simply as bound variables can.
14:28:13
phoe_
And I'm sorry that I can't help in this case. Maybe the library Bike suggested can deal with that.
14:33:32
phoe_
I wish I had a #lisp full time job so I could spend all of my time and all of my attention on refining CL documentation and libraries. There's so much to be done in Common Lisp world and I am doing corporate dung instead.
14:34:53
Josh_2
Save some money, buy a van, live in the van using mobile internet and a laptop for 6 months of the year.
14:37:38
Josh_2
Well I have a motorcycle so takes me 10 min to get to Uni. I guess you went to a much better Uni than mine if you need to prep for a class
14:38:17
phoe_
Just doing homework takes time, and sometimes there's a lot of homework needed before I get some programming or math concept.
16:10:51
Bike
you could also define a package that shadows cl:close; might or might not make sense for you
16:12:56
phoe_
or make your defcfuns inside a different package that either does not :use CL or shadows it CLOSE symbol
16:21:34
jackdaniel
if test *evaluates* to true, true is evaluated and result of this evaluation is returned
16:29:58
Josh_2
dlowe: I gave (set t nil) a shot and got Simple Error Veritas Aeterna or Eternal Truth
16:35:38
Bike
huh, define-symbol-macro isn't defined to have any compile time effects. weird oversight