Search
Saturday, 13th of October 2018, 8:59:44 UTC
9:22:21
earl-ducaine
I just ran into a character syntaxt that I've never encountered before: #.form
9:22:35
earl-ducaine
"Read-time value of form " ....effectively a quasi comma you can use inside ordinary quotes, e.g. '(one two #.(+ 1 2))
9:22:59
beach
That's an interesting description of it.
9:23:06
earl-ducaine
Is there ever a good reason to use that syntax?
9:23:59
beach
Sometimes you want to make clear to the person reading your code what the origin of a constant is.
9:24:17
Shinmera
For instance: (case something (#.*some-constant* ..) ..)
9:24:53
Shinmera
since case does not evaluate the cases, you can use read-time evaluation to get the constant in.
9:25:32
HerrBlume
CLSQL question: How do i do column aliases using the symbolic sql syntax?
9:25:39
earl-ducaine
I'm seeing the usage in xlib.... something like the following:
9:25:41
earl-ducaine
*event-mask-alist* '((:unmap-notify #.(make-event-mask :structure-notify))))
9:26:13
earl-ducaine
Is there any reason to prefer the #. construct to the quasi-quote one?
9:27:03
beach
earl-ducaine: With #., the evaluation takes place at read time.
9:27:24
beach
earl-ducaine: So there is no run-time cost involved.
9:28:31
earl-ducaine
Aha! That makes sense now.
9:28:54
beach
earl-ducaine: Here is another one for you #.(exp (* #c(0 1) pi (/ 4)))
9:37:56
earl-ducaine
My brain is too tired for CL obfustication... the #. I think is the source of trying bug. Periodically, I have to delete the binaries of a file I've compiled, even though the contents of the source file has never changed.
9:38:29
nokdoottt
https://pastebin.com/0HzYghJh, why result causes like this?
9:43:06
earl-ducaine
e.g. in my above example, if the function make-event-mask is changed, the value it produced when *event-mask-alist* was compiled will never get the update in an ordinary asdf build.
9:45:36
beach
nokdoottt: What is surprising to you?
9:45:48
pjb
(exp (* #c(0 1) pi (/ 4))) #| --> #C(0.7071067811865476D0 0.7071067811865475D0) |#
9:46:38
beach
nokdoottt: You are probably using rational arithmetic.
9:47:42
beach
nokdoottt: Er, what language is this?
9:48:11
beach
nokdoottt: This channel is dedicated to Common Lisp.
9:48:30
nokdoottt
Oh... I'm sorry..
9:49:07
beach
nokdoottt: Are you sure it is a big number rather than a ratio like 234234234234234234/234234242342342
9:49:16
beach
with a slash in the middle somewhere.
9:49:58
nokdoottt
Aghhhh you are right
9:50:10
beach
Then you are using rational arithmetic.
9:50:18
nokdoottt
I just checked it now :( Sorry about that
9:51:23
beach
earl-ducaine: You need to inform ASDF of the dependencies, of course.
9:51:30
nokdoottt
And thanks I will check that rational arithmetic.
9:52:12
beach
nokdoottt: If all your constants are rational and your operations preserve this fact, then the result is a rational as well.
9:52:33
beach
nokdoottt: The moment you stick in a float there, like 1.0, everything gets converted to float.
9:53:02
pjb
(rationalize PI) #| --> 245850922/78256779 |#
9:53:29
pjb
or 22/7 if you're lazy. (float 22/7) #| --> 3.142857 |#
9:58:27
nokdoottt
Ohh I see :> Thanks@
10:53:41
no-defun-allowed
There was a really nice three digit fraction for pi I had at one point.
10:54:21
no-defun-allowed
355/113 is accurate to 6 places.
11:03:01
no-defun-allowed
Single floats are supposed to be good for at least six digits with small numbers, so I'm happy with that.
14:22:14
Posterdati
still no fix for iolib under openbsd...
15:55:40
Posterdati
iolib is not usable on bsd systems, due to wrong error constants definitions in sockets/grovel.lisp and syscalls/ffi-types-unix.lisp
16:25:29
White_Flame
no-defun-allowed: specifically, 32-bit ieee floats have 7.22 decimal digits of precision
Saturday, 13th of October 2018, 20:59:44 UTC