freenode/#lisp - IRC Chatlog
Search
13:57:07
Xach
and (FUNCTION FOO) means "look up FOO as a function name and return the corresponding function object"
13:58:36
antoszka
prohobo: Common Lisp has this (arguably atypical) feature, that a single symbol may reference both a function and a value (among other things) in standard scenarios. Yes, it's in the ANSI standard.
14:02:16
antoszka
prohobo: the convention for predicates (functions answering „to a true/false question”) is to append p at the end
14:05:25
antoszka
Yeah, equality predicates are a separate story, it's all about history and convention.
14:06:26
antoszka
For the start you might keep in mind a rule of the thumb that the shorter the predicate the more *strict* it is.
14:26:45
kenanb
please, some good soul tell me where to find a good explanation of how progn custom-method-combination type works, preferably an isolated example, PCL uses it but I am kind of confused because it is tightly related to the whole chapter
14:35:17
Xach
kenanb: i have lived my whole life without knowing how it works or using it once. maybe i will someday.
14:38:44
synchromesh
I can relate what Sonya Keene has to say on pp. 106-107 of "OO Programming in CL" if you like.
14:45:32
synchromesh
"Suppose we need to implement a function for cleanly shutting down a computer resource, such as a network interface. The network interface is an instance of a class, which is constructed from several superclasses. The ~shutdown~ generic function should allow each class the opportunity to do cleanup work in preparation for the shutdown. One class might turn off the hardware, and other classes might clear the pending input an
14:45:32
synchromesh
queues and inform the higher layers of the network that the device is no longer operational.
14:45:45
synchromesh
"For this generic function it is reasonable to use a framework that calls all applicable primary methods in most-specific-first order. This framework allows any class to provide a method for ~shutdown~. You can visualise such a framework as a Lisp form that uses ~progn~ to call all applicable primary methods:
14:45:58
drmeister
If I make changes to the ECL CLOS code - I have to worry about breaking compatibility with the closer-mop package, don't I?
14:46:37
drmeister
I'm trying to eliminate the use of special variables in generic function dispatch.
14:51:56
kenanb
Xach: interesting. at least I know why it is not easy to find resources about it now. thank you :)
15:02:47
kenanb
drmeister: I see only a 10 LoC method definition that is suspectible to modification in closer-mop's ecl specific file
15:06:29
PuercoPop
synchromesh: nice example! the + method combination is said to be used in widget size calculations
15:12:26
synchromesh
PuercoPop: Yes, I've found Keane to be good for explicating the more arcane bits of CLOS.
15:17:19
warweasle
Has anyone used screamer for prolog-like logic programming? If so, are there any examples? I'm not sure how to create rules and such.
15:20:40
kenanb
warweasle: I used it some years ago for some small experimentation. no code left of that. I was impressed with how well it works. but I don't remember needing anything except its documentation. IIRC it was very nicely documented.
15:22:10
kenanb
warweasle: I don't remember much about it except the fact that screamer did pretty much what is said and did it well.
15:22:40
warweasle
kenanb: The documentation is good. I'm just not clever enough (at this time) to get it to do what I (think) I need it to do. But it's just curiosity right now.
16:31:10
Warlock_29A
Hi all! I have trouble with sbcl or slime. When I executed (read-line) and was starting to input text, slime is freeze. When i was killing sbcl, slime continued to work. I have been working under Windows. Thank's for any help.
16:54:21
jasom
Anybody who thinks lisp images are too large needs to look at gcj. I wrote a small program for form-filling PDFs (in C, unfortunately not lisp) to eliminate pdftk (which depends on gcj) and shaved almost 500MB off of the docker image by doing so.
16:58:47
moore33
gcj is really the worst of all worlds: the Java language without its VM and ecosystem.
17:28:32
beach
Warlock_29A: If you are going to work on Windows, you are probably better off getting a commercial Common Lisp implementation, such as LispWorks.
17:34:06
beach
moore33: My point is that someone who is willing to work on a commercial operating system should be willing to pay for a commercial Common Lisp implementation as well.
18:01:08
lispn00b
( (:birthday "a" :age "b" :sex "c" :name "d") (:birthday "e" :age "f" :sex "g" :name "h") ...)
18:06:03
Xach
lispn00b: (defun make-keymapper (&rest keys) (lambda (values) (mapcan 'list keys value))) followed by (mapcar (make-keymapper :birthday :age :sex :name) data-list)
18:59:08
learning
I asked in python, but I'm not sure they will know what I mean, and I'm sure people here know multiple languages.
18:59:47
Bike
"Is there a function that prints a newline only if there's something already on the current line"
19:02:30
jasom
learning: you could make an object that wraps a file-like and tracks if the last character written was a newline
19:03:16
learning
yeah jasom, I already use a custom logger when printing stuff in python, so I should probably just add what I need to that. good point.
19:04:30
jasom
hurray, there's a function we have in our standard library that python doesn't have. Clearly we're the ones with batteries included :)
19:06:35
davsebamse
learning: it might be that in this case, another way. Put the stirng in a list, and join with '\n'.join(da_list_of_strings)
19:07:21
learning
yeah, that would be a clever work around dav, wouldn't work for debugging though where most of my printing happens
19:07:32
jasom
learning: if the "trashing" comment was directed at me, my comment was a joke (clearly I thought considering the differences in sizes between the two standard libraries)
19:08:20
learning
the one thing that's great about python is that no matter what i'm trying to do, i know there is already a library and a stack overflow question for it
19:09:09
learning
it's also good for sharing code with people who don't know how to code since the syntax is so stripped and english-like
19:23:51
jasom
friends don't let friends manage resources with dynamic-extent without using unwind-protect
19:51:00
pjb
learning: the bad thing with python (and a lot of other programming languages and systems), is that there are stackoverflow questions about them!
19:51:59
pjb
Those systems are so bad, and so badly documented, that the only way to use them is to go thru stackoverflow. They just depend on stackoverflow instead of designing in quality and good documentation.
19:55:03
davsebamse
pjb: how? There are examples in the python documentation. Might not be true for all third parties modules
19:56:08
pjb
davsebamse: I'm not saying that you can't work offline. I'm saying that it's a pity to have to depend on stack overflow, both from the users' point of view, and from the providers' point of view.
19:59:23
davsebamse
pjb: true, but that is the case for many languages, or all, people seek wisdom in stackoverflow before readin documentation, but that is something I see in all language and not just python
19:59:33
phoe_krk
pjb: step one, integration of StackOverflow into all IDEs and editors, including emacs.
20:00:35
davsebamse
phoe_krk: do not joke about that... or the emacs team will get a new idea for features for emacs
20:00:49
phoe_krk
step three: integrating step one and step two, asking questions on StackOverflow about how to program with StackOverflow
20:01:28
davsebamse
phoe_krk: and singularity! the computers will use the knowledge on SO to create the next stack overflow
20:02:27
learning
pjb I find that documentation for anything only becomes readable after you actually know what you're doing.
20:02:40
phoe_krk
so you can't ask questions on StackOverflow because it's the programming language you're asking questions about.
20:07:13
pjb
write a macro: (stack-overflow "my boss asked me to write an accounting program, how do I do that?")
20:09:18
phoe_krk
optionally you use (with-stack-overflow (block-name) ...) to mark the code you want posted into your original question
20:10:09
phoe_krk
guys, do you realize that if we do it first, Lisp will be the first language *ever* to directly support StackOverflow-oriented programming?
20:13:05
phoe_krk
but here comes the realization you can bootstrap everything with StackOverflow-oriented programming now
20:18:47
phoe_krk
dlowe: (stack-overflow "how do I check whether the program asked in question ~A will terminate or not?" (stack-overflow "how do I write a Lisp program that will prove that P=NP"))
20:31:14
phoe_krk
a SLDB plugin that automatically posts a stackoverflow question whenever SLDB is invoked.
20:51:35
davsebamse
jasom: for someone that do not know stackoverflow will it seem like an AI... or magic
21:30:17
mordocai
I'm sure plenty of people do around here. I'd recommend just asking your question.
21:31:18
man213
mordocai: ok, I prepared some data on pastebin with fragment of C code and swig output: http://pastebin.com/cqgisFgn
21:34:54
|3b|
well, BGFX_ATTRIB_COUNT isn't a number as the error says, and something tries to add 4 to it, so yelling seems approriate
22:02:26
attila_lendvai
man213: this is using a new feature in CFFI: https://github.com/attila-lendvai/hu.dwim.bluez
22:03:00
attila_lendvai
man213: it uses LLVM (c2ffi) to generate a json file, from which it generates the CFFI bindings
22:03:47
attila_lendvai
man213: I think it's better, I played both with verrazano and swing before, but wrote this based on c2ffi
22:05:01
attila_lendvai
oh, windows? well, then I don't know... c2ffi can cross-generate for the windows platform, but I have no clue.
22:05:59
emaczen
Can I depend on a system and then only load particular packages in that system instead of all packages?
22:06:13
man213
attila_lendvai: I suspect I can try to generate bindings under Linux and use them on windows. Thank's for the hint!
22:08:08
man213
attila_lendvai: Thank you very much. Me too usually in EU time) and sometimes some sleepless nights
22:11:47
mood
emaczen: No, you can't. ASDF doesn't actually care about packages, just about files to load for a system.