remexre has quit [Read error: Connection reset by peer]
ec has joined #commonlisp
taiju has joined #commonlisp
akoana has joined #commonlisp
gioyik has quit [Ping timeout: 276 seconds]
igemnace has joined #commonlisp
Qwnavery has quit [Quit: WeeChat 3.2.1]
ec has quit [Ping timeout: 276 seconds]
ec has joined #commonlisp
random-nick has quit [Ping timeout: 264 seconds]
remexre has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
greyrat has joined #commonlisp
lucerne has joined #commonlisp
lisp123 has joined #commonlisp
ec has joined #commonlisp
gioyik has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
gioyik has quit [Ping timeout: 276 seconds]
nature has quit [Ping timeout: 246 seconds]
ec has quit [Ping timeout: 276 seconds]
ec has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
john__ has joined #commonlisp
gaqwas has quit [Ping timeout: 252 seconds]
asarch has joined #commonlisp
akoana has left #commonlisp [#commonlisp]
ec has quit [Ping timeout: 276 seconds]
gioyik has joined #commonlisp
ec has joined #commonlisp
gioyik has quit [Ping timeout: 276 seconds]
tyson2 has quit [Remote host closed the connection]
asarch has quit [Quit: Leaving]
waleee has quit [Ping timeout: 265 seconds]
gioyik has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
gioyik has quit [Ping timeout: 276 seconds]
<beach>
Good morning everyone!
jealousmonk has quit [Remote host closed the connection]
ec has joined #commonlisp
doyougnu has quit [Ping timeout: 252 seconds]
<hayley>
Messing with my regex-to-CL compiler, which now seems to scan at somewhere around 570 to 700 Mcharacters/s.
<beach>
How does that compare to other similar programs?
ec has quit [Ping timeout: 276 seconds]
taiju has quit [Ping timeout: 264 seconds]
gioyik has joined #commonlisp
<hayley>
Is there much that can be done to optimise a state machine translated to CL code? The only things I can think of are that it is branch heavy, and that memory bandwidth isn't infinite.
ec has joined #commonlisp
gioyik has quit [Ping timeout: 276 seconds]
semz has quit [Ping timeout: 246 seconds]
taiju has joined #commonlisp
<hayley>
Well, I can't really do much about the branches, but the code performs a linear scan over a vector, which should be pretty good.
semz has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
Bike has quit [Quit: Lost terminal]
ec has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
<saturn2>
try to make your branches go the same way each time
<moon-child>
saturn2: nothing you can do about that, it's a function of your input
<moon-child>
I mean, the branch predictor will learn if, after state X, you usually transition to state Y. But if your input requires you to transition to state Z, there's nothing you can do about that
<moon-child>
'_same_ way each time' branch predictor can predict much more complex patterns than that, new zen even has a perceptron, though obviously if there's _no_ entropy there's nothing to be done
<saturn2>
sometimes you can do things
<saturn2>
effort to benefit ratio is probably pretty bad though
<lisp123>
I'm struggling a bit with Symbols, since equality is based on being the exact same symbol, not just whether their print names are the same. That problem I can resolve with a custom equality test. The other complexity I have is symbols being interned in different packages - so if I just rely on symbol name to identify symbols, I am missing this important information
<moon-child>
lisp123: what are you doing?
<lisp123>
For example, the elisp reader does not have access to CL's package definitions, so if I read something via elisp, its a bit tricky to associate the symbol with the correct package. SYMBOL-PACKAGE helps here
<lisp123>
I want to know if there is a better way than just using SYMBOL-NAME & SYMBOL-PACKAGE
<lisp123>
moon-child: I have a logging function which accepts a function name as an argument
<beach>
Don't read anything via elisp?
<moon-child>
you would like foo:a and #:a to compare equal, but not foo:a and bar:a?
<lisp123>
moon-child: I would like a 'better' (for my purposes) way of working with symbols, sort of like having the symbol, its package information, its symbol name - all rolled upinto one (e.g. like a SYMBOL CLOS object?)
<lisp123>
beach: I have written a module for users to select which functions to log, this is in elisp since its I/O
<beach>
lisp123: It is already rolled up into one. They SYMBOL object.
<moon-child>
I still do not understand what you find unsatisfactory
<moon-child>
do you want package FOO to pass a designator for a function defined in package BAR? You can do that?
<moon-child>
You can do that.*
<beach>
lisp123: I'll be quiet since this obviously is not Common Lisp, so I have no advice to give.
<lisp123>
moon-child: I was just wondering whats the best way to work with symbols --> looks like the SYMBOL object is the right way and has SYMBOl-NAME / SYMBOL-PACKAGE all embedded
<lisp123>
I was thinking of creating a list structure to store all this information (since I was confused) --> Now I realise I don't have to do that
ec has quit [Ping timeout: 276 seconds]
<lisp123>
Thanks both, its very helpful - sorry I was just confused earlier on, but now I know that I need to just use the SYMBOL object within the CL code and then destructure it when transferring to elisp & back
<lisp123>
I guess I should SYMBOL-NAME & SYMBOL-PACKAGE to split a SYMBOL up, and then to find a symbol, use FIND-SYMBOL
<beach>
lisp123: By the way, the term "CLOS object" is meaningless. Every Common Lisp object is an instance of some class, and the concept of classes and instances of classes is a CLOS thing.
pve has joined #commonlisp
<lisp123>
beach: Thanks
<lisp123>
Are package names also symbols?
<beach>
No, strings.
<beach>
lisp123: By the way(2): In a typical Common Lisp implementation, SYMBOL is a built-in class, but in SICL it is a standard class: (defclass symbol () ((... :reader symbol-name) (... :reader symbol-package)))
<lisp123>
beach: Thanks, that was the missing link (thanks for clarifying). I didn't realise SYMBOL itself was a class which stored various pieces of information
<lisp123>
Are all data types in SICL standard classes?
<beach>
No, I just said that SYMBOL might be a built-in class which is different from a standard class.
<beach>
When the Common Lisp HyperSpec says "system class", it can be a built-in class with special representation, which is different from a standard class which has a standardized representation.
cognemo has joined #commonlisp
<beach>
This is so that pre-ANSI Common Lisp implementations could get away with special representations of various objects even after CLOS was bolted on.
<lisp123>
Oh sorry, I read the earlier part as SYMBOL was a standard class in SICL?
amb007 has quit [Ping timeout: 252 seconds]
<beach>
It is in SICL, but not in most Common Lisp implementations.
amb007 has joined #commonlisp
<lisp123>
Got it, thanks
<beach>
Because most Common Lisp implementation were started before the ANSI standard.
<lisp123>
Would it be a big deal to rewrite an implementation for converting symbol as a built in class to a standard class?
<beach>
Yes. Typically, that would completely ruin their bootstrapping technique. Most Common Lisp implementations add CLOS at the end of bootstrapping, so standard classes are not available by the time symbols are needed.
<lisp123>
Interesting to know
<lisp123>
Thanks
<beach>
Pleasure.
CrashTestDummy2 has joined #commonlisp
ec has joined #commonlisp
CrashTestDummy3 has quit [Ping timeout: 252 seconds]
karlosz has quit [Ping timeout: 252 seconds]
Jach has joined #commonlisp
ec has quit [Ping timeout: 276 seconds]
Lycurgus has joined #commonlisp
Cymew has joined #commonlisp
selwyn has joined #commonlisp
ec has joined #commonlisp
attila_lendvai has joined #commonlisp
amb007 has quit [Ping timeout: 246 seconds]
amb007 has joined #commonlisp
frgo has quit [Quit: Leaving...]
cosimone has joined #commonlisp
amb007 has quit [Ping timeout: 265 seconds]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
gioyik has quit [Quit: WeeChat 3.1]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
<lukego>
Hey I'm noodling around trying to access the Linux kernel perf_event interface from Lisp e.g. to get free profiling data and sample performance counters like # cycles/instructions/etc. anyone happen to have already been there? also, CFFI seems like the obvious approach, but I'm finding it kind of confusing and wondering about doing something more direct e.g. constructing C structs using NIBBLES
<lukego>
though it is neat that the CFFI groveller can fill in the magic numbers from the C header file. Just that it's not obvious to me how to encode some basic C-isms like struct bitfields and anonymous unions. Maybe I should just skip those for now. It seems like what CFFI calls a "bitfield" is something else - like an enum of values 1<<0, 1<<1, 1<<2, etc.
<lukego>
probably I need to stop overthinking this and start running cffi-grovel to see it in action...
<lisp123>
Sounds complex, good lucK!
<lukego>
Thanks. Could well be that CFFI-GROVEL is exactly the sweet spot in terms of automation. Just have to get to know it a bit.
<lukego>
(SB-GROVEL specifically says that it doesn't support bitfields in structs but I don't see anything in the CFFI docs about this.)
<lukego>
... though, this FFI API is really low-level internal plumbing talking directly to a Linux syscall, so might make sense to auto-gen a messy binding with c2ffi/autowrap/claw or something, since not much client code will ever be written... but those take some work just to setup.
<lukego>
okay I've successfully run CFFI-GROVEL for the first time and now I'm definitely having fun :P
Lycurgus has quit [Quit: Exeunt]
john__ has quit [Ping timeout: 252 seconds]
hendursa1 has joined #commonlisp
hendursaga has quit [Ping timeout: 276 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
minion has quit [Remote host closed the connection]
minion has joined #commonlisp
hineios0 has joined #commonlisp
hineios has quit [Quit: Ping timeout (120 seconds)]
abraham has quit [Quit: Ping timeout (120 seconds)]
specbot has quit [Killed (NickServ (GHOST command used by specbot1))]
<White_Flame>
lukego: if you M-. into TIME and such, you'll see that SBCL already has wired up references to such things directly in the runtime, without CFFI
<White_Flame>
not portable, but easy to access & fiddle with
cosimone has quit [Remote host closed the connection]
<borodust>
lukego: link me to the header you want to wrap, i'll generate bindings for it with claw
<lukego>
White_Flame: Yeah. I'd take that route except that this is a relatively big interface - literally hundreds or thousands of new time sources instead of just a few clocks - and is probably equally useful to users of CCL/ECL/etc.
<lukego>
also it's a raw system call interface with pretty elaborate structures so I really want some help with correctly defining all of that without too much fuss
<White_Flame>
sb-unix: is the package, if you ever get curious
<White_Flame>
yeah, the sbcl time stuff is built on getrusage
<lukego>
There's a whole bunch of hardware support for profiling in CPUs these days that I'd like to expose to Lisp. Simple things are counters for cycles/instructions/cache-misses/branch-mispredictions/etc. More elaborate are automatic sampling and tracing on the hardware level e.g. logging addresses of instructions that took a long time to complete and so on. Seems like something people would find uses for.
<White_Flame>
yeah, I'd love to see proper access to that sort of thing right from within the image
<White_Flame>
I'm not enough of a unix junkie to get into all the linkage details of all that myself
igemnace has quit [Remote host closed the connection]
<lukego>
Is there a canonical "portable" way to make a raw system call? I want to call Linux perf_event_open from CFFI-using code and it doesn't have a C wrapper in any standard library.
<lukego>
I see code in Osicat for defining syscalls but maybe that is One More Thing that's not needed
amb007 has quit [Read error: Connection reset by peer]
<borodust>
lukego: okay, that won't be fast, i'm away from my main developer machine and i don't have :claw set up over here :(
Nilby has joined #commonlisp
<jackdaniel>
lukego: what do you mean by "raw" system calls? the most "raw" way is to shovel numbers into registers and trigger the interruption isn't it?
<jackdaniel>
if you want to go through ffi then you need a wrapper
amb007 has joined #commonlisp
<jackdaniel>
somewhat less raw is using unistd.h and syscall function (which is a wrapper)
<jackdaniel>
(then you shovel numbers as arguments to this function)
amb007 has quit [Ping timeout: 265 seconds]
<Nilby>
In my o/s wrapper set, sometimes the libc wrapper isn't right and I've been forced to use the entry point libc uses, or even lower and call _syscall with the right number. None of that is what I would call "portable", more like it's sometimes "ported".
amb007 has joined #commonlisp
<Nilby>
Hopefully on good compilers the lisp wrapper ends up mostly disappearing in compiled code, but there's of course always the issues of data type conversion, so unless you really need performance and keep everything in C data on the Lisp side, or everything works out with unboxed data, there will be some overhead.
<White_Flame>
also that of stack state management between lisp & native modes
<White_Flame>
and maybe different register usage assumptions
<Nilby>
newer syscalls sometimes don't even have a libc wrapper, like bpf in linux
<CodeBitCookie[m]>
Hey ho,
<CodeBitCookie[m]>
any code which is most common to use with CL
<CodeBitCookie[m]>
how to do it? Like, should i do it like the book "Practical Common Lisp"?
<lukego>
jackdaniel: The level of rawness I have in mind is basically osicat:defsyscall. maybe I'll just use that and not overthink things. (I don't have a dependnecy on oscicat before this but hey why not.)
waleee has joined #commonlisp
<Nilby>
or you could (defcfun ("syscall" real-syscall) :long (number :long) &rest)
<lukego>
er though hm not that's not right, it seems to be expecting to call a named C wrapper function
<Nilby>
Thankfully the syscall numbers aren't really allowed to change in later versions.
<lukego>
CodeBitCookie[m]: there are a lot of styles to choose from. starting with imitating PCL sounds like a good idea to me.
<pjb>
lukego: man syscall # on linux, indeed…
<Nilby>
Hmmm. That perf_event_open looks like one of the harder syscalls to wrap, which foolishly makes me want to try.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
<Nilby>
sadly I don't currently care enough about bpf to make something like baggers' varjo
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
random-nick has joined #commonlisp
cosimone has quit [Ping timeout: 264 seconds]
tyson2 has joined #commonlisp
<yewscion>
Good Morning, Everyone!
jealousmonk has joined #commonlisp
<lukego>
borodust: no worries. Maybe auto bindings won't save so much in this case anyway, there is a lot of information that will be communicated in custom / hardware dependent format via mmap region
<lukego>
borodust: but I will be very curious to see what claw produces if you happen to get a chance :)
<beach>
Hello yewscion.
<beach>
yewscion: Are you new here? I don't recognize your nick.
yewscion has quit [Ping timeout: 264 seconds]
<Nilby>
So it seems loop collect works by keeping a tail pointer. Is there some way to do a manual :collect, e.g. for use in not first level forms, without manually doing the whole tail pointer thing or worse a push and nreverse?
cosimone has joined #commonlisp
<semz>
Iterate allows this
<semz>
but imo it's not really worth pulling in iterate for
<semz>
after running into this problem myself quite a bit I just decided to roll a WITH-COLLECT macro that does the tail pointer thing under the hood
<beach>
Nilby: Sometimes I do (loop ... append (if ...))
<beach>
Nilby: Then the nested form can always return the empty list of you don't want to "collect" anything.
Qwnavery has quit [Quit: WeeChat 3.3]
<Nilby>
beach: Interesting. So loop ‘append’ unlike cl:append keeps a tail pointer or somehow doesn't need the traverse the list?
<Nilby>
s/the/to
yewscion has joined #commonlisp
<beach>
I should hope so. Certainly SICL LOOP does.
<yewscion>
beach: Yeah, I'm new here. Been on IRC for a long while, but new to Libera and #commonlisp.
<Nilby>
Ah. The peaceful certainty of the implementor. :)
<beach>
Nilby: Heh!
<beach>
yewscion: Great! Welcome!
<Nilby>
beach: Thanks. I never thought of that. I'll give it a try.
<beach>
Nilby: You may want to run a performance test to confirm that it is not doing something quadratic on some Common Lisp implementations.
selwyn has quit [Ping timeout: 252 seconds]
waleee has quit [Quit: WeeChat 3.2.1]
taiju has quit [Ping timeout: 264 seconds]
taiju has joined #commonlisp
waleee has joined #commonlisp
<Nilby>
semz: Thanks. I was hoping to avoid those, but it's good to consider options.
<semz>
I don't really like them either, so let me know if you find a nicer solution.
taiju has quit [Read error: Connection reset by peer]
taiju has joined #commonlisp
<semz>
Thinking about it, one could also treat (cons list end-pointer) as a data structure and turn collecting into a normal function. Gets rid of the macro but still a little awkward to introduce a new structure when you're really just working with lists...
<beach>
Nilby: Certainly, on SBCL, using the APPEND LOOP keyword does not result in quadratic behavior.
<Nilby>
semz: Hmmm. Like if the ‘into’ var could magically allow a (collect x) function
<beach>
Nilby: Oh, and I guess with NCONC you will avoid some extra consing too.
<Nilby>
Hmmmm. I might have to revise my loop style.
<beach>
In what way?
<Nilby>
Using appeend and nconc more often. I think I used to be a bit scared of them.
<beach>
I see.
Bike has joined #commonlisp
<lukego>
Hey can CFFI-GROVEL work with bitfields in structs at all? I was thinking I'd just treat them as integers but I'm not sure how to declare that... it wants a c-name and all the names I have are for bitfields, and none of them work because you can't take offsetof() on them.
<lukego>
Maybe a compromise would be to use CFFI-GROVEL to define all the various enum's but not for structs and function signatures.
waleee has quit [Quit: WeeChat 3.3]
<Nilby>
lukego: I wish I could help, but I'm very contrary and don't use cffi-grovel, so I usually leave bitfields as ints and either make bit field macros, or more frequenly wrap it in a nicer lispy interface.
yewscion has quit [Ping timeout: 260 seconds]
selwyn has joined #commonlisp
Inline has joined #commonlisp
zups has quit [Ping timeout: 240 seconds]
zups has joined #commonlisp
Everything has joined #commonlisp
cage has joined #commonlisp
Josh_2 has joined #commonlisp
<Josh_2>
Hey hey
doyougnu has joined #commonlisp
<Josh_2>
Can someone check for me if (ql:quickload :staple) works for them?
<Josh_2>
I'm getting an error saying that a symbol is not external to a package
eddof13 has joined #commonlisp
<raeda>
Josh_2: No problems from me. What symbol isn't external?
<Josh_2>
"WHOLE-PARAMETER-GROUP"
selwyn has quit [Read error: Connection reset by peer]
<raeda>
STAPLE::WHOLE-PARAMETER-GROUP is unbound when I load staple. Maybe it's a bug in code that uses staple?
selwyn has joined #commonlisp
<Josh_2>
I am trying to quickload staple directly
<Josh_2>
not a project dependent on it
selwyn has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
selwyn has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
kpoeck has joined #commonlisp
selwyn has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<Bike>
tried it, got the same error
lisp123 has quit [Ping timeout: 265 seconds]
Cymew has quit [Ping timeout: 246 seconds]
srhm has quit [Read error: Connection reset by peer]
srhm has joined #commonlisp
kpoeck has quit [Quit: Client closed]
kpoeck has joined #commonlisp
lisp123 has joined #commonlisp
<Josh_2>
Thanks Bike
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #commonlisp
<lisp123>
Works for me
khrbt has quit [Ping timeout: 264 seconds]
khrbt_ has joined #commonlisp
<lisp123>
If I want to load some elisp code for a program, I have two options. Either I get the end user to download and load the .el file themselves (which encourages them to tinker with it and improve it for themselves), or I can just do a slime:eval-in-emacs....I am leaning towards the latter as it reduces the installation process, any thoughts?
cosimone has quit [Ping timeout: 264 seconds]
<mfiano>
The latter requires the user to update their Emacs configuration.
<mfiano>
(since it is a security risk)
<lisp123>
mfiano: That they have to do anyway since my program interacts with Emacs
<mfiano>
Also keep in mind a few people here do not use Emacs
<mfiano>
SLIME works in Vim too, and there are ports to other editors
<lisp123>
Yes, however for them my program is useless (it has an Emacs Front ENd)
<Nilby>
some people don't use emacs or even slime/vlime
<mfiano>
Ok, finally, keep in mind a larger number of users use Sly
<lisp123>
All good points
<mfiano>
Which has a similar piece of functionality, so you'll need to use read time conditionalization
<lisp123>
Ok, I will create a SLY front-end and make that adjustment....and also create some other front end for other users
<lisp123>
Actually thanks, this is very helpful. I will create an alternate version that works directly in the REPL, and leave the Emacs version there for those who want a slightly better experience
selwyn has quit [Read error: Connection reset by peer]
lisp123_ has joined #commonlisp
lisp123 has quit [Read error: Connection reset by peer]
lisp123 has joined #commonlisp
tfb has joined #commonlisp
lisp123_ has quit [Ping timeout: 252 seconds]
srhm has quit [Read error: Connection reset by peer]
srhm has joined #commonlisp
waleee has joined #commonlisp
selwyn has joined #commonlisp
<jmercouris>
is there something better than setf gethash?
<jmercouris>
it always bothered me, maybe there is like a sethash in some library or something
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
<lisp123>
jmercouris: You can write one :)
<Bike>
jmercouris: what bothers you about it?
<jmercouris>
of course I can write one
<jmercouris>
Bike: well, I can push to a list, I feel like I should be able to push to a hash table
<jmercouris>
it feels like a part of the API is missing
<Bike>
what would pushing to a hash table mean
<jmercouris>
pushing a new entry to a new key
<jmercouris>
I can imagine (push "key" "value" "table")
<Nilby>
I use a library with a generic elt that works hash tables and whatever
<Bike>
but that's what (setf gethash) does. is it just the order of arguments you don't like?
<jmercouris>
feels better than (setf (gethash "key" "table") "value")
<lisp123>
I read a very good quote on SO:
<jmercouris>
I don't know how to explain it, but it just feels to be missing
<lisp123>
n different ways.
<lisp123>
hould the language have every possible gadget like this that anyone can write in a minute? In Common Lisp, there are included batteries, but they are other kinds of batteries: things that are actually hard to do. For example, a compile function for dynamically compiling code at run time. It would be prohibitively difficult for most users to develop such a thing from scratch compared to pulling keys or values from a hash table in half a doze
<jmercouris>
well, it's not a big deal, perhaps I am just procrastinating and not realizing it :-)
<jmercouris>
I tend to focus on details when I procrastinate
<lisp123>
Think of it as a feature ;) It encourages more programmers to write small bits of code vs. being spoon fed --> The end result making them better programmers
kpoeck has quit [Quit: Client closed]
karlosz has joined #commonlisp
<jcowan>
lisp123: I don't agree with that, and in fact I think it's a rationalization.
selwyn has quit [Read error: Connection reset by peer]
<Guest17>
saw the asdf post on reddit. I keep running into this perennial problem where I need to dump a program with asdf dependencies into another source tree such that anyone can check out the code and make the program from scratch as opposed to distributing it via the system package manager or as a quicklisp package.
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Guest17>
after reading that post, I figured that the only thing I really needed was to prevent asdf from searching the user directories for packages and only use one provided by project configuration
<Guest17>
additionally, in my particular case, it would be nice to keep the build objects (fasls) in the source tree in a particular spot, as that is where we put build artifacts of other code in this repo. That part I think I read in the documentation
<lisp123>
jcowan: I don't disagree, it can come across as an excuse - but everyone has different requirements, one person's sethash is another's setf gehash
<Guest17>
the way I see it, I can check in a whiole lisp distribution, like a checkout of a working ccl folder, the result of calling quicklisp bundle, ??? calling code to build a kernel+image ??? only using asdf packages found in the local directory and preventing the user directory defaults ??? profit
<Guest17>
Is there anything obviously wrong with my general approach?
amb007 has quit [Ping timeout: 264 seconds]
amb007 has joined #commonlisp
<lisp123>
Guest17: Not entirely sure what you are after, but if I recall correctly QuickLisp Local Projects might help
<lisp123>
Believe it scans local projects first vs. other locations
<lisp123>
Otherwise you just need to figure out where ASDF scans first (don't know off the top of my head) and put your .asd files there -> In general I think its better not to have multiple versions of the same dependency running around
<Guest17>
so my ultimate goal is that I have a work repo for non lisp code. I made a utility that I don't want to rewrite in common lisp. I want any yahoo that checks out the main repository to essentially run make and get my utility as a standalone program. My code depends on packages sourced from quicklisp and I know how to create a bundle of the
<Guest17>
dependencies that I can include in the main repo
eddof13 has joined #commonlisp
<lisp123>
Ok
<lisp123>
So you just want everything in one folder yes?
<Guest17>
right, the last part is important for repeatable builds, I don't want asdf to scan the default directories, in case someone like me has a local install of quicklisp
<Guest17>
yes
<lisp123>
Your users have Common Lisp installed I imagine and are CL users right, otherwise you wouldn't be sharing them the source code
<lisp123>
>
<lisp123>
?
<Guest17>
They don't, not yet anyways. Actually since we use ros, sbcl is pulled down as a dependency, so yes they all do ;-) but I'd prefer it if the build process didn't depend on any system-installed or user-installed files/packages, and that such things wouldn't get accidentally pulled in if they exist
<Guest17>
that way anyone could potentially make a code fix (or me) and pull the lever
lottaquestions has joined #commonlisp
dcx has joined #commonlisp
waleee has quit [Ping timeout: 264 seconds]
<Guest17>
I know i've had issues with the fact that in ubuntu 16.04, many lisp packages are available from the apt repo, and those conflict with installing things assuming those aren't available (which I'm always doing)
<Guest17>
perhaps I'm being overly cautious, but I have a thing for repeatable builds
<lisp123>
I'm trying to check the IRC Logs on that, I think that might be a better version of ASDF that could help you
<Shinmera>
It's not anything at all yet.
john__ has joined #commonlisp
<lisp123>
Shinmera: Will it have version control eventually?
<Shinmera>
It has that already.
<Shinmera>
It doesn't have a way to actually *run* a build though.
<Shinmera>
I'm working on it.
<Shinmera>
There's also no way to scan for projects, or even define them outside of writing source code
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
<jcowan>
lisp123: That case doesn't bother me. But on that argument, why does CL standardize LENGTH? It's about five lines of code. The CxxxxR functions are even shorter.
<pjb>
jcowan: history
<lotuseater>
hysterical raisins :P as I learned here
<pjb>
lisp123: (string= 'cl-user::foo 'keyword::foo) #| --> t |#
<jcowan>
Sure. But the passage that lisp123 quoted claims that there is a rational argument for excluding functions with short definitions.
<pjb>
lisp123: symbols are string designators, and string= and string-equal take string designators…
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<lisp123>
pjb: Thanks, I think I'm all good on Symbols today after my earlier confusion in the morning
<lisp123>
I am more or less finished on my autologging tool (based off IBCL), will share shortly for feedback and if anyone finds it useful
<pjb>
loop has both :append and :nconc
<pjb>
* The nconc keyword causes its list values to be concatenated into a single list, as if they were arguments to the function nconc.
<pjb>
* The append keyword causes its list values to be concatenated into a single list, as if they were arguments to the function append.
amb007 has quit [Ping timeout: 252 seconds]
<pjb>
Indeed, nothing says that the implementation cannot optimize by keeping a reference to the last element, but note that since loop often cannot easily guess what will be the last list appended to the result, in the case of append it has to keep a reference to the start of the last appended list, to be able to copy if if a new one needs to be appended.
<pjb>
Both could also be implemented directly as: (loop collect list into lists finally (apply appender lists)) with appender = (function append) or (function nconc), and therefore defer the optimization to loop collect, and to the append and nconc functions.
<lisp123>
jcowan: I take back my earlier comment partly, there's no good reason for not having more standardisation as jmercouris queried earlier re sethash. However, I think "just write your own" is a fair response in the sense (IMO?) that seems to be one of the essential styles of programming in Lisp (reshaping the language to suit your needs)
<pjb>
I note that no implementation returns true for (let ((last (list 1 2 3))) (tailp last (loop for list in (reverse (cons last (quote ((4 5 6) (7 8 9))))) append list))) ; which means that they are all non-conforming: (loop append) doesn't behave like (function append)!
<jmercouris>
lisp123: well, sure, but the problem is not everyone will use whatever layer you design, the common denomenator is CL
<jcowan>
I agree with that, certainly. But I think it's worth standardizing trivial but commonly used things for two reasons: everyone will use the same name for them, and to avoid this problem: "Data type X would be optimal here, but I have a better library for data type Y, so I'll use Y.
<jcowan>
"
<jmercouris>
so if you are using some super set of CL, in order for users who are not using your superset you have to be able to compile to CL
amb007 has joined #commonlisp
<jcowan>
Well, if it comes to that, every function and macro added to an image creates a superset of CL.
<jmercouris>
right, it does
<jmercouris>
I guess I am thinking of things differently, because I am thinking in the context of Nyxt, which is a application framework
<pjb>
or any non-standard operator specific to the implementation. Including semi-standard stuff like the MOP, gray-streams or less standard stuff like ffi and sockets.
<jmercouris>
and I'm thinking OK, things that users build with Nyxt, how will they be broadly applicable to the CL community as well?
<Bike>
in this case the function at issue wouldn't just be short, it would be exactly another operator with its arguments permuted
<pjb>
jmercouris: if you don't hide the fact that some stuff comes from the CL package and some from a NYXT package, users should be able to write library code that only use CL…
<Bike>
at which point maybe there should just be mechanisms for doing that (like haskell has, off the top of my head)
<jmercouris>
pjb: Of course they can, but WILL they?
<pjb>
jmercouris: one problem of emacs is that it doesn't have packages…
<jmercouris>
pjb: that's just one of a myriad
<pjb>
jmercouris: depends if they're mainly nyxt users, or mainly CL programmers ;-)
<jmercouris>
Yes, indeed
lottaquestions has quit [Ping timeout: 252 seconds]
<lisp123>
jmercouris: I assume you would have a fair bit of custom API for various widgets, so nyxt code writers will largely work with your standard library vs. CL?
Guest7673 has joined #commonlisp
<lisp123>
So as long as you document reasonably well, most CL users will be able to navigate through your codebase and figure out where you are abstracting away -> Thus, IMO write for the non-CL user
<etimmons>
Guest17: I think either CLPM or Qlot would help you out if you want semi-repeatable builds
<Guest17>
etimmons: i've looked at that before. I need to look into it in more depth
voltron has joined #commonlisp
<etimmons>
Guest17: Which one? or both?
<Guest17>
oh sorry, CLPM
<Guest17>
I remember reading your articles
<borodust>
lukego: yeh, weird, i saw them too - not sure if those are incorrect
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<Guest17>
roswell rubs me the wrong way and I have a hard time articulating why
<borodust>
lukego: akchooali, how they are rational being an offset..
<etimmons>
Oh, I thought I read in the logs that you already used Roswell
<etimmons>
Guest17: it also rubs me the wrong way. I think probably because it tries to do too much
dcx has joined #commonlisp
<etimmons>
Guest17: If you decide to poke at CLPM, feel free to jump to #clpm if you have questions. Also happy answering things here, so long as we don't swamp it
<borodust>
lukego: hmm, it's probably due to tight bit packing but CFFI operates on bytes
<lukego>
Just now I suspect that I'll use CFFI-GROVEL to resolve all my named enum constants to concrete values and then otherwise probably use NIBBLES to construct my foreign data. That wouldn't be a good strategy in general but I think makes sense here especially since there will be a bunch of other in-memory structures not defined as C structs at all iirc
<etimmons>
Any mods here also have a matrix account? Or are willing to briefly give mod powers to a matrix user?
<lukego>
thanks for all the input!
<etimmons>
IRC -> Matrix messages appear to be broken because someone on the matrix side isn't fully connected
<etimmons>
It's a security feature (on by default) so that anyone sending a message on IRC knows who's all in the room when they send a message
<etimmons>
But it appears to be pointless for this channel since we have public logging
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 252 seconds]
X-Scale` is now known as X-Scale
rgherdt_ has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
q3cpma has joined #commonlisp
<q3cpma>
Hello, does anyone know a way to avoid calling gethash more than once when you want to check the value before setting it? Maybe a way to store a place in a variable, or something?
<_death>
when you read from a hash-table, you use gethash, and when you write, you use (setf gethash)
amb007 has joined #commonlisp
<q3cpma>
_death: but I have to call gethash twice for each entry, and the standard obviously doesn't say the hash won't be computed twice
caret has joined #commonlisp
<q3cpma>
I may have a lead with get-setf-expansion
<_death>
a call to gethash is not the same as a call to (setf gethash), although it's true that the hash may be computed twice
<q3cpma>
Yes, but I think I might avoid this by using the setf-expansion to get the "reference"
<q3cpma>
Yeah, but I think I'll try to make my incf-or-set-0
<rotateq>
Ah I remember the section from reading the book.
Guest7673 has quit [Ping timeout: 256 seconds]
waleee has joined #commonlisp
kakuhen has joined #commonlisp
<Bike>
i believe sbcl's hash tables do this themselves, i.e. they cache the last key so if they get it again they don't need to recompute anything
<q3cpma>
That'd be cool
<q3cpma>
But what about my get-setf-expansion idea for a portable solution?
<q3cpma>
(btw, I started CL a week ago, so I'm a big noob)
Guest76 has joined #commonlisp
<Bike>
get-setf-expansion isn't going to compute hashes
<Bike>
it works on forms, not values
<Bike>
if you look at what you get from (get-setf-expansion '(gethash foo bar)) you can see there aren't any hashes in it
<q3cpma>
Hmmm, so how does setf does it?
<Bike>
generally (setf (gethash foo bar) baz) expands into something like (funcall #'(setf gethash) baz foo bar) or (puthash baz foo bar)
<Bike>
then the function (setf gethash) or puthash does the hashing
<Bike>
setf itself is just a macro
<q3cpma>
Makes sense
<q3cpma>
So incf does possible two hash computes on less optimized implementations.
<q3cpma>
Man, this looks like a tragic oversight to be honest.
<q3cpma>
If only make-hash-table had a :default-value, at least.
caret has quit [Read error: Connection reset by peer]
Guest76 has quit [Ping timeout: 256 seconds]
<q3cpma>
From #clschool, someone solved my specific problems by pointing that the default optional arg of gethash was used with incf!
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<pjb>
Yay for that someone! ;-)
<_death>
the incf would basically be (let ((value (gethash ... 0))) (puthash ... (1+ value)))
<pjb>
q3cpma: the standard doesn't impose algorithms in general (only the lisp reader and a very few function algorithms are specified). But it is in general expected that implementations at least try to be as efficient as possible in the common cases.
<pjb>
Hence this optimization I mentionned to save the last entry in a cache in gethash, so that (setf gethash) doesn't have to recompute everything if you just used gethash before.
attila_lendvai has quit [Ping timeout: 260 seconds]
<q3cpma>
Yes, let's say that it feels a bit "dirty".
<q3cpma>
Like using type punning though unions in C =)
<pjb>
Not really. A lot of data structure benefit from a much clearer API when some caching is used.
<Bike>
i don't understand. is (incf (gethash ...)) not what you'd want to write?
<_death>
but the hash function may be very fast.. in other words, is this an actual performance problem you're having, or pie in the sky thinking about what hashing twice might incur
recordgroovy has quit [Quit: leaving]
<q3cpma>
No, I mean relying on implementation-defined behaviour part
<pjb>
Bike: (incf (gethash key table 0#|<-- was missing the initial value#|))
<pjb>
q3cpma: optimization is an implementation-defined behavior.
<Bike>
what's relying on implementation behavior? incf gethash will work anywhere
<q3cpma>
_death: I'm doing the word frequency exercise, of course I have to optimize it, or it doesn't make any sense
<pjb>
q3cpma: why would you care if an entry is computed twice anyway? gethash should be O(1) (ie. doesn't depend on the number of elements in the hash table).
eddof13 has joined #commonlisp
<q3cpma>
pjb: it obviously depends on the key size (strings, here)
<_death>
q3cpma: what is the word frequency exercise?
<Bike>
is the hash function actually what's slow?
<Bike>
probably scanning through some text to make a histogram of word frequencies?
<_death>
pjb: gethash is O(n) :)
<pjb>
Bike: efficient (incf (gethash key table)) depends on the implementation caching the entry it finds (otherwise it has to compute the hash of the key twice in a row, and to find the entry twice, once to read, and once to write it.
<pjb>
Bike: compare with (incf (assoc key alist)), where incf can do (let ((entry (assoc key alist))) (if entry (incf (cdr entry)) (push (cons key (1+ default-value)) alist))) without calling assoc twice (which is O(n)).
<Bike>
"Read a file of text, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies" close enough
<pjb>
_death: nope, gethash is O(1).
<pjb>
_death: the parameter that matters when we say that, is the size of the hash table, not the length of the keys…
voltron has quit [Remote host closed the connection]
<_death>
pjb: with ordinary hash tables, the amortized cost may be constant, but worst case cost is N
<q3cpma>
pjb: using O with hash tables is always tricky, as you can never be sure the bucket isn't getting a bit full.
<q3cpma>
And you're O(m) with m being the size of your key, anyway
<pjb>
_death: in particular, CL hash-tables have the threshold parameters, that hints at one implementation strategy: when the table becomes big (not enough holes), it size is increased and the entries redistributed. So CL hash-table can avoid bucket lists.
<_death>
pjb: for example, when there is a collision, the items in the buckets may be scanned (linearly)
<pjb>
q3cpma: so basically, there are no bucket in CL hash-tables.
<pjb>
and we expect the hash function used to avoid collisions. If there are, the threshold parameters ensure that there are enough holes, so that it's again O(1) (statistically) to find the slot.
<pjb>
This doesn't prevent bugs, eg. once clisp had a bug where the hash function used returned a value multiple of 4 (so that was very bad), but bar bugs, it's good.
<q3cpma>
I doubt it functions like that unless it uses a more complex strategy (e.g. cuckoo hashing)
<_death>
q3cpma: I'm not sure a hash-table is good for this problem, since you need the top items
<Bike>
rehashing doesn't make it constant time, does it? how long it takes to rehash depends on the size of the table. so you're back to _amortized_ O(1) _at best_ and worst case O(n). which is what death already said.
<lisp123_>
I have a related question --> How does this function work? (loop for key being the hash-keys of hash-table collect key)
<lisp123_>
Is there a list of hash keys saved down?
<q3cpma>
Doesn't look optimal, I'd probably use something like FNV for small keys and maybe XXH for the rest; but well, it's okay
<Bike>
lisp123_: depends on the hash table implementation. sometimes the table is two vectors, one of keys; sometimes it's one vector with keys and values interleaved
<Bike>
probably there are other ways to do it too
<lisp123_>
Bike: Great, thanks
<Bike>
probably not an actual list under the hood, that could slow things down
<Bike>
but it's technically allowed
<_death>
q3cpma: my question still stands though.. did you write the code, profile it and determine that the hash function is the bottle neck?
<lisp123_>
Bike: Thanks, makes sense
<q3cpma>
_death: didn't and I don't need to hear the old "premature optimization is the root of all evil", I know it. It's just a worry I got while doing a beginner exercise.
<_death>
q3cpma: it's not premature optimization, since you didn't optimize anything :)..
<q3cpma>
Well, "worrying about premature optimization", if you prefer
<Bike>
what would a hash table api with an option to use precomputed hashes look like? optional parameter to gethash? and then if you put in something that's not actually the hash it gets dumbly inserted there too, i guess?
<_death>
Bike: I guess it could have a incrhash operator for this specific case
<pjb>
Bike: amortised O(1) is O(1). In any case, the universe ends in 15 billion years.
<White_Flame>
or a more generic get-and-set-hash with a body that's evaluated inbetween
<q3cpma>
Something like Tcl's dict update, where it executes code with a local variable, then use its exit value to write
<White_Flame>
but the EQ key cache should be common in CL hashtable implementations and deal with all that
<pjb>
lisp123_: there's no list of hash keys saved down, it uses MAPHASH.
<_death>
pjb: when you write O(...) it means worst-case, iirc.. for average/amortized cases you don't use big-O but phi or somesuch
<lisp123_>
pjb: thanks
<Bike>
ah, a withhash or such, interesting
<pjb>
That said, nothing prevents you to implement your own hash-table variants with the right properties for your case.
<_death>
pjb: it's important when you have deadlines (real-time).. so you would then prefer, say, merge sort O(n*lg(n)) over quicksort O(n)
<_death>
*O(n^2)
<White_Flame>
but there are tons of options that emerge with this sort of combined API, that just having the basics suffices better
ggoes_ has quit [Ping timeout: 246 seconds]
<White_Flame>
for instance, if there is no existing key, maybe you want to have different behavior than if one does exist
<pjb>
_death: indeed.
<White_Flame>
or have the option to remove the key within your read-modify-write operation, etc
<pjb>
_death: note that bubble sort on a sorted array is O(n), so it could even be better if our array is usually sorted.
<q3cpma>
Yeah, another thing that I don't like, is that SBCL's with-locked-hash-table seem to lock the whole table, and not just the bucket
<_death>
pjb: here it's question of what you're counting.. tests or swaps
<White_Flame>
there migh tnot be a "bucket"
<q3cpma>
Yes, in case of open/cuckoo hashing, that's right
tfeb has joined #commonlisp
<Bike>
i think sbcl does use open hashing.
<_death>
q3cpma: basically for this problem I'd say you want a priority queue (which can be implemented, say, as a heap of some kind)
CptKirk has quit [Remote host closed the connection]
<q3cpma>
_death: hmmmm, how would that work with strings? Doing log(N) string comparisons sounds dreadful.
lisp123_ has quit [Remote host closed the connection]
ggoes has joined #commonlisp
lisp123 has joined #commonlisp
<pjb>
q3cpma: that said, usually you have to have a lock outside of the hash-table, hash-table locks are quite useless IMO.
<White_Flame>
you could intern string themselves, or if they don't have very many shared prefixes, failure comparisons will be quick
<_death>
q3cpma: possibly.. so you may want a trie as well
<q3cpma>
pjb: that's true, a simple mutex certainly is more portable
<White_Flame>
and the (incf (gethash ...) ...) doesn't hold a lock between the read & the write
<White_Flame>
it only serializes them, so it can still trample other writes inbetween
<_death>
q3cpma: of course CL already gives you hash-tables and sort.. and it'll likely be fast enough (even if a hash-function gets called twice...)
<pjb>
The point is that if you have multiple threads, there will be other data to include in the mutex, not only the hash-table entry.
<tfeb>
what a lock in a hashtable protects is the hashtable.
lisp123 has quit [Ping timeout: 265 seconds]
<Alfr>
_death, I doesn't matter whether your analysis is armortized or not. O(f) means there exists A for all sufficiently large X we have g(x) < A*f(X).
shka has quit [Ping timeout: 252 seconds]
CptKirk has joined #commonlisp
<Alfr>
_death, in contrast big theta means that's g is also bounded below by f, i.e. additionally there's B f.a. large enough X s.t. B*f(X) < g(X).
<_death>
Alfr: ok.. it's been a while since I read about this notation
tfeb has quit [Quit: died]
<q3cpma>
Thanks a lot for your help, everyone, goodbye
q3cpma has quit [Quit: leaving]
terrorjack has quit [Remote host closed the connection]
terrorjack has joined #commonlisp
seok has joined #commonlisp
<seok>
How do I assign a folder to quickload packages ?
<seok>
Sometimes my portacle breaks and stops looking at /projects folder
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 264 seconds]
Lord_of_Life_ is now known as Lord_of_Life
john__ has quit [Ping timeout: 246 seconds]
lisp123 has joined #commonlisp
<White_Flame>
~/quicklisp/local-projects/ can have symlinks or subdirs that will be quickloaded
<White_Flame>
or there's asdf:*central-registry* but you need to have init code that feeds it on every launch
<White_Flame>
^seok
lisp123 has quit [Ping timeout: 252 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<seok>
White_Flame do I edit system-index.txt file in ~/quicklisp/local-projects/ ? or...
perrierjouet has quit [Quit: WeeChat 3.2.1]
tyson2 has joined #commonlisp
cosimone has joined #commonlisp
<White_Flame>
seok: no, there's a ql: call to update/refresh the registry, if you've changed the local-projects during runtime
<White_Flame>
in case it doesn't jus twork
<seok>
oh do you mean, I have to place the systems in there ?
<pjb>
seok: reading the quicklisp documentation.
<pjb>
seok: and not asking the same question in multiple channels. See the answer in #clschool
<seok>
oh sorry someone asked me to ask here
<White_Flame>
symlinks work as well, you don't need to actually place them there
<White_Flame>
just make sure to symlink your whole project directory, not just the .asd
hendursa1 has quit [Quit: hendursa1]
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
hendursaga has joined #commonlisp
Alfr has quit [Remote host closed the connection]
Alfr has joined #commonlisp
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
perrierjouet has joined #commonlisp
lisp123 has joined #commonlisp
yewscion has joined #commonlisp
cosimone has quit [Ping timeout: 264 seconds]
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
lisp123 has quit [Ping timeout: 264 seconds]
CptKirk has quit [Ping timeout: 246 seconds]
taiju has quit [Ping timeout: 264 seconds]
taiju has joined #commonlisp
selwyn has joined #commonlisp
ec has quit [Quit: ec]
semz has quit [Quit: Leaving]
semz has joined #commonlisp
semz has quit [Remote host closed the connection]
semz has joined #commonlisp
pve has quit [Quit: leaving]
dre has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
Psybur has joined #commonlisp
CrashTestDummy3 has joined #commonlisp
CrashTestDummy2 has quit [Ping timeout: 252 seconds]