<makomo>
an unrelated but interesting thing is that, theoretically, getting a place's value could yield different results depending on how you get the value: (1) by treating the place as a form or (2) by using code generated by get-setf-expansion
kozy has joined #lisp
<makomo>
because (2) might arrange a different order of evaluation that what you would get from (1) by relying on normal left-to-right rules
<makomo>
are there any places which you *can't* treat as forms even?
malpas has joined #lisp
<makomo>
and if not, are there any for which (1) and (2) don't produce the same results?
<makomo>
s/that/than/
<pjb>
You mean things that you can put as first argument of setf, but couldn't be used to get an object? Kind of write-only forms?
<makomo>
yes, i suppose so
<pjb>
I guess you can do it easily with (defun (setf foo) (new-value where) …) without a defun foo.
<makomo>
yeah, true, but i was aiming for the standardized ones
<pjb>
IIRC, I've done that a couple of times, for write-only slots of some CLOS instances.
<pjb>
Not very often.
aleamb has quit [Ping timeout: 250 seconds]
<pjb>
AFAICR, not for the standardized ones.
<makomo>
mhm
lumm has quit [Quit: lumm]
<pjb>
There's very few write-only stuff in CL. IIRC, there must be one or two, but not with accessors.
<pjb>
There's the character syntax, that cannot be read IIRC, only copied.
Fare has joined #lisp
groovy2shoes has joined #lisp
malpas has quit [Quit: Leaving]
stacksmith has joined #lisp
siraben has joined #lisp
Fare has quit [Ping timeout: 240 seconds]
Fare has joined #lisp
dented42 has joined #lisp
<aeth>
does loop support a loop in a loop?
<aeth>
or should a nested loop/mapcar/etc. be used inside of a loop?
<aeth>
This loop is better in one big loop than in five different ones
<aeth>
It still has a nested mapcar, though.
<pjb>
(loop for i in (loop repeat 4 collect 42) for j from 0 collect (loop for k below j collect (list i k))) #| --> (nil ((42 0)) ((42 0) (42 1)) ((42 0) (42 1) (42 2))) |#
<pjb>
aeth: a function must do a single thing. Unless you're looping over a multidimensional array, there should be as single loop per function.
<pjb>
aeth: in lisp there are no statements. Therefore you can combine expressions at will!
<aeth>
pjb: it is one loop, looping over one list
<aeth>
It just makes 5 things from that list and places them in various parts of a macro
<makomo>
pjb: true :-)
Fare has quit [Ping timeout: 252 seconds]
<pjb>
Notice that if you change it into 5 different loops, it still remains O(n).
<pjb>
In case you'd be worried by the readability.
<aeth>
pjb: yes, but the five different loops (only two were actually LOOPs) were harder to follow because there were a bunch of things I combined when I combined them
<pjb>
sure.
<aeth>
e.g. now I collect a gensym that's generated each iteration into a list of gensyms, instead of generating that list of gensyms and using it both in the loops and in the macro, which then requires MAPCARing over two lists, which is more complicated than over one
<pjb>
You can write directly :for (table . accesors) :in tables-and-accessors.
<aeth>
it works with :in? ok
<aeth>
And, yes, I use ? here instead of -p because it's a query mini-language (as the name suggests)
<aeth>
it queries a big, complicated data structure and symbol-macrolets away the implementation details to the variables you provide
<AeroNotix>
prefer ? personally
<pjb>
aeth: try to split it out in 5 loops. I'm sure you'll like the result.
<aeth>
pjb: I had it in 5 separate loops (well two were LOOPs and two were MAPCAR and one was REDUCE) and I couldn't read it
<aeth>
I could possibly spin out the boolean-set number generation into its own function because it isn't heavily tied to the rest.
<pjb>
(,changed?-array (changed? ,ecs)) is probably a bug: you're not using the aprameter.
<aeth>
pjb: I stored it in a slot in ECS accessed via changed?
<aeth>
I probably could call it changed-bits or something
<aeth>
too much changed?
<aeth>
then I can rename %changed? to changed? without being too confusing
<aeth>
(I made it %changed? to make it clear that it shouldn't be used directly anywhere)
<aeth>
Essentially this is a dirty bit for the renderer, but I don't like calling it dirty
<aeth>
Any mutation that changes the visuals of the engine must make changed? T and if you need to access the value of changed (but not set it!) you use LET-CHANGED? to get the result of `(= 1 ,%changed?)
<aeth>
pjb: that's very similar to what I had before
<pjb>
of course.
<aeth>
I think the big loop is more readable if I can replace the append, with the possible exception of the boolean-set part, which I could just spin off into a function and put at the top of the loop in another :with
<aeth>
s/replace the append/replace the complicated append/
<pjb>
But it may (reload it I missed the bindings function) be easier to read, since the naming of the important data is clearer in the let* form, and we can abstract away parts such as the bindings function (we could do the same for array-bindings and boolean-set); those functions could be reusable, etc.
<aeth>
pjb: Well, in one intermediate step I had the loop return multiple values into a multiple-value-bind. It seemed kind of pointless, *but* if I moved the loop into a separate function, it could be cleaner
<pjb>
The thing is that by writing separate loops, you can extract the computing of each list in a separate function.
<pjb>
And since it remains O(n), it's ok, moreso at macroexpansion time.
Fare has joined #lisp
<pjb>
ok, now, magic stick! I need all my past lisppaste pastebin etc, moved into snippets.
<pjb>
Actually, I've got a backup of lisppaste with almost all of them. And scanning the irc logs, I could recover almost all the other urls…
<SaganMan>
beach: It's in Bangalore which is IT hub in India.
caltelt_ has joined #lisp
<beach>
I see, yes.
<no-defun-allowed>
hi beach
<beach>
Hey no-defun-allowed.
<SaganMan>
beach: We don't usually do projects on that grand scale. That is the biggest investment in mine and my father's life. It looks impressive but it's great risk and stress.
<beach>
I can imagine.
rocx has quit [Remote host closed the connection]
<no-defun-allowed>
i think i could generalise the cl-vep image generator a bit
bradcomp has quit [Ping timeout: 240 seconds]
it3ration has joined #lisp
it3ration has quit [Ping timeout: 252 seconds]
vlatkoB has joined #lisp
caltelt_ has quit [Ping timeout: 252 seconds]
dented42 has joined #lisp
<phoe>
Hey hi
<beach>
Hello phoe.
<no-defun-allowed>
well my ffmpeg interface is still shitslow at 4fps but the videos aren't broken now
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
CrazyEddy has quit [Ping timeout: 268 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dented42 has joined #lisp
elfmacs has joined #lisp
CrazyEddy has joined #lisp
zaquest has quit [Remote host closed the connection]
Fare has quit [Ping timeout: 245 seconds]
doubledup has joined #lisp
doubledup has quit [Max SendQ exceeded]
doubledup has joined #lisp
razzy has quit [Ping timeout: 240 seconds]
flazh has quit [Ping timeout: 240 seconds]
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
orivej has joined #lisp
razzy has joined #lisp
it3ration has joined #lisp
it3ration has quit [Ping timeout: 246 seconds]
cage_ has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
libre-man has quit [Ping timeout: 240 seconds]
asarch has quit [Ping timeout: 252 seconds]
libre-man has joined #lisp
light2yellow has joined #lisp
astalla has joined #lisp
runejuhl has joined #lisp
flazh has joined #lisp
jinkies has quit [Remote host closed the connection]
igemnace has quit [Quit: WeeChat 2.2]
SlashLife has quit [Ping timeout: 252 seconds]
SlashLife has joined #lisp
varjag has joined #lisp
lavaflow has quit [Ping timeout: 245 seconds]
steiner has quit [Read error: Connection reset by peer]
fikka has joined #lisp
moei has quit [Quit: Leaving...]
it3ration has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
stardiviner has quit [Ping timeout: 250 seconds]
it3ration has quit [Ping timeout: 240 seconds]
random-nick has joined #lisp
fikka has joined #lisp
SaganMan has quit [Ping timeout: 240 seconds]
fikka has quit [Ping timeout: 240 seconds]
elfmacs has quit [Ping timeout: 240 seconds]
razzy has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
razzy has joined #lisp
[X-Scale] has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
X-Scale has quit [Ping timeout: 252 seconds]
[X-Scale] is now known as X-Scale
azimut has quit [Ping timeout: 245 seconds]
fikka has joined #lisp
azimut has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
moei has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
steiner has joined #lisp
fikka has joined #lisp
makomo has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
fikka has joined #lisp
elfmacs has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
_whitelogger has joined #lisp
dddddd has joined #lisp
steiner has quit [Remote host closed the connection]
<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.
<pjb>
smokeink: a compiler can detect that at compilation time, so it can generate (lambda (a b) (declare (ignore a b)) nil) instead.
<smokeink>
ahh , I had a funcall there, forgot to type it
<phoe>
Oh boy, not only I'm doing programming, I'm also doing archaeology
nika has joined #lisp
<pjb>
lisp is fun.
<phoe>
Definitely is
flazh has quit [Ping timeout: 240 seconds]
Lycurgus has quit [Quit: Exeunt]
<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. =)
<pjb>
smokeink: have a look at the sources of the sbcl or sicl compilers?
<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…
<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
<phoe>
smokeink: you're basically doing a big typecase, aren't you?
FreeBirdLjj has quit [Remote host closed the connection]
<pjb>
smokeink: the alternative to code, is data.
trocado has joined #lisp
<smokeink>
perhaps a big typecase will do
<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
<phoe>
you could define a single GF and dispatch based on classes
<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))))
<pjb>
or use CLOS as phoe indicates.
<phoe>
CLOS already has the kind of dispatch you seem to want
<jackdaniel>
the question is: what is easier to optimize: a few symbols + typecase or a few classes + gf dispatch
<jackdaniel>
by a compiler
<jackdaniel>
as of constant values, you may consider compiler macros for functions
<phoe>
CLOS might be much cleaner code-wise if you have multiple typecases
<pjb>
See, you need to define "better". And this depends a lot on your program.
<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
<jackdaniel>
clos might be but doesn't have to be cleaner. it is easy to do a mixin spaghetti with unobvious method invocation structure
<phoe>
jackdaniel: yep, I was thinking about the simple case
fikka has joined #lisp
SaganMan has joined #lisp
francogrex has joined #lisp
<oni-on-ion>
also structs work with gf
<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
<pjb>
do)>
<pjb>
smokeink: but what is "better" depends on whether you have such needs for your optimizations.
<pjb>
oni-on-ion: all lisp objects work with gf.
fikka has quit [Ping timeout: 245 seconds]
<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
<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?
<oni-on-ion>
oh its faster than objective-c definately
<phoe>
pjb: what's JSR?
aindilis has quit [Ping timeout: 246 seconds]
<pjb>
jump to sub routine.
<pjb>
the assembler equivalent of funcall.
fikka has joined #lisp
rippa has joined #lisp
orivej has quit [Ping timeout: 245 seconds]
<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
<oni-on-ion>
this feature of clos is exactly why i need lisp right now though (to update code in a live server)
flazh has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
FreeBirdLjj has joined #lisp
fikka has joined #lisp
Shinmera has quit [Remote host closed the connection]
<francogrex>
20 percent of the code has 80 percent of the errors?
<francogrex>
still doesn't explain why and why it's not fixable
fikka has joined #lisp
steiner has joined #lisp
fikka has quit [Ping timeout: 244 seconds]
<loke>
pjb & Bike: Oddly enough, wj doesn't seem to have posted his usual garbage for over a week?
<loke>
Perhaps he's charging up for another onslaught?
<Bike>
a /week/? last time i looked at that place was like two years ago
<Bike>
god damn
<loke>
To most recent message from him that I can see was from 14'th July
<loke>
so it's a month and a half
<loke>
I don't think he's been off for that long... ever?
<loke>
did he fianlly get bored?
<shka_>
loke: no
<shka_>
spam is still on
<loke>
shka_: I'm checkin gon Google Reader, which to my knowledge doesn't filter spam at all.
<loke>
i mean groups
<shka_>
but #lisp is for just registered people now
<shka_>
loke: i got spam at #clnoobs last week
steiner has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #lisp
light2yellow has quit [Quit: brb]
<jinkies>
pjb: what is cll?
fikka has joined #lisp
<beach>
comp.lang.lisp
<beach>
A Usenet news group.
fikka has quit [Ping timeout: 245 seconds]
it3ration has joined #lisp
fikka has joined #lisp
fikka has quit [Read error: Connection reset by peer]
it3ration has quit [Ping timeout: 240 seconds]
steiner has joined #lisp
makomo has quit [Quit: WeeChat 2.2]
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
kajo has quit [Ping timeout: 240 seconds]
<phoe>
francogrex: #lisp on IRC, Lisp Discord server and /r/common_lisp first and foremost
<phoe>
also a little bit of stackoverflow
<phoe>
and a little bit of cll (if you're willing to moderate it yourself).
fikka has joined #lisp
azimut has joined #lisp
<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?
fikka has quit [Ping timeout: 240 seconds]
azimut has quit [Ping timeout: 245 seconds]
steiner has quit [Remote host closed the connection]
shka_ has quit [Ping timeout: 252 seconds]
<francogrex>
it's ok. in most cases i suppose (inspect 'function-name) can do just that
<phoe>
francogrex: why do you need the address at all?
wigust has joined #lisp
<francogrex>
examing the assembly instructions of a function by attaching to gdb (yeah)
<francogrex>
but it's ok
fikka has joined #lisp
francogrex has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
steiner has joined #lisp
<drmeister>
What's the best infix math library for Common Lisp?
<phoe>
drmeister: what operators do you want to have in there?
<phoe>
+-:/% and what else?
<drmeister>
I want infix arithmetic in Common Lisp without tears.
<phoe>
drmeister: yes, but what exactly do you mean by "infix arithmetic"?
<phoe>
Which operators?
<phoe>
ruricolist's library is generic and should work decently
<phoe>
oh, it does have a list of operators it recognizes in the README
<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.
light2yellow has joined #lisp
<drmeister>
Optionally - mind you. I'm not taking anything away.
fikka has quit [Ping timeout: 240 seconds]
<phoe>
You could use that library, I think
<drmeister>
I recall looking into this a year ago and I thought I was working with a different library.
<phoe>
if someone inputs "2 + 2" you could (eval (cons $ (read-from-string (concatenate 'string "(" "2 + 2" ")"))))
<pjb>
as soon as they make a gnus plugin for discod and stackoverflow..
<drmeister>
Ok - thank you - I'll work from those.
<_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
fikka has quit [Ping timeout: 240 seconds]
<drmeister>
Now that I've got things like this working...
<phoe>
shrdlu68: something else that's not a weak pointer must have a reference to it.
<phoe>
"otherwise accessible" is kind of that term
<phoe>
if this value is pointed to only by weak pointers, then it's not live and may be collected at any time.
<drmeister>
A live object is in memory and has not been garbage collected.
<shrdlu68>
I see, thanks!
<phoe>
drmeister: that word is used in a slightly different context here
<beach>
drmeister: No, that's not how it is typically used.
<drmeister>
Which word?
<phoe>
we're thinking weak hash tables, in which values may be garbage collected
<phoe>
"live"
<beach>
drmeister: A live object is one that is reachable from the roots.
<drmeister>
This is why I don't tend to answer questions. (sigh)
<beach>
drmeister: ... whether it has been collected or not.
<drmeister>
Ok.
<drmeister>
At least I learned something.
* drmeister
returns to muddling through with his own flawed perspective of the world.
fikka has joined #lisp
kajo has joined #lisp
<pjb>
Weak references can reference not only live objects, but also zombies.
<drmeister>
Sorry - that all sounded a bit defensive - I appreciate the feedback very much.
<pjb>
weak references are not life-insuffling references.
<phoe>
drmeister: I understand how it is - no problem
<pjb>
weak-references are live-or-dead warrants :-)
azimut has quit [Ping timeout: 240 seconds]
fikka has quit [Ping timeout: 245 seconds]
steiner has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
fikka has joined #lisp
<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.
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
<_death>
yes, only :use :cl and packages controlled by yourself.. otherwise, :import-from
FreeBirdLjj has quit [Remote host closed the connection]
<shka_>
i simply have dedicated package in each project just to import and reexport ;-)
fikka has quit [Ping timeout: 252 seconds]
<pjb>
or let's use package versions in the package names…
<pjb>
phoe: notice that since CL has packages, it just does not matter at all!
<pjb>
And while you keep optimizing your access time into O(1) slow gethash accesses, ccl readtable uses an a-list for reader macros…
pierpal has quit [Client Quit]
<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
pierpal has joined #lisp
sz0 has quit [Quit: Connection closed for inactivity]
rozenglass has quit [Read error: Connection reset by peer]
azimut has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
light2yellow has joined #lisp
astalla has joined #lisp
fikka has joined #lisp
kuwze has joined #lisp
nowolfer has quit [Quit: leaving]
fikka has quit [Ping timeout: 245 seconds]
Denommus has joined #lisp
light2yellow has quit [Quit: light2yellow]
fikka has joined #lisp
nika has quit [Quit: Leaving...]
fikka has quit [Ping timeout: 244 seconds]
it3ration has joined #lisp
fikka has joined #lisp
it3ration has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
Oladon has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
azimut has quit [Read error: No route to host]
cage_ has quit [Quit: Leaving]
azimut has joined #lisp
fikka has joined #lisp
<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).
lumm has joined #lisp
<oni-on-ion>
whoa
<oni-on-ion>
ive heard that sbcl was really advanced
<oni-on-ion>
ive been impressed so far with julia's compiler , helped with its type system for knowing dispatch paths at compile time
fikka has quit [Ping timeout: 244 seconds]
<aeth>
oni-on-ion: SBCL was really advanced, it's just that it has to keep up with the competition
<oni-on-ion>
why does it have to keep up?
<oni-on-ion>
ghc is advanced, ocaml is advanced, and gcc is advanced, erlang is advanced... those are single implementations though
<oni-on-ion>
julia as well. doesnt sbcl have limits of what it can do, considering how many kinds of lisp there could be ?
<Bike>
fundamental limits on compilers are due to basic CS theory
<Bike>
i don't know what "how many kinds of lisp there could be" is supposed to mean
<aeth>
oni-on-ion: If SBCL is 3x slower than C/C++ on some benchmarks then that means there's still room for improvements.
<oni-on-ion>
Bike: variations on lisp forms. for eg more strict syntax compilers have certain assumptions they can make
<Bike>
syntax is not relevant to most of the interesting parts of a compiler
<oni-on-ion>
say, being able to do (let ((..)) (defun ...)) and other acrobatics, i am thinking the compiler can find less opportunities for optimisation
<Bike>
closures make things hard, yes. that's semantics, not syntax.
<oni-on-ion>
whereas say haskell and julia compilers can make assumptions based on types
<oni-on-ion>
ah hmm
<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.
<Bike>
types are not directly related
<oni-on-ion>
i thought sbcl was in the same "order of magnitide" as c, aeth
<oni-on-ion>
Bike: types being i guess semantics. which are helpful hints if not guarantees for a compiler to make
<Bike>
what a "type" is means different things in different languages.
<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)
<oni-on-ion>
yes. yeah, not sure why that needs clarification
<aeth>
s/turn into/turn to/
<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
<oni-on-ion>
aeth: hmm.
<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.
<aeth>
It's probably not the CL style most people are writing.
<oni-on-ion>
aeth: yeah.. however i like the idea that one can write/prototype quickly , then amend and freeze in the types afterward
<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.
<oni-on-ion>
ahh, true hmm.
<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.
fikka has joined #lisp
<p_l>
aeth: ehhhh, it shows that something can be fast, and partially shows the amount of work needed
azimut has quit [Ping timeout: 246 seconds]
azimut has joined #lisp
fikka has quit [Ping timeout: 244 seconds]
<Bike>
anyone know where the cffi issues tracker is? i don't see it on github
<pjb>
It's rather silly. Nowadays, when I want fast, I go cuda.
<pjb>
So a CL implementation would better integrate better with cuda, than optimize lisp code…
Jesin has joined #lisp
<p_l>
Depends on the goal, but one could do some "little language" that compiled to PTX assembly, yes
<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.
<p_l>
Just like GCC does in recent versions
<p_l>
(Also, CUDA simply does not work in performant way once your work stops being nicely SIMD-able)
<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.)
<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.
<pjb>
Getting correct results, and getting them safely, should be the only concern that should matter.
<PuercoPop>
At least that is where their website points to
azimut has quit [Ping timeout: 245 seconds]
<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.
<pjb>
In a way…
<Bike>
yeah i'll just buy a machine with no branch predictor
<pjb>
Good luck!
<Bike>
this tracker has messages as of this summer, guess that's good enough
<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
<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)
<Bike>
i thought i remembered someone complaining about this before, but it's not on the tracker that i can see
azimut has joined #lisp
<p_l>
pjb: Meltdown had, IMO, more in common with Intel internal management practices than with optimising for C
<pjb>
It's the speed to race.
<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.
<pjb>
The race to speed I mean.
<pjb>
If they weren't racing for speed, but for safetly, they'd implement a lisp machine processor.
<pjb>
Capabilities in the hardware.
SenasOzys has quit [Ping timeout: 272 seconds]
<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
fikka has joined #lisp
<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
<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.
<stacksmith>
And general problem of corporate goals vs doing things right...
<p_l>
undefined behaviour whose "typical" behaviours are actually depended on by people
Xof has joined #lisp
makomo has joined #lisp
<p_l>
aeth: the cost-cutting happened when they were racing to reverse the NetBurst issue
jinkies has quit [Ping timeout: 245 seconds]
<p_l>
and from time to time there were voices about letting the cpus return erroneous values for speed
<p_l>
aeth: there's even a lisp story in all of that, though I do not know if AMD still uses ACL2
<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.
shrdlu68 has left #lisp ["WeeChat 2.0.1"]
<aeth>
(in the multicore world, I mean)
<aeth>
I think the usual solution is that you can't actually rely on *foo* between threads
jmercouris has quit [Ping timeout: 240 seconds]
fikka has quit [Ping timeout: 272 seconds]
SenasOzys has joined #lisp
<p_l>
aeth: but it doesn't really stop you if you work on CSP-style programs
<p_l>
which have significant benefits in NUMA world
<p_l>
(especially when you deal with things like the new 4-die threadrippers, which have significant differences between NUMA zones)
<aeth>
CSP?
<p_l>
some of the issues on them most people haven't seen since Marvel platform Alphas
vlatkoB has quit [Remote host closed the connection]
azimut has quit [Ping timeout: 272 seconds]
existential1 has joined #lisp
azimut has joined #lisp
H4ns has joined #lisp
fikka has joined #lisp
doubledup has quit [Remote host closed the connection]
fikka has quit [Ping timeout: 245 seconds]
orivej has joined #lisp
Timzi has joined #lisp
random-nick has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
<Timzi>
what does the #| |# notation mean in CL? Seems like it runs shell code, but I'm having issues searching for docs
<oni-on-ion>
multiline comment
<p_l>
Timzi: block comment, like /* */ in C
<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.
<Timzi>
so when it has bash commands inside that's just the shell reading through and executing what it finds?
regreg has quit [Read error: Connection reset by peer]
azimut has quit [Ping timeout: 240 seconds]
<Timzi>
pjb: very interesting, a four language program exploiting just the grammars
<Timzi>
the lisp one is neat too, might be worth switching to clisp just for the command line launcher lol
it3ration has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
random-nick has joined #lisp
light2yellow has joined #lisp
it3ration has quit [Ping timeout: 272 seconds]
makomo has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
orivej has quit [Ping timeout: 240 seconds]
light2yellow has quit [Quit: light2yellow]
fikka has joined #lisp
makomo has joined #lisp
shka_ has quit [Ping timeout: 252 seconds]
fikka has quit [Ping timeout: 250 seconds]
pierpal has joined #lisp
fikka has joined #lisp
existential1 has quit [Quit: Leaving.]
azimut has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
jmercouris has joined #lisp
<jmercouris>
let's say I have a list of 12 elements, how can I iterate through it 4 elements at a time?
<jmercouris>
ideally using loop macro, and not iterate
<oni-on-ion>
loop by
<oni-on-ion>
i dont have a mouse so i cannot search more detail, but there is a :by
<jmercouris>
I could use subseq of course..
<phoe>
(loop for (a b c d) on list by #'cddddr ...)
<jmercouris>
oni-on-ion: doesn't :by just change the interval?
fikka has joined #lisp
azimut has quit [Read error: No route to host]
<oni-on-ion>
oops, one sec
<Bike>
for list iteration, it changes how you iterate.
azimut has joined #lisp
<oni-on-ion>
just use loop in a macro for the 4 times. =P
<jmercouris>
lol
<oni-on-ion>
(loop ... `(loop ..))
<jmercouris>
also I don't like the cdddr solution
<jmercouris>
though that does work
light2yellow has joined #lisp
<Bike>
what about it do you not like
<jmercouris>
it just seems convoluted, I would look at the code later and wonder, why is it jumping by 4 cons cells??
<jmercouris>
like, it isn't clear what the purpose is
<Bike>
because you want four elements at a time?
<jmercouris>
and I would still within the body need to traverse those four elements
<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
<Bike>
er, what?
<jmercouris>
maybe I'm best off making a few cons' and making a list of lists
<Bike>
no, no, what are you even talking about
<pjb>
jmercouris: (loop for (a b c d) on list by (lambda (list) (nthcdr 4 list)))
light2yellow has quit [Client Quit]
<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?
<jmercouris>
that is not what I want
<Bike>
Oh. What do you want?
<pjb>
jmercouris: for complex walks, you might want to (coerce list 'vector)…
<jmercouris>
Instead of (a b c d), I'd like a symbol pointing to a list of length 4
<pjb>
for list-of-four instead of for (a b c d)
<jmercouris>
of course I could within the body do (list a c d)
<Bike>
oh, you'll have to allocate new sublists then.
fikka has quit [Ping timeout: 252 seconds]
<Bike>
so maybe list of lists would be better.
<pjb>
jmercouris: the key word here is :ON.
<jmercouris>
:ON?
aindilis has joined #lisp
<pjb>
(loop for 4-elems ON list by #'cddddr ...)
<jmercouris>
ah
<pjb>
Oh, it's true that it gives all the rest.
<pjb>
so you'd have to (subseq 4-elems 0 4)…
<jmercouris>
so we are back to subseq :P
<jmercouris>
I'll just make the cons then, no big deal
<jmercouris>
I'll cache the sublists for efficiency
<jmercouris>
pjb: Ah sorry, my modeline hadn't updated
<_death>
pjb: what's the point of the loop here
slyrus1 has joined #lisp
<pjb>
_death: probably you will do something else than collect; Here collect is to show what's bound to 4elems.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
caltelt_ has quit [Ping timeout: 245 seconds]
Timzi has left #lisp ["ERC (IRC client for Emacs 26.1)"]
regreg has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
svillemot has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
<makomo>
is it possible to use slime's in-place expansion features to expand local macros such as macrolets?
svillemot has joined #lisp
Denommus` has joined #lisp
Denommus has quit [Ping timeout: 245 seconds]
<phoe>
makomo: yes
fikka has joined #lisp
<phoe>
(macrolet ((foo (x) `(+ 2 ,x))) (foo 2))
<phoe>
with cursor on the last "foo" I get the correct expansion, (macrolet ((foo (x) `(+ 2 ,x))) (+ 2 2))
fikka has quit [Read error: Connection reset by peer]
<makomo>
hmm, nothing happens for me
<makomo>
using SLIME 2.22
wigust has quit [Ping timeout: 246 seconds]
<makomo>
i'm using slime-macroexpand-all-inplace btw
azimut has quit [Ping timeout: 245 seconds]
random-nick has quit [Ping timeout: 245 seconds]
<makomo>
slime-macroexpand-all works when my point is on the top-level form
pierpal has quit [Ping timeout: 244 seconds]
<phoe>
macrostep-expand
<phoe>
that's what I use
lumm has quit [Quit: lumm]
azimut has joined #lisp
<makomo>
hmm, i'll have to check out all of the different macroexpansion functions slime provides
FreeBirdLjj has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
azimut has quit [Ping timeout: 244 seconds]
existential1 has joined #lisp
bradcomp has joined #lisp
azimut has joined #lisp
wigust has joined #lisp
it3ration has joined #lisp
it3ration has quit [Remote host closed the connection]
it3ration has joined #lisp
fikka has joined #lisp
russellw has joined #lisp
<trittweiler>
jmercouris, See pop-n at https://pastebin.com/PQHv4YJU - this will destructively modify the input and not cons
<jmercouris>
trittweiler: interesting approach, thanks for sharing
<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)
<aeth>
For Vulkan's added performance to matter and be worth it (in exchange for added complexity) you need a very large application.
<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
<aeth>
it3ration: Just use OpenGL imo
<makomo>
i wonder if a "better" name could have been chosen though, one similar to ONCE-ONLY
it3ration has quit [Ping timeout: 240 seconds]
<Bike>
i'm not sure i understand how with-resolved-places is distinct from once-only
<makomo>
it does part of the job of a setf expander for you
<j`ey>
does CONTINUE work in DO-TIMES work like I would expect?
<Bike>
nope.
<makomo>
you don't have to manually call GET-SETF-EXPANSION, bind the exprs to temps, etc.
<Bike>
that is, if how you expect is to go to the next loop iteration, like in a C loop.
<makomo>
it does all of that for you, and just leaves you with the getter/setter forms