Search
Monday, 17th of July 2017, 22:07:21 UTC
2:14:16
adulteratedjedi_
** NICK adulteratedjedi
2:14:31
LyndsySimon_
** NICK LyndsySimon
5:26:49
beach
Good morning everyone!
6:10:25
axion
Does anyone happen to use company-mode in common lisp code buffers? I am trying to switch from auto-complete, but it seems to only be working in the repl mode. I would be interested in checking out someone's emacs config if it's no trouble.
7:31:57
phoe
axion: it works for me, but I use spacemacs - it's bundled in.
8:08:01
anticrisis
** NICK anticrisis_
8:20:35
phoe
What is the Lisp idiomatic way of counting digits of an integer?
8:21:01
phoe
I'd use a truncated decimal logarithm for that.
8:21:16
beach
I suppose you don't count initial zeros?
8:21:37
phoe
I'd always have infinite digits if I counted them. :)
8:21:50
phoe
I want (digits 1234567890) ;=> 10 in this case.
8:22:22
phoe
Also (digits -12345) ;=> 5 and (digits 0) ;=> 1, but these are easy once I have the tool for positive integers.
8:22:30
beach
Yes, the logarithm base 10 will probably. You might run into problems with precision if the numbers are large.
8:23:00
phoe
Either this, or I print an integer to string and use LENGTH.
8:23:32
beach
Does it have to be fast?
8:24:00
phoe
But then, my numbers won't have more than 100 digits I think, soo.
8:24:18
beach
Sure, then the length of the printed representation is probably best.
8:24:28
phoe
loke: yes, that's what I was thinking.
8:24:38
phoe
beach: with so little digits, LOG won't lose precision either.
8:30:52
otwieracz
Is this possible to match UNIX thread PID with SBCL thread?
8:31:04
anticrisis_
** NICK anticrisis
8:43:52
loke
The native function create_thread returns the thread id, but that return value is thrown away.
8:44:35
phoe
sounds like an improvement to SBCL
8:45:01
loke
I think it would make sense to save that value in the thread structure.
8:45:12
loke
You should psot it to the developer mailing list (or better, submit a patch)
8:45:28
phoe
just exactly my thoughts about saving it in the thread structure
8:45:31
loke
Check the function make-thread in target-thread.lisp
8:45:42
phoe
so later it can be retrieved
8:45:55
loke
You can see a call to %create-thread there. It checks whether the retyurn value is zero, bu8t if not, it should save it in the thread structure.
8:46:02
loke
Should be a small change to that function.
9:21:21
phoe
Is there any MOP way to prevent defining any writer or accessor functions for a class? I want to create a class that is immutable, as in, its slots are only set during creation.
9:21:41
phoe
Would this be achievable through a metaclass?
9:25:12
beach
http://metamodular.com/CLOS-MOP/setf-slot-value-using-class.html
9:26:14
phoe
That results in an error whenever SETF FOO is called.
9:26:52
beach
You define a subclass of STANDARD-CLASS, and then you define a method on (SETF SLOT-VALUE-USING-CLASS) that specializes to the new metaclass.
9:27:03
beach
The new method calls error.
9:27:37
phoe
Will this error be called during the compilation of a SETF method, or when such a method is used?
9:28:15
phoe
Good enough for my use.
9:28:54
phoe
And later I go (:metaclass 'immutable-class) inside DEFCLASS, correct?
9:29:19
beach
Not sure about the quote.
9:30:35
phoe
ACTION just thought of a very bad pun.
9:31:03
phoe
'not <- this expression is not quoted.
9:37:59
phoe
Can metaclasses be introduced by a protocol, since they are just classes after all?
9:38:36
phoe
Because it sounds pretty logical for it to work this way.
9:46:17
phoe
More importantly - if I declare this metaclass IMMUTABLE-CLASS to be a protocol class, meaning that it can't be instantiated, will I have to create a STANDARD-IMMUTABLE-CLASS as an implementation and use this as :METACLASS in DEFCLASS?
9:48:51
phoe
More generally speaking, are metaclasses instantiated? If so, at which moment? How many?
9:49:19
phoe
(Hello AMOP, my old friend...~)
9:57:05
pjb
'is is quoted but 'not is quoted too! 'not is not not quoted.
9:57:36
phoe
pjb: so 'not is not quoted but also '
9:57:40
phoe
'not is not not quoted?
9:57:51
pjb
Obviously, since 'not is quoted.
9:58:31
phoe
but how can 'not be not not quoted?
9:58:39
phoe
I don't understand it.
9:58:46
pjb
Perhaps I should say: 'is is is quoted. As in 'is is "is quoted".
9:59:03
pjb
'not is "not quoted" therefore it's quoted.
9:59:17
phoe
So: 'not is quoted and 'not is not quoted.
9:59:31
phoe
There, we broke logic using simple Lisp and simple English.
9:59:45
phoe
Can *YOUR* language do this!?!!1
9:59:51
phoe
ACTION coughs, goes back to programming.
10:01:49
phoe
...I seriously need to understand when and how metaclasses are instantiated.
10:02:19
phoe
I have class FOO that subclasses BAR and has a metaclass BAZ which subclasses QUUX.
10:02:37
phoe
When I define BAZ, is it instantiated, since it's a metaclass?
10:02:47
phoe
If I instantiate FOO, is BAZ instantiated?
10:02:59
phoe
If I instantiate another FOO, is another BAZ instantiated?
10:03:23
loke
phoe: Does it matter? (the answer is probabloyu no, by the way)
10:03:40
phoe
loke: yes, it matters for me.
10:03:56
phoe
Because if BAZ is a protocol class, then it cannot be instantiated. Only its subclasses can be instantiated.
10:04:04
phoe
So I cannot instantate any FOOs.
10:04:15
loke
What do you mean by "can't"?
10:04:37
phoe
I can't instantiate FOO, because it means that I'll have to instantiate BAZ, which is an error.
10:05:16
phoe
Because, by definition, protocol classes cannot be instantiated. BAZ is a protocol class, so I cannot instantiate it.
10:05:34
loke
phoe: There is no definition of "protocol class" in the clhs nor the AMOP as far as I know.
10:05:45
phoe
Yes, it's only defined in CLIM2 specification.
10:06:12
phoe
And also http://metamodular.com/protocol.pdf
Tuesday, 18th of July 2017, 10:07:21 UTC