freenode/#lisp - IRC Chatlog
Search
12:14:41
adlai
"risk and stress" ... yep, that sounds like components of the construction Hamiltonian. story checks out!
12:48:12
phoe
I'm running code that's fifteen years old and the only thing that was really required is fixing it to use ASDF.
12:52:05
_death
phoe: check copyright date range @ https://bitbucket.org/dfmorrison/roan/src/e43b5ae8af0aba6930f0183a4afbc7e3e004da1e/roan.lisp?at=master&fileviewer=file-view-default
13:10:18
pjb
phoe: https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html if you can run that, then wordnet!
13:12:10
pjb
smokeink: have a look at https://www.informatimago.com/articles/usenet.html#C-like-pointers-in-Lisp
13:15:19
pjb
smokeink: your code is full of bug, that's why I cannot say anything consistent about it.
13:17:24
smokeink
pjb: ignore f, I first typed that f function to specifically ask whether myvar can access that a in some way or not
13:18:59
smokeink
I just wrote a snippet, I didn't paste my actual code because the actual code has other unnecessary details
13:21:49
phoe
(get-synonyms "horse" :noun) ;=> (("horse" 0) ("horse_cavalry" 1) ("cavalry" 1) ("horse" 0) ("Equus_caballus" 0) ("horse" 3) ("gymnastic_horse" 0) ("sawhorse" 0) ("horse" 1) ("sawbuck" 0) ("buck" 0))
13:22:58
pjb
smokeink: you test for (functionp myvar) and then in the case you test for symbols. Therefore the case will always return nil, if myvar is bound to a function, and the IF will return nil if not.
13:23:38
pjb
smokeink: a compiler can detect that at compilation time, so it can generate (lambda (a b) (declare (ignore a b)) nil) instead.
13:27:09
smokeink
no question for now, I'll first try to see if declaring vars special will work well or not
13:35:31
phoe
But it would be bold for me to assume any license at all if the author put none on it.
13:36:48
phoe
pjb: I did. All I have is the email address @ai.mit.edu which might or might not work after all these years.
13:51:05
phoe
pjb: there's no mailserver at ai.mit.edu. I have no direct means of contacting the author.
13:58:05
pjb
phoe: since it comes from the MIT, it might be under the MIT license. But you'd need confirmation.
14:10:47
oni-on-ion
aeth: check out recent release notes if you havnt already, http://www.sbcl.org/all-news.html , like 1.4.10 adding or subtracting 1 from a fixnum does not cons. =)
14:13:15
pjb
smokeink: I wouldn't worry about that for now. Just build your system, and make it work. If there remain time then, you will be able to have more philosophical questions…
14:13:24
smokeink
Since my code is a bit complicated than this snippet, it might result into many ifs and cases , and that's not very nice. Just wondering if you guys can spot a different solution
14:14:14
phoe
if yes, you might want to instead go CLOS and use a generic function; this will move the dispatch from a massive CASE into individual methods
14:15:05
phoe
(defclass apple ...) (defclass banana ...) (defgeneric frobnicate (fruit)) (defmethod frobnicate ((apple apple)) ...) (defmethod frobnicate ((banana banana)) ...)
14:15:21
pjb
You could have a table of predicate and functions to generate the code, so you'd just write (funcall (optimization-generate (find-if (lambda (predicate) (funcall predicate myvar)) table :key (function optimization-predicate))))
14:16:37
jackdaniel
the question is: what is easier to optimize: a few symbols + typecase or a few classes + gf dispatch
14:18:56
jackdaniel
clos might be but doesn't have to be cleaner. it is easy to do a mixin spaghetti with unobvious method invocation structure
14:18:56
phoe
as for performance, a typecase might be faster if all of your types are classes and therefore type comparison is going to be pointer equality
14:25:16
pjb
smokeink: for example, a given optimization may need to do things or generate expressions at several places, to prepare the optimization or complete it. You may need temp variables, initializations, cleanup, in addition to the code generated at the place of interest. Then you will need several functions (or methods) for a given optimization. This would exclude the typecase solution. (CLOS methods or a table managed by yourself w
14:25:38
pjb
smokeink: but what is "better" depends on whether you have such needs for your optimizations.
14:26:28
oni-on-ion
"what is easier to optimize" seems a clear question to me. CLOS is slower for GF because classes can change in runtime. as opposed to say julia where all code paths are decided before runtime
14:27:43
pjb
oni-on-ion: CLOS can reach the 2 JSR on GF calls. Just like Objective-C. Can julia dispatch in less than 2 JSR?
14:33:38
oni-on-ion
i think often julia does not do any jumps, when the code is called "type stable" the compiler can already know the code path and lay it out before eval (all code is compiled with llvm) with or without declaring inline
14:34:38
oni-on-ion
this feature of clos is exactly why i need lisp right now though (to update code in a live server)
14:55:17
francogrex
but then aside from this chat here, what is the goto forum to post cl related messages? don't tell me it's stackoverflow now!
15:12:18
francogrex
I wonder how come almost all implementations still fail a good chunck of the ansi-tests? does that mean those tests are bollocks?
15:32:00
loke
pjb & Bike: Oddly enough, wj doesn't seem to have posted his usual garbage for over a week?
15:36:18
loke
shka_: I'm checkin gon Google Reader, which to my knowledge doesn't filter spam at all.
16:05:44
francogrex
in sbcl when you disassemble you get the mem address of the function in the output. in ccl it's not output but does anyone recall how to get the memory address otherwise?
16:28:19
drmeister
All the most popular ones. I'm building a web based scientific programming environment and I'd like to be able to transcribe equations without converting them into s-expressions.
16:29:05
drmeister
I recall looking into this a year ago and I thought I was working with a different library.
16:29:22
phoe
if someone inputs "2 + 2" you could (eval (cons $ (read-from-string (concatenate 'string "(" "2 + 2" ")"))))
16:30:52
phoe
I wonder if $ errors on unknown operators; if yes, then it would solve a part of input sanitization problem
16:33:40
oni-on-ion
https://stackoverflow.com/questions/25434538/define-function-for-evaluating-infix-expressions-in-lisp ~
16:37:59
_death
I thought lobste.rs might be interesting because it exposes a mailing list format, which can then be fed to gmane and read using gnus.. but I've no lobste.rs account
16:39:50
_death
but now I remember that gmane is part dead.. at least gwene is OK.. and then there's that gnusdumps thing I wrote back then
16:49:10
shrdlu68
Good evening, fellow Eukaryota. In http://www.sbcl.org/manual/#Hash-Table-Extensions, in the explanation for :weakness, what does "live" mean?
16:50:08
phoe
if this value is pointed to only by weak pointers, then it's not live and may be collected at any time.
17:05:24
drmeister
On a different topic: I swear, every time we (:use ...) anything other than :common-lisp in a defpackage - I've committed to spending time in the future ripping it out and dealing with explicitly adding the package name in front of symbols.
17:26:04
pjb
And while you keep optimizing your access time into O(1) slow gethash accesses, ccl readtable uses an a-list for reader macros…
17:26:49
phoe
pjb: I know it doesn't matter, it's just that I had to `clhs get` to remember what that part of CL does
18:19:10
aeth
oni-on-ion: but there are lots of things that you would expect from an optimizing compiler in 2018 that SBCL does not yet (afaik) do, like when looping over short arrays of known length (e.g. 3), it doesn't loop unroll afaik even with (speed 3) (space 0).
18:20:40
oni-on-ion
ive been impressed so far with julia's compiler , helped with its type system for knowing dispatch paths at compile time
18:21:52
aeth
oni-on-ion: SBCL was really advanced, it's just that it has to keep up with the competition
18:25:14
oni-on-ion
ghc is advanced, ocaml is advanced, and gcc is advanced, erlang is advanced... those are single implementations though
18:25:49
oni-on-ion
julia as well. doesnt sbcl have limits of what it can do, considering how many kinds of lisp there could be ?
18:27:30
aeth
oni-on-ion: If SBCL is 3x slower than C/C++ on some benchmarks then that means there's still room for improvements.
18:28:21
oni-on-ion
Bike: variations on lisp forms. for eg more strict syntax compilers have certain assumptions they can make
18:29:39
oni-on-ion
say, being able to do (let ((..)) (defun ...)) and other acrobatics, i am thinking the compiler can find less opportunities for optimisation
18:30:14
aeth
There might be a limit to CL because of its GC because different advanced GCs probably have different tradeoffs in what they can do.
18:31:03
oni-on-ion
Bike: types being i guess semantics. which are helpful hints if not guarantees for a compiler to make
18:31:38
aeth
oni-on-ion: Personally I think well-written SBCL is where C would be if C and C++ compilers didn't turn into incredibly ridiculous optimizations in recent years. That actually would be easy to test, though. Write the same thing in SBCL and in C with optimizations off (or perhaps a smaller, more minimal C compiler)
18:32:41
oni-on-ion
Bike: i guess an analogy: if i knew my way to the store, i can take shortcuts easily. if i dont know where i am going, this is a different story
18:33:04
aeth
oni-on-ion: It's a bit of a lie to say that SBCL is as fast as Foo, though, because if you look at the SBCL that is benchmarked well, it has type declarations all over the place and is essentially statically typed in addition to dynamically typed.
18:33:45
oni-on-ion
aeth: yeah.. however i like the idea that one can write/prototype quickly , then amend and freeze in the types afterward
18:35:36
aeth
oni-on-ion: That would be great. I'd say the main weakness is that the "frozen" types are generally just lexical variables from things like a LET or a DEFUN, and not in data structures, though. The main exceptions are certain specialized array types and (possibly) slots with :type in defstruct since (iirc) slot accessors can be inlined because redefining a struct is undefined behavior.
18:36:24
aeth
Being able to notice a type that you're using for all of the contents (or keys!) for a hash table and make them specialized like an array would be nice.
18:37:05
p_l
aeth: ehhhh, it shows that something can be fast, and partially shows the amount of work needed
18:44:15
pjb
So a CL implementation would better integrate better with cuda, than optimize lisp code…
18:45:06
p_l
Depends on the goal, but one could do some "little language" that compiled to PTX assembly, yes
18:45:15
aeth
p_l: If you're replying to the 3x slower means there's room for improvements, then yes, it is a lot of work, but there's afaik diminishing returns each time so even if C/C++ compilers (lumped together because they're usually the same compiler afaik) have the same rate of effort spent on them each year, they shouldn't really pull away from CL in performance, and CL might actually get closer over time.
18:46:10
p_l
(Also, CUDA simply does not work in performant way once your work stops being nicely SIMD-able)
18:46:36
aeth
pjb: There should be more Lispy DSLs that target SPIR-V for Vulkan/OpenCL. (Forget CUDA, that's just nvidia. AMD and Intel need to step up and help promote the open standards more so nvidia is forced to follow them.)
18:46:56
pjb
And let's remember that this race to speed in C and its underlying processors, is what leads to the Meltdown bug et al.
18:47:54
pjb
Getting correct results, and getting them safely, should be the only concern that should matter.
18:48:57
aeth
pjb: I'd say Meltdown/Spectre makes optimizing compilers like SBCL *more* important because the "free" hardware speedups can't be relied on if the price is security.
18:50:14
Bike
what i'm wondering about is, foreign-alloc has a compiler macro that works if the type is constant and the count is constant or not provided and nothing else is provided
18:50:43
Bike
hypothetically, if both are constant and :initial-contents is provided, it could still skip a runtime foreign-type-size and fill up the thing in a loop (maybe with a memcpy kind of function)
18:51:17
Bike
i thought i remembered someone complaining about this before, but it's not on the tracker that i can see
18:53:44
p_l
pjb: Meltdown had, IMO, more in common with Intel internal management practices than with optimising for C
18:54:07
aeth
I think the 2020s is the decade when we have to rely on software to get the continuous performance improvements that we all expect in computing. I wouldn't be surprised if single-threaded hardware gets only 3x or 4x faster in 2030 vs. 2020.
18:54:28
pjb
If they weren't racing for speed, but for safetly, they'd implement a lisp machine processor.
18:56:38
p_l
pjb: it got lost in the deluge of claims about C being responsible, but it was cost-cutting at Intel that led (at least partially) to current state
18:57:44
p_l
I'd argue that part of why CL can get significant optimisation gains (and Java already does) is that it isn't hobbled by C's "emulate PDP-11" model which is only made performant by putting a shitton of undefined behaviour
18:57:50
aeth
p_l: Can you blame them for cost cutting if each process node is exponentially more expensive? 7 nm will only have a handful of companies. I wonder if by 5 nm we'll have one or two.
18:59:05
p_l
and from time to time there were voices about letting the cpus return erroneous values for speed
18:59:25
p_l
aeth: there's even a lisp story in all of that, though I do not know if AMD still uses ACL2
18:59:47
aeth
p_l: On the other hand, CL does have a lot of mutability, including mutable dynamic global variables! So it has its own performance challenges.
19:06:53
p_l
(especially when you deal with things like the new 4-die threadrippers, which have significant differences between NUMA zones)
19:08:54
aeth
ah, okay. There's quite a name conflict with that acronym. https://en.wikipedia.org/wiki/CSP#Computing
19:28:42
Timzi
what does the #| |# notation mean in CL? Seems like it runs shell code, but I'm having issues searching for docs
19:32:36
aeth
It's uncommon because usually people use their tools to comment out multiple lines, e.g. M-x comment-region in emacs. And that uses the more common ;; line comment.
19:33:09
Timzi
so when it has bash commands inside that's just the shell reading through and executing what it finds?
19:35:21
aeth
#| is seen as a line comment to bash and a block comment to CL, so bash skips that line and CL skips until |#
19:47:41
pjb
Timzi: and more on-topic: https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/intersection-r5rs-common-lisp-emacs-lisp/index.html
19:51:39
Timzi
the lisp one is neat too, might be worth switching to clisp just for the command line launcher lol
20:27:25
jmercouris
let's say I have a list of 12 elements, how can I iterate through it 4 elements at a time?
20:31:13
jmercouris
it just seems convoluted, I would look at the code later and wonder, why is it jumping by 4 cons cells??
20:31:47
trittweiler
jmercouris, I usually use (let ((the-list ...)) (loop while the-list for a = (pop the-list) for b = (pop the list) ... ) you can play with the exit condition depending how you want to deal with a list of length that is not a multiple of 4
20:32:31
Bike
(loop for (a b c d) on '(1 2 3 4 3 3 3 3 1 2 1 2) by #'cddddr collect (+ a b c d)) => (10 12 6), is that not what you want?
20:36:42
pjb
(loop for 4elems in (com.informatimago.common-lisp.cesarum.sequence:group-by (iota 22) 4) collect 4elems) #| --> ((0 1 2 3) (4 5 6 7) (8 9 10 11) (12 13 14 15) (16 17 18 19) (20 21)) |#
20:40:43
pjb
_death: probably you will do something else than collect; Here collect is to show what's bound to 4elems.
20:55:23
makomo
is it possible to use slime's in-place expansion features to expand local macros such as macrolets?
21:00:21
phoe
with cursor on the last "foo" I get the correct expansion, (macrolet ((foo (x) `(+ 2 ,x))) (+ 2 2))
21:07:35
makomo
hmm, i'll have to check out all of the different macroexpansion functions slime provides
21:33:49
trittweiler
jmercouris, See pop-n at https://pastebin.com/PQHv4YJU - this will destructively modify the input and not cons
21:38:02
trittweiler
it goes through the list twice, though. Should store (nthcdr (1- ,num) ,old-head) in a variable tmp, then bind ,new-head to (cdr ,tmp) and change the setf down there to (setf (cdr ,tmp) nil)
21:41:15
makomo
this library i found today has some cool ones if you want to take a look and have some fun: https://www.hexstreamsoft.com/libraries/place-utils
21:43:24
makomo
phoe: seems like "macrostep" is the package i'm looking for (and the SLIME contrib which uses it, called slime-macrostep)
21:43:49
makomo
slime can do it by itself, but only if you use one of the *-all variants and by placing your point on the whole macrolet form
22:33:39
it3ration
I don't spose there are current bindings to vulcan / osx metal / et al for Common Lisp
22:42:34
aeth
it3ration: You probably don't want to use Metal. Just use a Foo->Metal wrapper like https://moltengl.com/moltenvk/
22:43:12
aeth
it3ration: As far as Vulkan goes, there's https://github.com/3b/cl-vulkan/ but it's incomplete because most people just use OpenGL via https://github.com/3b/cl-opengl/
22:43:31
aeth
For Vulkan's added performance to matter and be worth it (in exchange for added complexity) you need a very large application.
22:43:33
makomo
AeroNotix: WITH-RESOLVED-PLACES is also pretty cool, because it's basically ONCE-ONLY but for places -- it solves the multiple evaluation problem for subforms of a place
22:45:55
makomo
check out the example: https://www.hexstreamsoft.com/libraries/place-utils/#with-resolved-places
22:46:40
Bike
j`ey: usually we write loops so that continue isn't necessary- move conditions out, that kind of thing
23:09:53
AeroNotix
makomo: so glad I found this library! There are a few macros I wanted to write myself but couldn't be bothered ;)
23:23:19
phoe
this evening I have a functioning Qtools interface to its modernized and bugfixed version