libera/#commonlisp - IRC Chatlog
Search
8:27:25
attila_lendvai
considering that each of us only has a limited time on earth, that is so much not true...
8:28:09
attila_lendvai
let alone when a project has no specification, and the only "API" is a binary blob...
8:35:06
mfiano
As Lisp programmers, we are paving the way for future generations to stand on our shoulders. Let's leave the footguns and bitrot where they belong.
8:49:19
borodust
phoe: in the beginning of times, :claw was using c2ffi and actually started as a fork of cl-autowrap with https://github.com/rpav/cl-autowrap/pull/83 merged (it was named bodge-autowrap at the time)
8:49:40
borodust
phoe: here i explain my reasoning switching to different solution: https://borodust.org/2020/06/12/claw-honing/#origins
8:52:14
borodust
once i was deep in wrapping C++, another feature bubbled up that required patching (or extending, i should say) of llvm/clang so i ended up with custom llvm/clang xD
8:53:00
borodust
but i dream someday i push that patch upstream, it's straightforward, just exposes more of C++ features through libclang C interface
8:53:41
borodust
attila_lendvai: my another dream is writing :claw documentation :D it's too early to mention or promote it anywhere
8:56:37
borodust
atm i'm working on super secret project that showcases in a useful way what can be done with alien-works (framework based on C/C++ foundation glued to lisp with :claw), then i'll go back to :claw release plans
9:00:07
borodust
for historians, previous claw repository is here: https://github.com/borodust/claw-legacy there you can see the rich history it has that goes back to cl-autowrap and c2ffi ;p
9:00:29
attila_lendvai
borodust, does that mean that i shouldn't mention claw in the CFFI readme? or with a word that it's beta?
9:18:02
lisp123w
phoe: Your suggestion on LW HUG is interesting. The downside is if things break on LW, people will invariably complain to LW and they may not want to deal with that
9:18:48
phoe
lisp123w: break on LW, what do you mean? if a library breaks on LW, then the first question is whether the library itself is OK
9:18:59
phoe
and if the library itself is OK, then the question is whether the LW CI edition is used correctly
9:19:16
lisp123w
They are already relatively hands off because they have limited time and spending on paid projects (I dare not ask them for help)
9:19:38
phoe
yes, I can imagine - that's why I asked about feasibility from the business point of view
9:19:41
lisp123w
Break in the sense, there is something in LW that isn't ANSI compliant / different to how other implementatiosn do it
9:20:07
phoe
well, they can mark it as WONTFIX in the worst case, and then compatibility libraries can try to work around this quirk
9:20:25
phoe
the real question is about discovering these quirks in the first place in LW as it is right now
9:22:22
lisp123w
It would be net beneficial for LW users to have better tested libraries for their implementation
9:23:25
lisp123w
unrelated, but we should do a crowd funding to get Clozure Associates to build a Cocoa Backend for CLIM...
9:24:23
lisp123w
(I think Clozure Associates did most of the GUI work for LW for Mac, they are the experts in that area)
9:26:49
phoe
lisp123w: that could be done, I guess - try contacting them about the idea and open a fundraiser somewhere if they're interested
9:46:59
phoe
minor announcement: CLISP installable via `ros install clisp-head` has working and somewhat tested package-local nicknames now
9:50:14
lisp123w
I reached out to Clozure, expect it to way too expensive (if they are interested at all), but you never know if you never ask :)
10:01:08
kathe
phoe: have you had time to give serious thought to a mop+clos book after you're through with the current one?
10:07:25
blacked
In defining like some default parameter for keyed function, why we give like this `((:c 10))`?
10:07:39
blacked
Like for this (defun foo (&key a b ((:c 10))) (format nil ": ~d\n :~d\n :~d " a b c) )
10:09:28
kathe
lisp123w: reason to ask about 'paip' is that's it's so huge and requires some knowledge of calculus (which i've forgotten).
10:09:59
phoe
blacked: &key ((foo bar)) means a different thing - it separates the keyword parameter that becomes the API from the variable name that is used internally
10:12:03
phoe
(&key (c 42 c-provided-p)) adds another boolean variable that is true only if :C is provided, and false otherwise
10:12:26
lisp123w
kathe: I'm reading PAIP now as my fingers hurt and I need to take a break. I think its a luxury in 2022, so would recommend working on actual projects & reading PCL if you need particular details on CL
10:13:08
lisp123w
One learns more from their own mistakes, so best not get caught in a 'paralysis by analysis' trap and get coding :)
10:14:03
phoe
blacked: in all of the above cases, C is both the variable name and the source for the name of the generated keyword, :C
10:14:39
phoe
and you can separate these by wrapping C in another pair of parenthesis and providing both the symbol that will name the keyword argument and the variable that's used internally
10:15:33
phoe
but you can do (&key ((:some-really-long-keyword c) ...)) to have a long API keyword and a shorter variable name for use in the function body
10:18:51
lisp123w
kathe: As an example, PAIP introduced the concept of data driven programming in Chapter 2, where the rules of an algorithm are separated out away from hardcoded conditional statements like COND and stored as data. A great idea, but one that I uncovered myself from trial and error so when I read it, it makes much more sense / sticks with me longer as I have gone through the pain of changing hardcoded functions in the past.
10:21:30
lisp123w
Ah he left. Was going to say: 'Dang' from Hacker News had a great quote, which I paraphrase: There's a natural balance between simple, ugly code and elegant, well abstracted code - start off by writing whatever comes to mind, and as you start repeating yourself, you will naturally start abstracting away, coming up with a better approach
10:22:10
lisp123w
I find that helped me a lot, because CL can have too much expressivity at times so one gets stuck trying to find the perfect solution. I'll shut up now :)
10:25:55
blacked
It feels weird in prefix notation. 😁 like i've to think from backward, unlike other languages
10:26:55
blacked
for eg (when (> (* i j) n).......) , first think what to compare , what value to multiply , what value to use....
10:30:35
phoe
also don't be scared of using lexical variables, even with names longer than one letter - Lisp code tends to be short even with that
10:31:33
splittist_
and putting the operator first allows multiple operands (* one-number another-number yet -another-number-without-repeating-the-operator)
10:31:48
phoe
the first difference you'll see compared to C++/Java/similar OOP systems is that classes don't have methods, generic functions have methods
10:34:21
phoe
blacked: sure; this channel can get busy at times, #clschool is a good place to ask more basic questions all the time though
11:35:33
artchad
borodust, I found a neat way to separate my own project, from projects I've pulled from the internet.
11:37:02
artchad
I just symlinked ~/Common-Lisp to ~/.local/share/common-lisp/source . There I put all the downloaded projects, which I load via asdf. In ~/quicklisp/localprojects I'll keep my own personal projects.
12:00:48
artchad
Oh, actually I can just quickload them, because quicklisp seems to use asdf:*central-registry*
12:01:22
artchad
I came up with thise solution. I just call this function whenever I want the downloaded projects to be visible.
12:02:40
artchad
Is there a smarter way of managing your local projects and downloaded projects separately?
12:14:39
artchad
Could you help me with that. I would love to have a nicer interface for scanimage. Currently I'm using shell scripts, which is kinda meh.
14:04:42
artchad
interesting is that asdf:*central-registry* doesn't include ~/.local/share/common-lisp/source nor ~/common-lisp by default.
14:06:38
Bike
the asdf central registry is only a backwards compatibility thing. you're supposed to use the newer config mechanism now, and that's what asdf uses for those directories probably
14:53:29
White_Flame
artchad: most people use quicklisp nowadays, and symlink their project trees from ~/quicklisp/local-projects/ to make them visible
14:54:09
White_Flame
(well most people use quicklisp. not that necessarily most people use its local-projects dir over asdf)
14:54:45
White_Flame
but it uses that filesystem artifact to maintain their default visibly loadable projects
14:58:05
artchad
it's a waste to time to try and figure out why something failed, just to realize that a system in local-projects contains a system with the same name, as the one pulled from quicklisp prior.
14:58:25
artchad
that's why I'm making sure all the things I clone go into a separate directory, which is not visible by default
14:58:55
artchad
only when I start a repl and explicitly want to play around with someone elses code, then I make sure quicklisp can find it.
15:00:02
frgo
Hi guys. I have been away a bit - so please excuse me jumping right to an issue I couldn't resolve for the last couple of days: c2ffi on ARM64. I am trying to build cl-sdl2 and it fails misrably on my NVIDIA Jetson Xavier NX (being an ARM64 6-core CPU). Anybody here with experience c2ffi on ARM64?
15:03:46
White_Flame
artchad: ah, ok. I have some loader scripts in my .sbclrc as well, for pulling in things with their own static libraries
15:06:30
frgo
If anyone wants to see the issue: https://gist.github.com/dg1sbg/2f997df6bd4183578aae24b02663bd73#file-c2ffi-failing-on-arm64-when-building-cl-sdl2
15:21:58
phoe
like, the real error seems to be in /usr/lib/llvm-12/lib/clang/12.0.0/include/arm_neon.h:1730:47 and not anything that includes that file
15:54:15
_death
frgo: I don't use this architecture, but vector operations table at https://clang.llvm.org/docs/LanguageExtensions.html seems to suggest that clang does not support C-style cast for neon vector types
15:57:26
SAL9000
phoe: regarding l-t-v and static-let ( https://github.com/phoe/articles/blob/main/2022-01-30-load-time-value/README.md ) -- could you fall back to implementing load-time-value via let-over-lambda in implementations where eval semantics != compile semantics?
15:58:35
phoe
SAL9000: I can't, the LET would need to be hoisted all the way up and above the LAMBDA
15:59:06
phoe
one way to fix it would be to make an external hashtable from some sorta symbols to values, but that would be kinda ugly
16:01:28
SAL9000
what if, at macroexpand time, (let ((v (make-thing))) (lambda () v)) and pass the return value of that into the macroexpansion?
16:02:37
_death
frgo: SDL includes this header in SDL_cpuinfo.h .. you can try to define SDL_DISABLE_ARM_NEON_H and see what happens
16:20:19
Bike
i don't think dumping functions works on any implementation. i would be interested if one could do it
16:20:42
phoe
again, you could try to (load-time-value (lambda () v)) to work around this problem, but, sike, we are using load-time-value
16:23:17
Bike
phoe: translating a runtime function object into a description of a function object is nontrivial
16:25:22
SAL9000
but hey at least we aren't in bizarro C++ land, where const doesn't always mean constant (i.e. const qualifier on pointers)
16:26:04
Bike
constants could also influence dumpability in weird ways. like, if you have (lambda () (if t 0 #.(non-externalizable-object))), whether that could hypothetically be dumped depends on how much optimization the compiler does.
16:30:01
scymtym
http://web.archive.org/web/20170331132917/http://www.discontinuity.info/~pkhuong/common-cold/ may be interesting in this context
16:47:20
Bike
yes. symbol-value is sort of orthogonal to whether a variable has been proclaimed/declared special.
16:56:28
jasom
You could use #. instead of load-time-value; that should only get evaluated at read time, right?
16:59:06
jasom
I was thinking #.(let ((x gensym)) (setf symbol-value x 0) x) and then using the result in a macrolet
16:59:50
phoe
the symbol-value is only set in the compiler environment, it won't get dumped into the FASL
17:02:39
borodust
frgo: if you are fine with sdl2 bindings only and don't care about c2ffi working you can steal bindings from https://github.com/borodust/aw-sdl/blob/master/bindings/aarch64-linux-android.lisp
17:03:21
borodust
frgo: generally speaking though, most of SDL2 is fairly portable, so you can take any bindings and use them
17:05:03
borodust
so, what i mean, you can take cl-sdl2, rename one of the .json (linux one to be more or less safe) to the architecture of yours and be done with it
17:08:46
frgo
So, for the record: _death 's advice worked. I will compare results with the android output.
17:11:48
borodust
ahh, i guess, i need to read better next time, i thought there's a problem with c2ffi
17:34:04
jasom
biggest downside is you can't declare the type of it; some magic with cl:the might let you get around it
17:40:26
sm2n
alpine doesn't make all the dependencies for ecl necessary for building as necessary dependencies by default
17:41:56
sm2n
(Also, the only reason I used ecl is because I was running it on a very old raspberry pi short on ram, feel free to try another implementation, everything but the build scripts should be portable, and I developed on sbcl)
17:47:16
sm2n
something like (progn (ql:quickload :scanner) (save-lisp-and-die "scanner" :toplevel #'scanner:main :executable t)) I think
17:50:45
yottabyte
how can I check if every element in a list is in another list? I know I can iterate over the list and do find, but I imagine there's a simpler way
17:52:49
sm2n
yeah, try replacing the #'scanner:main with (lambda () (scanner:main) (mapcar #'bt:join-thread (bt:all-threads)))
17:56:48
artchad
"Unhandled SB-THREAD:JOIN-THREAD-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING"
18:01:03
Bike
besides the fact that trying to join all threads might be weird if some library you don't expect made threads, this isn't totally safe, since it's possible another thread gets created just after all-threads returns.
18:02:45
phoe
attempting to join threads that you don't manage yourself sounds like a recipe for hanging forever
18:12:41
sm2n
the directory is changed in the scan command usually, but that failed because you didn't have scanimage
18:19:51
artchad
now I just need to get sane working in the terminal and then everything should be great.
18:37:28
artchad
ok, getting the correct driver is apparently non-trivial on Alpine. On Devuan it worked.
18:57:39
fe[nl]ix
sm2n: see the note in https://sionescu.github.io/bordeaux-threads/threads/join-thread/
18:59:18
sm2n
fe[nl]ix: What would you suggest? (It does seem to work in this case, but hunchentoot uses bordeaux-threads under the hood and it's the only thing running, so that may be why)
19:02:42
sm2n
yeah, the usecase is that an executable is produced, and it only has hunchentoot in it, but the hunchentoot event loop isn't on the main thread, so without some way of blocking, the application just immediately closes
19:05:06
lisp123
Is there a standard function to write association lists like this: (make-alist key datum key datum key datum)?
19:06:43
White_Flame
lisp123: there is (mapcar #'cons '(k1 k2 k3) '(v1 v2 v3)) => ((K1 . V1) (K2 . V2) (K3 . V3))
19:08:39
Josh_2
sm2n: there is also a means for exiting correctly, on sbcl I believe its a list @ sb-ext:*exit-hooks*
19:12:13
sm2n
I'm not saying it doesn't work, I'm just saying I don't think that's theoretically clean in all cases either
19:13:07
Josh_2
the executable shutting down immediately is solved by searching for a thread named hunchentoot and joining it
19:15:13
White_Flame
I noticed that plist-alist does nreverse at the end. I like how COLLECT avoids that
19:15:49
White_Flame
right, for (k v) traverses 2 elements in, and then by #'cddr re-traverses 2 elements redundantly
19:15:52
lisp123
I'm anti-alexandria, everyone should write their own functions (or copy from others on IRC :D)
19:24:25
dlowe[x]
I have a question about lparallel on sbcl - let's say I set up a bunch of tasks (> number of workes) each calling cl:read-line on a socket stream. Can it successfully negotiate all the I/O or is it going to block weirdly?
19:35:24
jasom
phoe: A new static-let that I *think* is more efficient, and also lets you specify the type. Modifying it to instead parse declarations for the &body form to set the type is an exercise left up to the reader: https://plaster.tymoon.eu/view/2908#2908
19:53:20
yottabyte
suddenly, I'm getting these errors in emacs: Debugger entered--Lisp error: (void-function ql:quickload), any idea what's going on?
19:55:00
Bike
yottabyte: that is the error you would get if you tried to evaluate (ql:quickload whatever) in elisp.
19:56:05
yottabyte
up until now, whenever I opened a .lisp file, it was using slime-mode and sbcl, etc.
20:03:32
Guest74
EdLangley[m]: That doesn't work for me. I don't want to load every colour library in existence just to provide support for the one colour library the user is using.
20:10:06
Guest74
hm, all the scanner talk has reminded me I haven't submitted my networked sane lib to quicklisp.
20:12:00
Guest74
Xach: What's the procedure to submit a library? The quicklisp.org website's front page hasn't been updated since 2016.
20:13:35
EdLangley[m]
Guest74: yes, and my suggestions all involved defining multiple systems, each of which only depends on one colour library
20:14:11
Guest74
lagash: sm2n: it's a backend for scanning over the network. I use it to scan on my local scanner so I don't have to touch foreign stuff, it's all lisp.
20:15:03
Xach
EdLangley[m]: asdf-system-connections introduces problems also, at least for quicklisp
20:15:05
Guest74
Ed: you said so that one library would load them all, Perhaps I misinterpreted. Anyways, I hate slashes in package names.
20:19:01
Guest74
sm2n: I should mention it's only the implementation of the protocol. My frontend for it isn't in a finished state. Works fine at the repl though.
20:22:07
Guest74
https://github.com/JMC-design/nsane I should probably add links to how to actually get sane to serve a scanner over the network. I swear that was the hardest part of writing it.
20:25:25
Guest74
Xach: so issue under quicklisp-client? I ask because I don't see any such issues, i guess you delete them? I wonder why this isn't written anywhere.
20:26:02
Bike
i linked you where you should file the issue: https://github.com/quicklisp/quicklisp-projects/issues