Search
Tuesday, 20th of October 2020, 13:49:38 UTC
15:14:57
jmercouris
if I type (type-of 10) -> (INTEGER 0 4611686018427387903)
15:15:37
jmercouris
how can I go from the symbol 'INTEGER to something I can check with subtypep
15:15:59
jmercouris
(subtypep (type-of "salmon") 'integer) -> NIL
15:16:16
jmercouris
sorry, brain freeze, I even wrote it earlier
15:21:56
Bike
(subtypep (type-of x) y) is just (typep x y) but worse
15:22:14
jmercouris
I want to be able to accept subtypes
15:22:31
jmercouris
if I define a type B that is a subtype of A
15:22:36
Bike
(typep 0 'integer) will be true, obviously, even though 0 is also of type fixnum
15:22:36
jmercouris
I want the user to be able to supply A or B
15:22:53
jmercouris
maybe subtypep is not what I think it is
15:23:28
Bike
could you explain a higher level view of what you're trying to do?
15:23:38
jmercouris
I am trying to validate user input for users configuring things in Nyxt
15:23:45
jmercouris
to check that the user input is of a specified type
15:24:00
Bike
that sounds like a job for typep.
15:24:07
jmercouris
OK, I will trust your judgement
15:24:17
Bike
i mean, if you have a class A and a class B, and A is a subclass of B, and x is an instance of A
15:24:28
Bike
that's what you're concerned about, right?
15:25:00
Bike
yeah, typep doesn't just check the direct class (the result of class-of)
15:25:08
jmercouris
OK, good to know, thank you
15:25:09
Bike
you have to go out of your way to do that, because it's kind of a weird thing to do
15:25:18
Bike
violates whatchamacallit substitutibility
15:25:27
jmercouris
ah, yes, the candy bar suitability
15:25:48
jmercouris
ah, didn't know this had a name, now I know
15:26:08
Bike
it's the kind of thing that's in theoretical texts that aren't read by very many actual programmers :v
15:26:40
Bike
you can tell because the definitions use greek symbols
16:18:46
edgar-rft
ACTION is the lamb of da
16:39:41
ym
Hi. When I put let-definition of array which is initialized with initial-element inside of do, I have re-initialized array each iteration. I'm sure SBCL optimizes such definition so that it won't allocate memory for array each iteration, but how do I check it?
16:44:42
Xach
ym: i don't think it's a matter of optimization, but a matter of specification - the initial-element is evaluated only once to initialize, not repeatedly.
16:45:14
Xach
ym: you can check by profiling the memory growth, but that is not super-simple
16:45:36
Xach
you could also check by tracing the array creation (this would be easiest if you wrap array creation with a function of your own)
16:48:58
Xach
e.g. (defun make-my-array () (break) (make-array 42 ...))
16:50:06
ym
Checked. Array being created each iteration.
16:50:41
Xach
ym: Ok. I think I have misunderstood your description, then. What does the code look like, if you can share it?
16:51:01
ym
(let ((a (make-array 5 :initial-element 0 :adjustable nil)))
16:51:46
Xach
ok, no, there is no reasonable expectation of a single array allocation there.
16:52:10
phoe
you might need to declare A to be of DYNAMIC-EXTENT
16:52:29
phoe
in this particular case, I mean
16:52:33
Xach
when you talk about DO, i expected to see code with DO in it.
16:52:34
Bike
what outputs are you expecting here, exactly
16:56:51
Bike
if you replace that make-array with make-my-array, semantically break must be called each iteration
17:05:47
ym
Ok, thanks. Manually re-initializing seems clearer anyway.
17:08:19
johnjay
question. am i supposed to type (load "~/quicklisp/setup.lisp") everytime I start sbcl?
17:08:33
johnjay
i get error QL does not exist if i don't
17:09:27
phoe
johnjay: (ql:add-to-init-file)
17:10:20
johnjay
that looks promising. also i didn't see that anywhere
17:10:41
phoe
quicklisp prints that after installation
17:10:53
phoe
but it's not too hard to miss it
18:52:05
Xach
Darn, I am bummed that you can't make a symbol-macro out of a keyword.
18:52:27
Xach
Was hoping to cheat my way into a repl-command type thing.
18:52:53
Xach
where :display does something like (display *)
19:08:56
dlowe
you could still do it with a use-d package
19:17:38
pve
Xach: Sounds like reader hack time: https://plaster.tymoon.eu/view/2085
19:18:47
dlowe
it's true that you don't *have* to use the basic reader on a repl
19:19:24
pve
I think a separate REPL reader is a pretty neat idea
20:13:07
rpg
phoe: It's OK, I just figured it out -- I was having troubles with cl4py with undefined functions. Then I dug around and figured out that macros (for reasons that are obvious when I think about it) are not available
20:13:40
rpg
But it was pretty puzzling until I figured that out.
20:15:48
phoe
I am now curious why I would get called for cl4py!
20:16:52
phoe
pve: that'll almost work, lispworks doesn't let you defun on keywords for whatever reason
20:17:02
phoe
s/almost work/work almost everywhere/
20:19:58
pve
well for lispworks one would have to put the functions in another package then
20:20:38
rpg
phoe: Sorry -- somehow I got you and marco confused in my head!
20:20:39
phoe
or write a similar reader macro!
20:21:29
phoe
I have no idea how you could confuse us two, he's the cooler and smarter one and weighs much less
20:22:37
pve
phoe: but does the spec say anything about defun on keywords?
20:24:05
Xach
lispworks complains though.
20:25:19
pve
I'm somewhat tempted to revise my paste
20:30:08
pve
does lispworks complain now? https://plaster.tymoon.eu/view/2085
20:30:44
phoe
that's a hack, but it shouldn't complain now
20:32:33
pve
phoe: more of a hack than the previous thing?
20:33:39
pve
but that's a hack I can live with, to be honest
20:57:10
sgithens
I just noticed that the quickdocs powering the quicklisp search from the quicklist webisite has been shutdown... what is the current suggested way of searching quicklisp modules?
20:58:57
phoe
(format nil "https://quickref.common-lisp.net/~A.html" system-name)
20:59:48
sgithens
phoe thanks. I guess they're all on one page so you can sort of search them
21:00:56
Xach
ACTION needs to update the search target
21:02:54
rpg
phoe: I have trouble with IRC handles....
21:07:55
phoe
rpg: I was teasing, no problem with that
21:12:44
phoe
reddit tells me the condition book's ebook version is now available
21:15:50
dra
phoe: My dead tree edition is supposed to be delivered Nov 13.
21:15:57
dra
I hope people don't post spoilers. ;)
21:18:35
phoe
Xach: ouch that was a good one
22:41:22
jgodbout
Boston Lisp meetpu at 7: https://common-lisp.net/project/boston-lisp/
23:59:53
jedii
I am learning lisp I feel so good. Opens gentle introduction....
Wednesday, 21st of October 2020, 1:49:38 UTC