<mrcom>
And I'm not missing a trick in getting COMPILE to do that, right?
<beach>
You can sort of do it...
<beach>
If you proclaim an FTYPE, it kind of works as a forward declaration.
<mrcom>
Yeah.
<beach>
And if BAZ is a generic function you can do a DEFGENERIC first.
<mrcom>
That's all I could think of, too.
<beach>
And your use case is kind of strange, because you typically use DEFUN only as a top-level form.
<mrcom>
I'm writing a temporary-definitions macro for unit tests.
<beach>
It would be more common to see LABELS used.
<mrcom>
For some stuff I'm testing in McCLIM, actually.
<mrcom>
I want to fire up a unit test, define the application, etc., and have it all go away at the end.
<mrcom>
Ready for the next unit in the suite...
dinomug has quit [Remote host closed the connection]
<mrcom>
It's kind of messy, and a pain, to manually include fmakunbound, etc. in the unit. Plus you've got to memoize defmethod results to be able to remove the right method.
<mrcom>
So hey, how hard could it be to just wait for definitions and roll them back?
<mrcom>
Well, I found out how hard.
<mrcom>
More fiddly than I expected, but not too bad.
<mrcom>
s/wait for/watch for/
<aeth>
if it works for a file, maybe write to /tmp/ and compile the file?
<mrcom>
Bingo.
<aeth>
In fact, that seems to be what C-c C-c in SLIME+Emacs does because if you get errors it's for a .lisp file in /tmp/ iirc
<mrcom>
I just didn't want to do that and have somebody point out the easy thing I overlooked.
<mrcom>
Oh, that's good to know.
<aeth>
I just confirmed it; if I C-c C-c a file foo.lisp that consists solely of (+ "hi") then I get an error that it's in file /tmp/slimeRLMKNe
<aeth>
for the SLIME expression compilation... file C-c C-k would obviously know the correct file
<beach>
mrcom: Does it help to surround the COMPILE with WITH-COMPILATION-UNIT?
<mrcom>
Nope.
<mrcom>
Kind of makes sense... COMPILE seems to be aimed at making individual functions more efficient.
<mrcom>
Since the body has to be wrapped in a lambda, it's not even top-level. That alone would probably break auto-forward-decl.
<beach>
I guess the warning doesn't happen at compile time, but when the function is run, yes?
<mrcom>
No, it's a compile. Run-time is fine, since at that point everything's defined.
<mrcom>
None of the (eval-when :compile-toplevel :load-toplevel) stuff runs in COMPILE.
<mrcom>
Just :execute.
<mrcom>
I think that's how SBCL, at least, is doing the forward decls.
<beach>
I don't get a warning at compile time for (compile nil '(lambda () (defun foo (x) (bar x)) (defun bar (x) x)))
<beach>
And I probably shouldn't.
<mrcom>
In SBCL?
<beach>
Yes.
<mrcom>
Hmm. I'm not either, when just run in bare repl.
<mrcom>
Safety, maybe?
<beach>
I have safety 3.
rgherdt has joined #commonlisp
<mrcom>
Hm........
<mrcom>
OK, something to figure out. Glad I asked, and thanks.
<ixelp>
;Compiler warnings : ↩ ; In X2 inside an anonymous lambda form: Undeclared free variable X1 ↩ => #<Anonymous Function #x14414C36>; T; T
<mrcom>
Similar on SBCL. compile-file is giving same error.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<mrcom>
...but not if defvar and defun are top-level.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
danse-nr3 has joined #commonlisp
synchromesh has quit [Ping timeout: 256 seconds]
synchromesh has joined #commonlisp
donleo has joined #commonlisp
thonkpod_ has quit [Ping timeout: 246 seconds]
thonkpod_ has joined #commonlisp
nybble has quit [Quit: WeeChat 4.2.2]
rendar has quit [Quit: Leaving]
rendar has joined #commonlisp
dino_tutter has joined #commonlisp
waleee has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
metsomedog has joined #commonlisp
makomo has joined #commonlisp
mgl_ has joined #commonlisp
pfdietz has quit [Quit: Client closed]
yitzi has joined #commonlisp
awlygj has joined #commonlisp
<flip214>
Does somebody know how many remote participants were on the Jitsi instance for ELS24?
msavoritias has joined #commonlisp
aciep has joined #commonlisp
cage has joined #commonlisp
chomwitt has joined #commonlisp
random-nick has joined #commonlisp
rtypo has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
boogsbunny has joined #commonlisp
varjag has joined #commonlisp
chomwitt has quit [Ping timeout: 268 seconds]
danse-nr3 has joined #commonlisp
rtypo has quit [Quit: WeeChat 4.2.2]
waleee has quit [Ping timeout: 264 seconds]
puke has joined #commonlisp
puke has quit [Max SendQ exceeded]
rtypo has joined #commonlisp
puke has joined #commonlisp
waleee has joined #commonlisp
puke has quit [Max SendQ exceeded]
jon_atack has quit [Ping timeout: 264 seconds]
puke has joined #commonlisp
puke has quit [Max SendQ exceeded]
jonatack has joined #commonlisp
puke has joined #commonlisp
decweb has joined #commonlisp
danse-nr3 has quit [Ping timeout: 268 seconds]
danse-nr3 has joined #commonlisp
ronald_ has quit [Ping timeout: 264 seconds]
chomwitt has joined #commonlisp
ronald has joined #commonlisp
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
yitzi has quit [Ping timeout: 240 seconds]
yitzi has joined #commonlisp
synchromesh has quit [Read error: Connection reset by peer]
synchromesh has joined #commonlisp
thollief has joined #commonlisp
chomwitt has quit [Ping timeout: 240 seconds]
X-Scale has joined #commonlisp
pfdietz has joined #commonlisp
King_julian has quit [Ping timeout: 268 seconds]
<pfdietz>
mrcom: that's working as intended. The defvar form is not in a top level context, so it is only evaluated when the method is called, not when it is compiled.
<beach>
I don't think it is evaluated at compile time when it's a top-level form either.
edgar-rft_ has joined #commonlisp
King_julian has joined #commonlisp
edgar-rft has quit [Ping timeout: 240 seconds]
<pfdietz>
Yes. I meant that the declaration of the variable as special must be recognized by the compiler. Thank you for the correction.
<beach>
Yes, that. :)
hayley has quit [Read error: Connection reset by peer]
jonatack has quit [Ping timeout: 268 seconds]
jonatack has joined #commonlisp
hayley has joined #commonlisp
yitzi has quit [Ping timeout: 260 seconds]
yitzi has joined #commonlisp
pranav has quit [Read error: Connection reset by peer]
aciep has quit [Remote host closed the connection]
tok has joined #commonlisp
chomwitt has joined #commonlisp
son0p has joined #commonlisp
yitzi has quit [Remote host closed the connection]
X-Scale has quit [Quit: Client closed]
pranav has joined #commonlisp
josrr has joined #commonlisp
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
chomwitt has quit [Ping timeout: 256 seconds]
reb has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 252 seconds]
jonatack has quit [Ping timeout: 252 seconds]
edgar-rft_ is now known as edgar-rft
jonatack has joined #commonlisp
pfdietz has quit [Quit: Client closed]
X-Scale has joined #commonlisp
ronald_ has quit [Ping timeout: 264 seconds]
msavoritias has quit [Ping timeout: 260 seconds]
ronald has joined #commonlisp
danse-nr3 has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
ronald_ has joined #commonlisp
pfdietz has joined #commonlisp
awlygj has quit [Ping timeout: 240 seconds]
Alfr has quit [Quit: Leaving]
danse-nr3 has quit [Read error: Connection reset by peer]
danse-nr3 has joined #commonlisp
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 240 seconds]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Alfr has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
attila_lendvai has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
whartung has joined #commonlisp
semarie has quit [Quit: WeeChat 4.2.2]
whartung has quit [Quit: Leaving.]
thuna` has joined #commonlisp
whartung has joined #commonlisp
semarie has joined #commonlisp
jmercouris1 has joined #commonlisp
King_julian has quit [Ping timeout: 268 seconds]
attila_lendvai has quit [Ping timeout: 268 seconds]
wacki has joined #commonlisp
jmercouris1 has quit [Quit: jmercouris1]
whartung has quit [Quit: Leaving.]
whartung has joined #commonlisp
craigbro has quit [Remote host closed the connection]
tursom has quit [Ping timeout: 246 seconds]
tursom has joined #commonlisp
mgl_ has quit [Ping timeout: 264 seconds]
msavoritias has joined #commonlisp
attila_lendvai has joined #commonlisp
nybble has joined #commonlisp
msavoritias has quit [Ping timeout: 256 seconds]
lucasta has joined #commonlisp
X-Scale has quit [Quit: Client closed]
lucasta has quit [Quit: Leaving]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<yottabyte>
I've been using yason, but yason:encode seems to return a hash-table for me, I want it to return a string. I've tried using format with it but that doesn't seem to do the trick either
<yottabyte>
it's not beyond the realm of possibilities that I'm doing it incorrectly, though...
alcor has joined #commonlisp
wacki has quit [Read error: Connection reset by peer]
jonatack has quit [Ping timeout: 256 seconds]
wacki has joined #commonlisp
kiyafirs has joined #commonlisp
whartung has quit [Quit: Leaving.]
mgl_ has joined #commonlisp
mgl_ has quit [Ping timeout: 260 seconds]
jonatack has joined #commonlisp
yitzi has joined #commonlisp
<yitzi>
yottabyte: Thats as expected. It returns the object and encodes to the stream.
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
eddof13 has joined #commonlisp
wacki has joined #commonlisp
contrapunctus has left #commonlisp [#commonlisp]
pranav has quit [Read error: Connection reset by peer]
contrapunctus has joined #commonlisp
<josrr>
yottabyte: you can use yason:with-output-to-string*
<_death>
for a list you might keep a reference to the last cons and detach/reattach as needed
<varjag>
guess i just shuffle conses by hand
<aeth>
shiftf and rotatef are part of §5.3 The Data and Control Flow Dictionary so it's not entirely clear... looks like they work on places, so cadrs and stuff
<_death>
there's alexandria:rotate though I don't remember how it's implemented
<varjag>
hmm
contrapunctus has left #commonlisp [#commonlisp]
<varjag>
nah it can't be composed to rotate the head efficiently
<gilberth>
Surprisingly NTHCDR itself is not a place.
<varjag>
oh nice
ethanxxxl has joined #commonlisp
<thuna`>
,(nthcdr 4 '(1 2))
<ixelp>
(nthcdr 4 '(1 2)) => NIL
lucasta has quit [Ping timeout: 240 seconds]
<thuna`>
It's not immediately obvious what (SETF NTHCDR) would do in such a situation. If you decide to treat it as equivalent to (SETF (CDR (NTHCDR (1- N) ...)) ...) then you need to special-case (SETF (NTHCDR 0 ...) ...) which is not as bad as it gets but not particularly nice either.
<gilberth>
Oh, right.
<remexre>
is there an optimized count-trailing-zeroes (that compiles to one instruction for fixnums) for SBCL? (or ideally some trivial-* package that does the slow thing for impls that don't have an optimized builtin)
tok has quit [Remote host closed the connection]
donleo has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<pfdietz>
(setf (nthcdr 0 <place>) <val>) would just be equivalent to (setf <place> <val>). The key is that the argument has to be a place.
symdrome has joined #commonlisp
amb007 has quit [Ping timeout: 268 seconds]
<gilberth>
It would make for an interesting setf expander.