freenode/lisp - IRC Chatlog
Search
4:29:44
aeth
hmm, it looks like I run into the sb-ext:*inline-expansion-limit* if I declaim inline too much (the error actually asks me if I'm inlining something recursive)
4:32:42
aeth
It's because I have little inlined functions for (aref foo 0) (aref foo 1) etc and then a function that uses a lot of those that is in turn inlined, that is in turn used multiple times in the functions that give the warning. I comment out the inlines for those tiny functions and it's gone.
4:33:35
aeth
https://gitlab.com/zombie-raptor/zombie-raptor/blob/2f7c9d2bf19c7b275ff93a6e4e7c22fbdfe48848/math/quaternion.lisp#L69-75
4:34:11
aeth
which is called 4-5 times in model.lisp, where the errors happen (but only one of the random calls per function)
4:43:12
aeth
|3b|: unfortunately, quaternion* is probably something that needs to be inlined for performance reasons (and is probably the largest one that has to be)
4:43:38
aeth
Inlining my mostly-trivial quaternion functions got rid of pretty much all of my game loop allocations
4:43:53
|3b|
function call is relatively small part of a function that does a lot, have you profiled?
4:44:22
aeth
|3b|: I'm guessing when I inline the quaternion allocations, SBCL is smart enough to automatically (declare (dynamic-extent some-quaternion)) which does help a lot
4:44:52
Bike
yeah i don't think sbcl knows how to dynamic extent anything that isn't a direct make-array or make-struct or whatever
4:47:34
aeth
Bike: I have two versions of most functions, some allocate into an existing vector/quaternion (usually -into!) and some allocate a fresh vector/quaternion
4:54:36
aeth
I did rewrite some to take advantage of inlining, though, (and reduce repitition) so it looks like there is more allocations than there were
4:56:16
aeth
I think what really got rid of most of the allocations, though, was inlining the quaternion function that makes the quaternions themselves
4:57:31
Bike
yeah cos like i said http://www.sbcl.org/manual/#Dynamic_002dextent-allocation "SBCL implements stack allocation for"
5:01:22
aeth
The rest of the allocations that went away were probably due to something like it not being aware of a type somewhere or something.
5:02:20
Trioxin
does anyone have a long-running program that's constantly searching the entire programming space in some fashion? I remember ray kurtzwiel once say "I could write a superintelligence in 50 lines of Lisp." Of course it would take more computational power than we have for that to be worth anything but it would still be a cool thing to have running.
5:04:04
aeth
If I could write a superintelligence, I could write a superintelligence in 1 line of Lisp. Mainly because if it can fit in one top-level form it can be put all on one line (but shouldn't) :-p
5:04:50
aeth
Someone should start an International Obfuscated Common Lisp Superintelligence Contest one day.
5:05:20
fiddlerwoaroof
Yeah, a superintelligence is more defined by the speed it gets an answer than whether or not it will eventually get an answer
5:05:32
Bike
and an AI isn't exactly a mu recursive function so a normal thing like interleaving computation would be meh
5:07:07
aeth
Trioxin: I've heard exactly the opposite from some people. That we have the computational power already, but we don't have the algorithms.
5:07:51
Bike
the blind search would take more "computational power" than we have, insofar as that means anything
5:07:57
Trioxin
aeth, that's a separate thing. what he meant was a program that's just randomly trying different arrangements of code
5:08:37
PuercoPop
jasom: The following snippet from the reference of Parenscript does not match the documentation. Would this be considered a bug? (ps:ps (new (Person age shoe-size)))
5:08:57
aeth
In case anyone reading isn't familiar: https://en.wikipedia.org/wiki/Infinite_monkey_theorem
5:09:44
aeth
The problem with infinite monkeys with infinite typewriters is... infinite is huge. No, larger than that. No, even bigger.
5:11:54
aeth
Trioxin: well you could just have humans read the programs, and maybe it'd inspire someone if it's close
5:13:59
aeth
I thought of something a long time ago about just generating an infinite amount of images. You could simplify by e.g. only having it be black or white and you'd probably still get some meaningful images generated.
5:15:55
aeth
Bike: almost everything will be static noise (although humans will still see patterns in those), but you'll also find everything that can be expressed at that image size, as long as it's small enough that you can actually generate them all
5:17:00
Bike
i mean, there are, let's check the old calculator here, 10^19728 ish 256×256 black and white images
5:19:21
aeth
Trioxin: right, the advantage is you'd have to go so small that deep learning could handle the images! :p
5:19:44
aeth
So maybe you brute force generate the images, feed them into deep learning to eliminate noise, and then look at what you brute force generated?
5:20:44
aeth
you could also find a way to filter things that will mostly look like static ahead of time, somehow
5:22:56
aeth
Bike: one advantage to the dumbest approach, though, is that it's embarassingly parallel
5:27:36
Bike
if you did a quintillion images every attosecond it would still take 10^716 seconds to get the entire search space. it is a dumb problem.
5:34:51
Bike
what a terrible attitude. lots of scientists can't touch anything they work with, you know.
5:44:42
aeth
I inefficiently solved the image problem for a 2x2, btw: (let ((v (make-array 4 :adjustable t :fill-pointer 0))) (dotimes (i (* 2 2) v) (vector-push-extend (read-from-string (format nil "#*~2,'0B" i)) v)))
5:52:39
aeth
this is how it scales: (let ((v (make-array 50 :adjustable t :fill-pointer 0))) (dotimes (i (expt 2 (* 4 4)) v) (vector-push-extend (read-from-string (format nil "#*~16,'0B" i)) v)))
5:53:28
aeth
so I'm getting (expt 2 (* 50 50)) for the 50x50 version... and (log (expt 2 (* 50 50)) 10) => 752.575
5:54:56
aeth
If you want to run out of memory: (let ((v (make-array 50 :adjustable t :fill-pointer 0))) (dotimes (i (expt 2 (* 50 50)) v) (vector-push-extend (read-from-string (format nil "#*~2500,'0B" i)) v)))
5:55:19
aeth
There are far more efficient ways of doing it, but if Bike's right you won't avoid the (expt 2 (* 50 50)) so it won't matter
5:59:03
aeth
If you wanted to be smart with memory, you'd probably make it all one big simple-bit-vector and just make each image a subseq
6:03:40
aeth
That's 3 bytes less than (expt 2 62) or (expt (expt 2 10) 6.2) so about 4 exbibytes of RAM.
6:10:20
aeth
That's not enough to fit the whole thing, which would afaik require (* 2500 (expt 2 2500)) which afaik means it'd need a unit at 1024 to the (log (* 2500 (expt 2 2500)) 1024) => 251.12877
6:15:04
aeth
If I modelled it right, though, 6x6 does fit in contemporary RAM with just (* 6 6 (expt 2 (* 6 6))) bytes required so (/ (* 6 6 (expt 2 (* 6 6))) (expt 1024 4d0)) => 2.25d0 TB
6:18:32
aeth
so I guess stick to 5x5, which is much closer to what my intuition thought (it doesn't look like I actually named any numbers, I too was afraid of Bike to do that)
6:19:53
smokeink
is it possible to "hook" at higher level and make a restart that's triggered inside a form execute it's original code + some more ?
6:21:09
drmeister
It's like everything takes 1.5x longer and uses 1.5x more memory. It's very frustrating.
6:22:17
smokeink
the thing is this restart is inside a library , it doesn't accept a function as it's parameter
6:23:39
smokeink
is it possible at higher level to add an extra restart that if chosen by the user then it will execute a restart defined in the lib + some extra code given by me at higher level ?
6:39:52
smokeink
hmm, im gonna try to wrap it in a handler-bind and add a restart-case inside handler-bind's lambda function
6:43:26
smokeink
i want to call checkl-store only when use-new-value restart is chosen, not every time the error is signaled . Because sometimes the error might be due to a real bug in the functions so i don't want test results to be updated to some wrong ones
6:47:36
Bike
in slime you can just hit 'e' to evaluate something. you can just type in the checkl-store form.
6:48:58
Bike
so you want a level of optimization where you still select the restart manually, and it does that for you?
6:50:02
smokeink
the only manual action is to select use-new-value restart, and i want it automatically to save the results to file
6:52:01
smokeink
use-new-value just updates the values in memory, it does not save the values to the file
6:53:21
Bike
(handler-bind ((checkl::result-error (lambda (c) (restart-case (error c) (use-new-value-and-save (new-value) (checkl-store #p"/test/values.txt") (invoke-restart 'use-new-value new-value)))))) (check-formal or whatever))
7:07:05
smokeink
use-new-value doesn't have a param , checkL uses a global var. Now the only problem is that (invoke-restart 'check::use-new-value) has to be evaled before (checkl-store) so that the value in the global var is updated before it's dumped out to the file.
7:18:34
smokeink
(funcall (slot-value (find-restart 'checkl::use-new-value c) 'function)) <- this one
7:19:17
Bike
there is no way to invoke the restart without transferring control, because that doesn't make sense
7:23:37
smokeink
bike: yeah but it'd be cool to have 'restart' (the transfer of control) and 'restart-body' (the code before transferring control) separate
7:27:41
smokeink
so can we say that checkL has a design issue , since we can't hook into that restart and automatize stuff ?
8:20:13
shaftoe
is there a way to see available slot-values or accessors on a class instance object?
8:28:55
contrapunctus
Just what am I doing wrong? (cl-ppcre:regex-replace-all "\\p{IsGraph}" "abc" "X") => "abc" (rather than "XXX"; cl-unicode is loaded)
8:29:00
smokeink
swank can inspect functions and display the assembly code, can the asm code be examined without swank ?
8:56:14
flip214
contrapunctus: is the installed cl-ppcre from a system package? "apt-get remove cl-ppcre" and then "(ql:quickload :cl-ppcre")
8:57:47
jdz
contrapunctus: I don't see IsGraph here: http://www.unicode.org/reports/tr18/#General_Category_Property
9:11:34
jdz
contrapunctus: it depends on what you are _really_ after. For instance, check http://www.unicode.org/reports/tr18/#Compatibility_Properties, the "space" row.
9:11:57
phoe_
contrapunctus: (loop for char across string unless (graphic-char-p char) do (setf char #\X))
9:17:13
jdz
«The characters in \p{gc=Format} share some, but not all aspects of control characters. Many format characters are required in the representation of plain text.»
9:18:50
jdz
contrapunctus: http://www.unicode.org/reports/tr18/#Compatibility_Properties also has a "graph" row -- maybe that's what you want?
9:19:47
contrapunctus
a different (less robust?) way of doing the same thing, I guess, is - (cl-ppcre:regex-replace-all "\(^\| \| \)\"" "\"abc\"" "\\1``")
9:20:57
jdz
contrapunctus: if you just want to substitute particular characters then you don't even need regular expressions (and you've been given example code already).
9:22:01
iago
clisp noob here, but if you want to match everything but withespaces wouldn't be easier to negate a char class ? [^\s\n\t\r]
9:23:09
contrapunctus
loke: I'm writing a script to convert Wikisource books to LaTeX; some of them use "", some “”
9:23:59
beach
iago: CLISP is an implementation of Common Lisp. So we don't use CLISP as an abbreviation for Common Lisp. Use "CL" if you must abbreviate.
9:26:02
jdz
Actually, both „” and «» are "valid" in Latvian, and those might be because of the German influence.
9:27:03
loke
jdz: That's the largest newspaper in Sweden, and has traditionally been the bearer of language correctness for the last 100 years.
9:29:09
loke
it's probably because I grew up with it, but I feel the ”right quote” style is much nicer than the “upside-down” style. But... I use it when writing in English, of course.
9:30:08
loke
What is not entirely clear to me is how to use ‘single’ vs. “double” quotes in English. In Swedish it's much easier: You ”use then when you have a ’recursive’ quote”.
9:30:17
flip214
speaking as someone who's doing erratas from time to time, having matched quote pairs is just another thing that goes wrong. Even if it's nicer to read ;)
9:31:11
flip214
these should just fall out correctly by using some sane text processing system... but most people don't.
9:31:55
loke
flip214: True. I've mapped all of these quotes to my keyboard so I can use them correctly. Easier than crossing your fingers and hoping your mail client does the right thigng.
9:33:00
loke
jdz: And Emacs is one of those applications that doesn't even try to be clever in that respect. The other way I type emails is in Gmail.
9:33:31
jdz
But yeah, I also have them mapped in my keyboard layout (which I've had to create manually anyway, since there is no Dvorak/Latvian out of the box).
9:35:15
jdz
loke: well, accented characters, and they are part of the alphabet as separate letters, yes.
9:38:12
TMA
we have three diacritics too: acute (á), caron (č), and ring (ů); there is also sometimes an umlaut in german loanwords too
9:48:32
TMA
flip214: ĉ is like the English ch (esperanto), å has its swedish sound and ŕ is long vocalic r, therefore the ĉåŕ is disyllabic: ĉå-ŕ :)
9:49:44
TMA
flip214: altogether it would be probably mispronounced as čór which is Roma word for thief
9:55:32
TMA
flip214: fitst, there is no palatalization of the initial consonant in czar (palatalization is the difference between s and sh (try the unpalatalized sit versus the palatalized variant; observe your tongue tip position)
9:56:06
flip214
TMA: thank you very much. but it was meant as a joke, so this is too many details. sorry.
10:40:00
phoe_
the everlasting battle that no one I know watches because I don't see PROG or PROG* used in the code that I read.
10:57:22
phoe_
lieven: clearing it up, formatting, hyperlinking, and exposing to the Lisp community in a clean, expandable and editable format.
10:58:15
lieven
one of the major things I always disliked about it is that some fairly important stuff is hidden in the glossary
10:59:06
phoe_
once I finish roughlu converting the specification, we (as a community) will be able to address the problems with its current form.
10:59:38
phoe_
and I mean it. the more issues we have there, the more material we will have for building better documentation for CL.
11:05:53
phoe_
lieven: do it even if you don't remember it right now. This way I'll be able to poke you about it in the future and/or perhaps find out what you meant by other menas.
11:06:45
phoe_
the side effect of me editing the specification is - I've finally learned how to DEFINE-MODIFY-MACRO properly
11:09:23
jackdaniel
phoe_: you may add note regarding defsetf, that while it's not required by the spec, many implementaitons allow defining defsetf for multiple-values
11:11:27
phoe_
you stare at that DEFSETF you encounter in your code and it laughs at you, "HAHA THIS IS NOT EVEN MY FINAL FORM"
11:13:56
phoe_
like, something I can copypaste into the spec as an actual example under Editor Notes?
11:30:02
ogamita
(let ((x (list 1 2 3 4 5)) (v 0)) (when x (setf (car (nthcdr (truncate (1- (length x)) 2) x)) v)) x) #| --> (1 2 0 4 5) |#
11:33:25
jackdaniel
phoe_: hum, I was wrong, this is explicitly allowed by the spec. Don't know why I have remembered it that way. There may be any number of store variables.
11:34:19
jackdaniel
but you may still use the example if you like it: http://paste.lisp.org/display/338667
11:34:39
jackdaniel
scratch the first comment, after double checking it happens I have misremembered
11:37:54
ogamita
jackdaniel: in your example above, you lose a value. (setf (values (point-x p) (point-y p)) (values 1 2))
11:38:49
jackdaniel
I believe it is a conforming code. At first I thought it's not, but I have doulbechecked
11:41:29
ogamita
Well, I suppose one could write a setf expander that would allow storing multiple values at once. (setf (point p) (values 1 2)) (assert (and (= 1 (point-x p)) (= 2 (point-y p)))) should be possible (I don't have time to try it out right now).
11:46:59
phoe_
I'm not putting this in the manual for the specification without first defining Alexandria
11:48:05
phoe_
jackdaniel: yes, but I need an example for standard CL without any external libraries
11:48:57
phoe_
I mean - I *want* to vote for intertwining Alexandria in the examples at some point because it's pretty much a standard library nowadays
11:53:49
scymtym
jackdaniel: i think DEFSETF takes care of evaluation order issues: "During the evaluation of the forms, the variables in the lambda-list and the store-variables are bound to names of temporary variables …"
11:54:38
sjl
* wishes alexandria's once-only used the given symbols for the gensym names, instead of naming everything once-only1234
11:55:12
jackdaniel
(let ((point (make-point))) (setf (foo point :kind :2d) (values 1 2)) (print point))
11:57:48
jackdaniel
regarding showing the point, just create it beforehand and print it after defsetfing it
12:01:49
jackdaniel
however the setf could be factored to (setf (values (point-x ,point) (point-y ,point) (point-z ,point)) (values x y z))
12:04:17
jackdaniel
we could go even futher by doing this in ecase, so setfing 2d point will return two values, but I've got to leave for a while now
12:31:05
phoe_
If I spent five minutes thinking about this and only got a clear answer with your help, other people will get stuck here as well.
12:34:17
sjl
if I were implementing that example I'd say (define-setf-expander ldb (bytespec integer-place &environment env) ...)
12:34:36
sjl
to make it clear that a) the second arg must be a place, and b) the place is expected to contain an integer at runtime
13:10:13
pareidolia
Does anyone know of a library that does HTTP header parsing like the Accept header in complex cases like this: "*/*;q=0.5, application/xml, application/xhtml+xml, image/png, text/plain;q=0.8, text/html;q=0.9"
13:11:30
ogamita
ah, but you mean, for a HTTP client. We use drakma in general. I don't know if drakma manages this.
13:16:14
scymtym
pareidolia: more a proof-of-concept but maybe still useful: https://github.com/sbcl/specializable/blob/master/src/accept-specializer/accept-specializer.lisp#L89
13:38:08
Xach
oh. to me it screams "90s". but i grew up in the 90s, so it has a kind of nostalgic cool. but i wouldn't agree with timeless.
13:39:13
pareidolia
Xach: I also love this particular style of typesetting https://image.slidesharecdn.com/borlandcversion3-131119125256-phpapp02/95/borland-c-version30usersguide1991-14-638.jpg?cb=1384865966
13:58:57
beach
special form n. a list, other than a macro form, which is a form with special syntax or special evaluation rules or both, possibly manipulating the evaluation environment or control flow or both. The first element of a special form is a special operator.
13:59:25
phoe_
I know it's a special operator, it's just that suddenly, out of nowhere, it says Special Form instead of Special Operator.
14:15:15
francogrex
Hi, is anyone experienced with parenscript? https://common-lisp.net/project/parenscript/
14:17:53
francogrex
is there a way to make a verification on which code is correct (runs) and which doesn't and where is the problematic translated code?
14:20:24
smokeink_
i'm not sure but i don't think it translates any lisp code, it only translates the javascriptish code
14:23:58
francogrex
smokeink_: not really it translates any code and it translates it in any way whether the JS function that is translated exists or not
14:26:20
francogrex
contrast parenscript with another translator like Linj (lisp to java)... which never translates a code into rubbish
14:28:48
phoe_
read up on its manual - it cannot translate *all* of Common Lisp, and MAPCAR is a part of CL that Parenscript does not know how to translate.
14:35:46
phoe_
there are more sophisticated javascript testing frameworks built on top of NodeJS that I don't know much about, other than the fact they exist.
14:36:52
francogrex
and how was it again if you want to inject a pure js code into the lisp one before translating with ps
14:49:12
chream
Hello! I find myself using adolist and adotimes a lot. Any reason I have never seen them mentioned?
14:49:55
smokeink_
https://www.reddit.com/r/lisp/comments/pb72i/clactivevariables_variables_with_readwrite/
14:53:28
dlowe
I used to use acond until I realized I could do (let (target) (cond ((null arg) (reply "no arg")) ((null (setf target (resolve-target arg))) (reply "target not found")) (t ... do something with target ...)))
14:53:31
chream
Xach: I agree to some extent, but constantly binding a result var gets frustrating. I would say simple anamorphic macros are ok.
14:53:49
axion
I don't agree with temporary symbols being created that weren't requested to be bound
14:58:45
jackdaniel
chream: it's personal preference. For instance library metabang.bind isn't discussed frequently either
14:59:04
jackdaniel
nor some constructs in alexandria – not much to discuss – people aware of this things just use them or not
15:00:33
phoe_
First preview: http://phoe.tymoon.eu/clus/doku.php?id=clus:todo on the bottom of the page.
15:01:27
dlowe
It's funny, though, with all the customization power of CL at hand, I usually just use stuff in the CL package.
15:02:12
dlowe
I could use all these cool extensions, but then I'd have to learn them, and then I'd have to integrate them into my practice
15:04:10
Xach
Some people create macros that are so core to what they do that their code seems a bit like another language
15:13:11
chream
phoe: https://github.com/rongarret/ergolib. Its short for binding block. replaces let, mvb, db etc. Also does other stuff. I remember one of the first times I tried hacking som lisp library using BB. I could not get anything to work and gave up on lisp for a couple of years.
15:31:44
PuercoPop
On small custimization I like is rlet et all. Moving the local function definitions to the bottom improves readability.