freenode/#lisp - IRC Chatlog
Search
4:02:13
JuanDaugherty
on the debian vs slime, the time came when all the debian cl things were completely removed
4:13:06
krwq
hey, why does this code produce warning that *foo* is undefined? (defun foo () (defvar *foo* 0) (incf *foo*))
4:14:49
Bike
the defvar is not run at compile time, so the compiler doesn't know that *foo* is special as it compiles the incf
4:15:57
Bike
if you need a special variable that's only used in one place, you don't need to use defvar, either
4:17:44
krwq
scenario is following: I want a macro which makes a non complicated place thread safe, i.e.: (defun pformat (control-string &rest args)
4:20:05
Bike
(with-gensyms (lock) `(let ((,lock (load-time-value (bt:make-lock)))) (bt:with-lock-held (,lock) ,@body)))
4:20:58
Bike
now, if you just had (let ((,lock (bt:make-lock))) ...), that wouldn't work since it would make a new lock for each time you execute it
4:21:17
Bike
load-time-value is a special operator that makes its operand be evaluated only once, when the fasl is loaded, and reused thereafter
4:21:42
krwq
Bike: I assume this will work also when I just load a file (ok if it redefines it then)
4:23:01
Bike
but then, if you're just loading the macro could be expanded more than once, giving it different gensyms anyway
4:23:49
Bike
(incf x) is just (setf x (1+ x)), it doesn't modify the value of x, just changes what it's set to
5:36:02
iqubic
I have a few questions about slime. There are a few places where the docs are woefully inadequete. 1) What does the STRING argument do in (slime-eval-print-last-expression STRING) and 2) What does the PREFIX argument do in (slime-eval-last-expression-in-repl PREFIX). I'm trying to call these from my init.el, but I can't because these are required arguments.
5:38:16
drmeister
If I have three lists '(a b c) '(d e) '(f g) and I want every combination of the first, second and third lists - what is that called? Outer-product? Cross-product? Is there a CL function to do this?
5:40:23
beach
I don't know what it is called, and there is no standard function to do that. You will have to write it yourself.
6:49:31
asarch
In PCL, chapter 8 there is a paragraph: "Common Lisp doesn't support macros so every Lisp programmer can create their own variants of standard control constructs any more than C supports functions so every C programmer can write trivial variants of the functions in the C standard library." Is it correct?
7:02:43
stacksmith
Nah, it's like "I don't work hard so my kids will waste my money" - does not mean that I don't work hard. Just unfortunate turn of phrase.
7:03:39
stacksmith
The point is that although you could change standard constructs, it does not mean that that's what macros are for.
7:53:02
panji
I am wondering what advantage using funcallable instead using method like in this sample https://gist.github.com/epanji/c93fea8ed9f7adaafb0a782f877dcc1b
7:53:23
panji
My understanding about metaclass is not that good, so i always wondering when the right time to use metaclass?
8:10:07
|3b|
panji: using funcallable-standard-class gives you an object you could pass to things expecting a function
8:13:09
|3b|
for example if you wanted something you could pass to mapcar, you could use a funcallable instance
8:14:05
jackdaniel
funcallable instances are a cool concept, because you can have slots and stuff in them, also you may specialize on them if you subclass this metaclass
8:16:14
|3b|
EQ is specified to not work on numbers or characters, I would just always use EQL instead of EQ
8:17:50
|3b|
if you know it is numbers (and want error if it isn't), and might be different types of numbers, use =
8:20:12
jackdaniel
panji: no, because 1 is not necessarily eq to 1 (i.e it may be stored in the pointer - immediate type)
8:21:17
|3b|
and since that's the only difference between EQ and EQL, it is easier to just always use eql (other people disagree, and think you should use EQ if you know it is safe)
8:22:02
|3b|
the idea is that EQ compares "identity", but numbers don't have any specific "identity" in CL terms
8:23:02
|3b|
where "identity" usually translates to something like "pointer" at implementation level, and numbers might for example exist only in a register so have nothing to point at
9:19:23
panji
|3b|: I added more test about mapcar you talk earlier (in https://gist.github.com/epanji/c93fea8ed9f7adaafb0a782f877dcc1b), and i still can't satisfy my curiosity about advantage using funcallable versus method. Maybe I should play around with it more often. :)
9:27:01
beach
panji: Yes, it is a function, but it can have other slots just like a standard object.
9:27:02
panji
|3b|: maybe i just don't know the right case to implement what you means. Anyway thanks. :)
9:33:29
beach
A generic function is a funcallable-standard-object: http://metamodular.com/CLOS-MOP/graph.png
9:35:37
beach
But if by #'method you mean a method, then no. You can't pass a method to function like MAPCAR.
9:36:21
p_l
... can you even get a reference to a method to pass it there?... wait, yes, you can, through MOP...
9:37:20
beach
panji: When you do DEFMETHOD, unless you have an explicit DEFGENERIC for the same name, you implicitly create a generic function with the same name, and that generic function is what becomes the result of #'method.
9:38:10
beach
panji: So you are not passing a method to MAPCAR, you are passing a generic function named CALCULATE.
9:42:28
beach
It is better to use slot accessors than to use slot-value and with-slots. Accessors are generic functions so they can participate in a protocol, whereas slots are implementation details that should be hidden.
9:44:25
beach
If you want your code to be portable across implementations, you can use the system CLOSER-MOP rather than the implementation-specific sb-mop.
9:45:52
beach
These days, I :USE only the COMMON-LISP package. I use explicit package prefixes for other symbols. If you :USE packages that may evolve, such evolution may break your code in the future, because a new version of such a package might export a symbol with a name that you also need from a different package.
9:49:09
panji
beach: I know about closer-mop, but it is just experiment code, so i don't think about compatibility. Thanks.
10:56:14
Josh_2
Is there a library that has bindings to Windows functions like mouse pointer position?
10:58:12
pjb
Josh_2: just use CFFI to call directly MS-Windows API. It works nicely. Microsoft has a nice documentation website.
11:02:33
Josh_2
Well I want to make some software that lets me share my mouse/keyboard across my Gentoo install and Windoge
11:30:30
JuanDaugherty
well i essentially have tnat now. looking at a 36 desktop fvwm pager, don't have a dos vnc session right now
11:31:40
JuanDaugherty
so if i used guacamole or any of a plethora of other things could share it with others in a browser
11:34:35
JuanDaugherty
as to whether there's a cl binding to whatever currently replaces win32, i would guess not but not with confidence
11:37:37
JuanDaugherty
it used to be win32 and wouldn be surprised if it was win64 now but doubt that, again with little confidence
11:42:01
JuanDaugherty
doesn't slime show up on the main menu bar anymore? it executes fine but there's no slime menu when I have a lisp file open