Search
Thursday, 26th of March 2020, 20:36:13 UTC
20:39:18
hjudt_
flip214: thanks. in my case, i really need the around method to be part of the program, not only for profiling. i track the durations an action takes and present it in the web ui. but your hint will make me read up on these sbcl features ;-)
21:18:14
Lord_of_Life_
** NICK Lord_of_Life
21:40:44
Josh_2
https://plaster.tymoon.eu/view/1721#1721 why does tst2 return 2?
21:41:49
Josh_2
why does the λ change the functionality?
21:45:30
Bike
well, because (lambda () (special-if (x 1 2))) is a function, no?
21:45:32
pjb
Josh_2: tst2 doesn't return 2, it returns a closure.
21:46:10
Bike
did you think that it wouldn't change the functionality? could you describe what you think lambda does?
21:46:46
pjb
Josh_2: if you lie, we won't be friend long… https://termbin.com/t29s
21:47:45
Josh_2
When I funcall the λ it returns two
21:47:48
pjb
and the result of tst2 itself returns 1: https://termbin.com/73l9
21:48:42
Josh_2
https://imgur.com/WJ0nmpW.png
21:49:12
pjb
(defun tst2 () 3) #| --> tst2 |# (tst2) #| --> 3 |# See, it returns 3 for me!
21:49:56
Bike
(tst1) = (funcall (tst2)) = 1 here.
21:50:25
Bike
Your repl is weird. Why is it printing numbers like emacs does? Where's the NIL coming from?
21:51:29
Josh_2
Why am I getting a different result
21:51:42
Bike
are you sure you haven't redefined special-if or something in the interim?
21:52:21
pjb
Also, when you redefine a macro, you need to recompile and reload all the functions that use it.
21:52:40
Josh_2
I restarted my lisp image, still getting 2
21:52:58
Josh_2
https://imgur.com/h6FTbLz.png
21:53:18
pjb
you are not showing us the whole dribble, so we just don't believe you, liar!
21:53:19
Bike
Could you show the entire session? Like the part where you define the functions and macro as well?
21:53:38
pjb
We didn't saw any lisp image restarted.
21:54:22
ear_the_art
** NICK ear-the-art
21:55:15
ear-the-art
Bike, the NIL coming from the print, i think
21:55:52
Bike
hm, i suppose, though it doesn't make any sense for it to be nil
21:56:36
Bike
prolly had a typo somewhere. it happens
22:02:16
Josh_2
Well anyway I have another issue along the same lines https://plaster.tymoon.eu/view/1722#1722
22:03:57
Josh_2
The form is printed fine, but when funcalled with 2 as the argument, instead of throwing an error it returns the value of byte
22:09:11
Josh_2
I do not understand why a condition is not signalled. in the example I sent byte is 1 not 2..
22:16:24
pjb
Josh_2: nope, this is not the error one gets: https://termbin.com/38mq You are using an undefined operator tlet, which leads to this error!
22:17:01
Josh_2
can just replace tlet with let and remove "integer"
22:18:03
pjb
Then, Works for me: https://termbin.com/lh29
22:20:00
pjb
Josh_2: you should debug subexpressions separately.
22:20:12
Josh_2
but byte is not equal to 2, why wouldn't it error?
22:21:10
pjb
Josh_2: (eq byte 2) is true.
22:21:14
pjb
Josh_2: only CL:NIL is false.
22:21:20
pjb
Josh_2: everything else is true.
22:21:58
pjb
Josh_2: https://termbin.com/t89i
22:23:40
Josh_2
I know that, but why isn't the form being evaluated
22:24:07
Josh_2
I know that (eq byte 2) is true, but why isn't (eq byte 2) being evaluated
22:24:47
Josh_2
That's my question basically
22:25:19
pjb
Well, it's not easy. You are wanting to build a form at run-time, and get it evaluated in a lexical scope. This is not possible directly in CL.
22:25:41
pjb
CL:EVAL evaluates in the global environment, not in a lexical scope.
22:26:25
pjb
But you can keep susbtituting, because the lexical scope is known to you, at program editing time. SO you can write the code that will substitute, not with 'byte, but with the value of byte!
22:26:55
pjb
(let ((byte 2)) (eval (change-byte '(eq :byte 2) #|no quote|# byte))) #| --> t |#
22:27:03
Josh_2
the value of byte is not known until the λ is funcalled
22:27:32
pjb
Then call change-byte at that time.
22:27:53
pjb
Now, if you prefer, you may generate a lambda-expression, and use eval coerce or compile to get a function.
22:29:03
pjb
But it won't be a closure. you must substitute into the lambda-expression all the values you need.
22:29:53
pjb
Now, since your function is named generate-<something> I would let it return the lambda-expression, and call eval, coerce or compile outside of it.
23:23:02
Josh_2
pjb: Thanks for the help :) I have it all working now!
0:13:58
amazoniantoad
Hi guys. Is there a way to suppress all warning from within slime?
0:20:18
Bike
all warnings from all lisp code at all? don't think so
0:20:40
dlowe
there might be, but it wouldn't be portable across implementations
0:20:41
Bike
you could wrap the repl with a muffler, i guess, but i don't think slime has that as an option
0:21:14
Bike
and it probably wouldn't effect compilation stuff so much
0:23:10
amazoniantoad
Okay. Just like, most of the warnings then?
0:23:22
amazoniantoad
I'm getting a very specific (and annoying) error
0:23:36
amazoniantoad
It is messing up my ability to read stuff because it kinda takes over
0:24:46
amazoniantoad
WARNING: unrecognized declaration (IGNORE ARG1 ARG2)
0:27:06
amazoniantoad
Sorry, not error. but a warning
0:27:21
no-defun-allowed
Where did you put that declaration?
0:28:09
amazoniantoad
inside of a function? I don't understand what you mean by where
0:28:11
amazoniantoad
Also nice username
0:28:11
Bike
it should give you a place the error is coming from
0:28:23
amazoniantoad
Oh, well I know where the errors are coming from.
0:28:36
Bike
did you shadow the IGNORE symbol, or something?
0:28:43
amazoniantoad
I am new to lisp. This is my partners code in an assignment. I'm just trying to suppress this warning
0:29:23
Bike
usually you fix the problem rather than suppress the warning
0:29:32
Bike
it looks like a simple one
0:29:47
Bike
if you paste some of the code, we can probably identify it for you, if you can't
0:29:58
amazoniantoad
I don't think he would like me sharing code. I'm sorry.
0:30:00
amazoniantoad
Thanks anyways
0:30:20
Bike
we're not going to steal his broken code :) maybe you should get him to fix it, then
0:30:44
amazoniantoad
He's done so much. I don't want to bug him, lol.
0:30:55
amazoniantoad
But maybe I should
0:32:26
Bike
well, i'm going to guess here, but wherever the (ignore arg1 arg2) line is, try replacing that with (cl:ignore arg1 arg2)
0:32:42
amazoniantoad
Thanks. I'll try that
5:22:34
beach
Good morning everyone!
8:10:30
aeth
Shinmera: Any chance of adding a NaN to float-features like you have infinities? There are many NaNs, of course, but I think any NaN would do when reading in a NaN from a file (or rather, a string representing the concept of "NaN"). It's just bits-single-float or bits-double-float with the right (wrong?) bits, I guess.
8:10:51
aeth
They also apparently have to be function calls, not constants, based on a conversation here a while back, maybe 4 years ago.
8:12:10
Shinmera
I suppose that's reasonable enough.
8:12:22
Shinmera
I won't implement it myself, but I'd be open to a PR.
8:13:14
aeth
e.g. (float-features:bits-single-float #x-4000)
8:13:24
aeth
I'm not sure I'd want to PR one line
8:13:55
Shinmera
There's documentation, testing, and more involved.
8:14:05
Shinmera
So definitely not just one line.
Friday, 27th of March 2020, 8:36:13 UTC