<rotateq>
dre: do you already know the macros WHEN and UNLESS ? maybe better talk about this in #clschool
<dre>
not quite, I'll join :)
Patternmaster has joined #commonlisp
jaimelm has joined #commonlisp
sheb has quit [Ping timeout: 240 seconds]
Alfr has joined #commonlisp
amb007 has joined #commonlisp
random-nick has joined #commonlisp
zoglesby has joined #commonlisp
<kagevf>
dre: I got into emacs using org mode first to take notes ... it was helpful for getting used to emacs itself ... a few months later I started learning CL and was already accustomed to using emacs
<kagevf>
... so that's one way to break up the learning curve a little bit
<dre>
my issue is that I'm already accustomed to vim
<kagevf>
dre: I've been using Vim for 10 years. at first I tried spacemacs, but it was too slow (for my setup anyway) ... I just went with native emacs key-bindings ... it's not that big a deal, and your muscle memory catches up pretty quick
<kagevf>
I use emacs for CL and org mode, and vim (or something with a vim plugin) for everything else ... it works out alright
<kagevf>
I get the feeling that emacs has been fine-tuned over the years to be really good at editing sexp's ... so IMO it's worth making the investment to learn it if you plan on hacking a lot of Lisp
<kagevf>
plus the slime integration is great too , of course
<dre>
yeah that's what I was worred about xD
<dre>
it seems fine-tuned
<dre>
but I mean, if I /can/ learn /both/ then maybe that's not a bad thing
<dre>
or just learn enough elisp to start making my favourite nvim plugins on emacs
<dre>
but yeah, not sure, bit by bit, I'm sure this won't be the last time I hear about it
<kagevf>
emacs key bindings pop up in a lot of places too ... like bash, tmux, apparently in Apple GUI (not sure it's what I heard)
OlCe has joined #commonlisp
<dre>
mm
<rotateq>
and the other big IDEs try being like it :)
<semz>
There is a SLIME knockoff for Vim (SLIMV? VLIME? something like that), but I can't vouch for its quality or how it compares to the original.
<pjb>
dre: I used vi a long time ago, on A/UX. Then I switched to NeXTstep and emacs. It's possible!
<dre>
semz, it's shit
<dre>
I've tried it.
<semz>
lmao
<rotateq>
and you get the powerful butterfly command, but use it wisely
<semz>
I was in a similar situation as you when I started out and have to say that you can get gradually used to Emacs
<dre>
the nicest I've found is "vim-slime" but it means you have to run sbcl in a tmux split, and then vim-slime will use a tmpfile to write to the other tmux terminal
<dre>
it's great, except I don't get the little explainer thingies like slime gets
<kagevf>
in emacs / slime you can print an object in the repl, and then "inspect" it ... C-c C-v i ... that's pretty useful
etiago has quit [Ping timeout: 265 seconds]
dilated_dinosaur has quit [Ping timeout: 260 seconds]
hhdave has quit [Ping timeout: 256 seconds]
dilated_dinosaur has joined #commonlisp
<dre>
my only real issue is that python support on emacs seems to be a bit sub-par? or atleast the LSP support.
<dre>
and I use python at work so i need to get /comfortable/ relatively quickly
<dre>
I'll try it again dw
<kagevf>
just stick with vim for python :)
<kagevf>
or use hylang! :)
<dre>
:P \
<rotateq>
or this cl-python
<rotateq>
that's what you meant with "procedural programming work"
thomaslewis has joined #commonlisp
VincentVega has quit [Remote host closed the connection]
etiago has joined #commonlisp
hhdave has joined #commonlisp
lisp123 has joined #commonlisp
kakuhen has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
ldb has joined #commonlisp
<ldb>
good morning
<kagevf>
"those ML models aren't going to train themselves"
<GreaseMonkey>
someone mentioned VLIME earlier... my experience is it has a nasty habit of forgetting how to indent Lisp code
<GreaseMonkey>
wait or was it SLIMV
<GreaseMonkey>
whichever the older one is
<GreaseMonkey>
i *think* it was SLIMV
<GreaseMonkey>
if it weren't for that it'd be fine, but nope, that bug renders the whole damn thing unusable
ahc has joined #commonlisp
<ldb>
one good thing for emacs is there is no need for a seperated irc client
<kagevf>
I think vim has a built-in lisp mode, rigtht? I wonder if that indents properly ...
tyson2 has quit [Remote host closed the connection]
<ldb>
nope. sly gets better indenting by communicating with common lisp subprocess, I guess it can not be get right if having no specifc knowlege about common lisp
<kagevf>
I see
s-liao has quit [Ping timeout: 256 seconds]
LoopMacro has joined #commonlisp
asarch has joined #commonlisp
taiju has quit [Ping timeout: 245 seconds]
random-nick has quit [Ping timeout: 252 seconds]
waleee has quit [Quit: WeeChat 3.3]
tyson2 has joined #commonlisp
<LoopMacro>
Recommendations on a unit test framework? I used LISP-UNIT a few years ago. Others I should consider?
<hayley>
I usually use Parachute. But there is still no feature that has it print "Where we dropping, fellas" before running tests.
<hayley>
(s/fellas/boys/ to be accurate)
<etimmons>
Second parachute
<stylewarning>
We use FIASCO
<LoopMacro>
Much appreciated. I see a new one called ROVE, but don't yet know anything about it.
<stylewarning>
works well enough for CI/CD, as well as interactive debugging
<jeosol>
stylewarning: was last comment regarding FIASCO? or ROVE
<hayley>
When I was working on the SICL hash tables, which had tests using Lisp-Unit, I ported the tests to Parachute, and then ported them back when I was done working on them. I don't remember why.
<stylewarning>
jeosol: Sorry, FIASCO
<stylewarning>
But i've been using FIASCO for 6-ish years now so maybe some cooler things exist
<jeosol>
stylewarning: thanks, no need to apologize; I was just confused by the sequence of messages
<jeosol>
never used it. I have recently gone back to using fiveam
<jeosol>
but not in a full CI/CD workflow, just running simple system level tests. I will like to get to the former
<LoopMacro>
In the summary of the link I posted, the author lists Parachute, Fiasco and LispUnit2 as #1, #2, and #3, respectively.
<stylewarning>
Let me see if I can find some cool looking test output
<stylewarning>
jeosol: yes. hayley: I don't know if gitlab runners will display color
<jeosol>
LoopMacro: I should take a look at that sabracrolleton link. He has done useful comparisons in the past (json, logging, and unittest). I like to see the updated information on testing
<stylewarning>
but that's just because of a cool developer, not fiasco
<phantomics>
I just discovered how inconsistent (alphanumericp) is between implementations, they have widely varying ideas of what an alphanumeric char is
<phantomics>
You can count the matching char codes with (progn (defvar *aclist* (loop :for i :below (expt 2 16) :when (and (code-char i) (alphanumericp (code-char i))) :collect i)) nil)
<hayley>
Unicode fun?
<phantomics>
The lengths for different implementations are SBCL : 49088 CCL : 48391 ECL : 48757 ABCL : 49142 Allegro : 65438 LW : 124
<phantomics>
Allegro counts practically everything in UTF-8 as alphanumeric, the exceptions are mostly just characters on the keyboard: !, &, > etc.
<phantomics>
But zodiac signs, box-drawing characters and others are all alphanumeric
<stylewarning>
phantomics: eek
<phantomics>
Meanwhile in LW, only these chars count: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
<stylewarning>
I thought LW had a sizable Russian user base
<phantomics>
Not even a Greek userbase apparently
sheb has joined #commonlisp
sheb has quit [Remote host closed the connection]
sheb has joined #commonlisp
taiju has joined #commonlisp
FragmentedCurve has quit [Quit: Lost terminal]
ldb has joined #commonlisp
rotateq has quit [Ping timeout: 268 seconds]
ldb has quit [Ping timeout: 256 seconds]
ldb has joined #commonlisp
ldb has quit [Ping timeout: 252 seconds]
s-liao has joined #commonlisp
ldb has joined #commonlisp
ldb has quit [Ping timeout: 252 seconds]
ldb has joined #commonlisp
ldb has quit [Ping timeout: 256 seconds]
lisp123 has joined #commonlisp
ldb has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
paule32 has joined #commonlisp
ldb has quit [Ping timeout: 256 seconds]
ec_ has quit [Ping timeout: 276 seconds]
ldb has joined #commonlisp
ldb has quit [Ping timeout: 256 seconds]
akoana has joined #commonlisp
prxq has quit [Ping timeout: 256 seconds]
Catie has joined #commonlisp
prxq has joined #commonlisp
Catie has quit [Client Quit]
Catie has joined #commonlisp
ldb has joined #commonlisp
engblom has quit [Ping timeout: 256 seconds]
ldb has quit [Ping timeout: 252 seconds]
poselyqualityles has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
aeth has joined #commonlisp
lisp123 has joined #commonlisp
ldb has joined #commonlisp
ldb has quit [Ping timeout: 252 seconds]
poselyqualityles has quit [Remote host closed the connection]
poselyqualityles has joined #commonlisp
ldb has joined #commonlisp
esb has quit [Quit: Using Circe, the loveliest of all IRC clients]
esb has joined #commonlisp
ldb has quit [Ping timeout: 256 seconds]
ldb has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
ldb has quit [Ping timeout: 256 seconds]
White_Flame has quit [Remote host closed the connection]
White_Flame has joined #commonlisp
<beach>
Good morning everyone!
ldb has joined #commonlisp
<beach>
phantomics: Are you saying Allegro has a data type containing UTF-8?
<phantomics>
Allegro's (alphanumericp) matches almost all characters in the UTF-8 range
<beach>
What is the "UTF-8 range"? UTF-8 is an seconding that maps Unicode code points to byte streams.
<beach>
So the range would be 0-255, no?
<phantomics>
Numbers below 2^16
<hayley>
That is a range, but I don't think it has any relation to UTF-8.
<beach>
UTF-8 can encode all of Unicode.
<beach>
phantomics: I am wondering about the role of UTF-8 in your statement about Allegro.
<phantomics>
Ok, the range of characters that can be encoded within 2 bytes
<beach>
Ah!
<beach>
So then that's not all characters up to 2^16.
<phantomics>
I know that for example the JVM only supports the Unicode code points up to 0xFFFF, that's why I wasn't able to create symbols using higher-coded characters in ABCL
<hayley>
The JVM uses surrogate(?) code points to support the rest of the Unicode code points.
<phantomics>
I chose 2^16 as the range of characters that all impls natively support, in order to compare what's considered alphanumeric by different impls
<beach>
phantomics: Some characters in that range require 3 bytes in UTF-8.
<hayley>
It appears SBCL uses "UCD general categories" to determine if something is alphanumeric.
Oladon has joined #commonlisp
<hayley>
(loop for n below char-code-limit for c = (code-char n) unless (null c) when (alphanumericp c) collect (sb-unicode:general-category c) into blah finally (return (remove-duplicates blah))) ⇒ (:LT :LM :LU :LL :ND :LO)
<phantomics>
Oh neat, letter-titlecase, letter-modifier etc.
<beach>
phantomics: In fact, anything above #x0800 requires 3 bytes in UTF-8.
<phantomics>
Didn't know that, why does it require 3 bytes? It appears 2 is all that's needed to store those codes
<beach>
But UTF-8 is not about storing codes. It's about encoding the code points as a stream of 8-bit bytes, which is why I am asking about the role of UTF-8 in your statement.
<phantomics>
It's not actually relevant, as I now understand, I was referring to the set of characters with codes below 0xFFFF, which I chose to compare between implementations
<hayley>
UTF-8 takes additional bits to represent the length of a character, as a character is represented by a variable number of bytes.
<beach>
Ah!
<phantomics>
If you saw the numbers above, different CLs consider widely varying numbers of characters to be "alphanumeric"
<hayley>
...and subsequent bytes are tagged as "continuation" bytes, so that one cannot parse rubbish if they start in the middle of a character.
<beach>
I understood that much. I didn't understand the UTF-8 part.
<phantomics>
What do you call the set of characters below 0xFFFF?
<phantomics>
I found some problem using higher-coded characters in symbols in ABCL
<beach>
I didn't even know they had a separate name.
<phantomics>
This is one of those areas where an addition to the CL spec could be helpful, to determine which unicode characters should be considered alphanumeric
<beach>
Go right ahead and make a suggestion.
<beach>
Make sure you include common practice.
<beach>
You could format your suggestion as a WSCL issue if you like, but I think it is probably outside the scope of WSCL.
<_death>
lisp alien disagrees, since his alphabet is not yet included
<Bike>
eh, someone's probably put it in the private use area
pdietz has quit [Ping timeout: 256 seconds]
<phantomics>
Here's the Lisp alien alphabet: ᡛᡜᡝᡞᡟᡠᡡᡢᡣᡤᡥᡦᡧᡨᡩᡪᡫᡬᡭᡮᡯᡰᡱᡲᡳᡴᡵᡶᡷᢀᢁᢂᢃᢄᢅᢆᢇᢈᢉᢊᢋᢌᢍᢎᢏᢐᢑᢒ
pdietz has joined #commonlisp
semz has quit [Ping timeout: 252 seconds]
semz has joined #commonlisp
<beach>
phantomics: So would you like to write down a proposal in the form of an "issue"?
<_death>
well, there are other good arguments against unicode in the standard.. it keeps changing, very complex to implement, and probably too big for memory constrained systems
<semz>
I was about to say ^ before my net decided to go down
<beach>
phantomics: We already have other proposals that are great and still outside the scope of WSCL, like Bike's memory model.
<beach>
_death: But it could be conditional, as in "if Unicode is included, then..."
<phantomics>
beach: I could do that, is there a good template to work from? _death: I would see this proposal as applying to the use of Unicode characters; if Unicode is not in use, it would not apply
<semz>
Another point is that you don't really win all that much by guaranteed (instead of conventional, as now) Unicode support in the language. Many programs that "support Unicode" actually support some arbitrary subset of it.
<phantomics>
JVM limitations cause ABCL to support only the UCS-2 range for symbols
<_death>
beach: not sure what that antecedent means in practice
<beach>
_death: Me neither, but I am sure some formulation exists.
<phantomics>
I was just looking at ECL's code, ECL seems to use C's isalnum function to test characters, but docs I found for that function suggest it just matches the English Roman alphabet characters
<beach>
_death: There has got to be cases like that in the standard already.
<phantomics>
beach, those examples look good, I can write something modeled after those. I'm corresponding with Franz right now concerning their implementation and I'll bring up the UCD categories
<Guest74>
having standard unicode functions to determine types and uses of codepoints would certainly make multilingual font rendering easier. Though there are some systems implementing some of that.
<semz>
the C functions are technically locale-dependent
<phantomics>
semz: that's what the docs said, they gave English Roman as an example so I'd guess the matching characters will be just the alphabet used with the locale
<semz>
although many big programs just set the locale to something like "C" because C's locales are capital A awful
<stylewarning>
𝒜wful
<phantomics>
I discovered this because having APL characters register as alphanumeric broke April's parser, which was puzzling at first. It definitely helps to have uniform character treatment for text processing
<etimmons>
minion: memo for scymtym_: Do you know of any success stories using Eclector as the reader for CL:LOAD (without completely replacing the implementation's reader)? I tried using Fare's reader-interception, but it has issues. Trying to decide if I should fix them or hop to something else that already works.
<minion>
Remembered. I'll tell scymtym_ when he/she/it next speaks.
<beach>
etimmons: You mean using it for LOAD, but not for READ?
<etimmons>
Yes
<beach>
What is it that you are trying to do?
s-liao has joined #commonlisp
<beach>
I am just curious. If you are busy, don't worry about it.
akoana has quit [Quit: leaving]
<etimmons>
I've got a client for eclector that can change how package lookup is done on symbols (kind of like a poor man's version of first class environments). I'd like to also use it to prevent the use of ::
mrcom has joined #commonlisp
<etimmons>
And I'd like to use that reader when LOADing or COMPILE-FILEing
<beach>
Sounds like a perfect match for Eclector.
<etimmons>
It is! And I've got it implemented with Eclector :)
<etimmons>
Problem is hooking it into LOAD
<beach>
Ah, yes. That would depend on how LOAD is implemented.
<etimmons>
The reader-interception library is promising. It peeks at the next character in the stream and sets the readtable so that the next character dispatches to your desired reader.
<beach>
I see.
<etimmons>
But it doesn't handle some things quiiite right.
<beach>
Sounds like a kludge, but it might work.
<etimmons>
I think they're fixable, but if someone's already got a method that works I'd like to switch over to it.
<etimmons>
Huge kludge, for sure
<beach>
We should encourage Common Lisp implementations to have something like a *READER* special variable.
<etimmons>
That'd be nice!
<beach>
How hard would it be to replace LOAD?
<beach>
It would seem that the work done by LOAD itself would be quite limited.
<_death>
a simple-load is just a read/eval loop?
<etimmons>
Pretty easy in my current use case.
<beach>
Yeah. With binding some special variables.
<etimmons>
But what attracted me to reader-interception is that it should work for COMPILE-FILE as well
<beach>
Good point.
s-liao has quit [Quit: Client closed]
tyson2 has quit [Remote host closed the connection]
poselyqualityles has quit [Ping timeout: 256 seconds]
<beach>
etimmons: I have been trying to convince scymtym_ to submit an ELS paper about Eclector, but he is not interested. I think we tend to assume that everyone interested is using IRC, but that's not the case, so I think Eclector deserves to be known more widely.
<beach>
I considered writing the paper myself.
ec_ has joined #commonlisp
<etimmons>
I think an ELS paper would be great. I certainly wish I knew about it before I did.
<beach>
Yes, I see.
Algernon69 has joined #commonlisp
Bike has quit [Quit: sleep]
Jing_ has joined #commonlisp
<etimmons>
I'm looking at it more and I think reader-interception is definitely fixable.
<etimmons>
It seems to just handle EOF stuff badly.
<etimmons>
Biggest question is if Fare is still active enough to look at the fix and merge it
<beach>
That's a good question.
Jing has quit [Ping timeout: 240 seconds]
lisp123 has quit [Remote host closed the connection]
Algernon69 has quit [Ping timeout: 252 seconds]
ahc has quit [Quit: Client closed]
Catie has quit [Quit: rcirc on GNU Emacs 29.0.50]
aartaka has joined #commonlisp
rain3 has joined #commonlisp
ec_ has quit [Ping timeout: 276 seconds]
<dre>
I'm getting filtered by the first AoC question
<dre>
how do you force t to be a number?
Oladon has quit [Quit: Leaving.]
<phantomics>
How do you mean force t to be a number?
<phantomics>
For question 1 you just need to loop over the vector of depths subtracting the previous from each depth starting at index 1, then count the positive differences
<dre>
I'm buggered
<dre>
I have to go back to python ;_);
taiju has quit [Ping timeout: 252 seconds]
<phantomics>
This loop gives you the differences in depth, with *depths* being the vector of measurements: (loop :for x :across *depths* :for ix :from 0 :when (and (< 0 ix) t) :collect (- x (aref *depths* (1- ix))))
<phantomics>
Then just count the positive numbers in the list
<dre>
phantomics, thanks. is there any other way to do it? I spent a long time trying to get some recursive function to do it
varjag has joined #commonlisp
<beach>
dre: Your use of LINE as a Boolean variable is a violation of the rules stated on page 13 of the LUV slides by Norvig and Pitman.
<beach>
dre: ... and (LAMBDA (X) (> X 0)) can be expressed as #'PLUSP.
<beach>
dre: ... and (< 0 IX) can be expressed as (PLUSP IX).
Cymew has joined #commonlisp
<dre>
truthy is any non-nil value thou
<beach>
It is not about semantics. It's about the message you send to the person reading your code.
<dre>
atm I don't even understand the code
<beach>
Oh, I thought you wrote it.
<beach>
Not so?
<dre>
phan helpedf with the loopcount, I googled the with-open-file
<dre>
I say it sorta in jest
<dre>
I get the code, I'm still learning
<beach>
Yes, I understand. That's why I am pointing out these issues to you.
<beach>
dre: Clearly the use of > or < has the same semantics as the use of PLUSP and MINUSP, but again, it is about the person reading your code.
<dre>
:) thanks
<dre>
yeah I get it
<beach>
The "rule" here is that you should use the most specific construct that will do the trick, so as to make the understanding of your code faster.
taiju has joined #commonlisp
<dre>
it would've been nicer if #'PLUSP was like #'POSITIVE-P or something
<dre>
because that's what I'm doing
Algernon69 has joined #commonlisp
<beach>
Why is POSITIVE-P better?
<dre>
well when I think plus I think of the action, compared to 'positive' which would be an adjective
<beach>
It is plusP, which is what Common Lisp uses to indicate a predicate.
Algernon91 has joined #commonlisp
<beach>
Anyway, that would be a problem only for the first few days of learning a language. It would not be worthwhile designing a language with those few days in mind.
<_death>
dre: think of the sign of the number, plus or minus
frgo has quit [Ping timeout: 256 seconds]
<dre>
god dammit reddit has a nicer answer than I do
<dre>
countif / mapcar was what I was originally trying before getting stuck in that loop business.
<dre>
I'm so screweed for AoC xD
gaqwas has joined #commonlisp
<phantomics>
dre: for a recursive function, you just need to go over the list keep track of three values: the last value, the current value, and the number of matches. If the last value is less than the current value, increment the match count. If there is no current value (you're at the end of the list), return the match count.
<stylewarning>
Has lots of boilerplate that needs to go into the standard library...
<stylewarning>
With currying you can write slick code like (countBy (== LT) foo) to count the number of items in foo that are equal to the symbolic constant LT
varjag has quit [Ping timeout: 256 seconds]
<_death>
stylewarning: why not have a coalton-load that evaluates forms in coalton-toplevel context? (can also have a coalton-compile-file)
<stylewarning>
_death: I've been thinking about that, and also making an ASDF component type. But then it wouldn't work well with SLIME without slime hacking :[
<_death>
slime-coalton.el for .coalton files
<_death>
but makes sense
<stylewarning>
If someone builds that within the next month, there's a small reward posted (:
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<_death>
cool
kennyd has joined #commonlisp
shka has joined #commonlisp
<kennyd>
I wonder if it would it be possible to get similar currying working in plain CL, with a custom progn-like macro
lisp123 has quit [Remote host closed the connection]
<stylewarning>
kennyd: In general, unfortunately, you can't
<stylewarning>
And using lots of combinators in plain Common Lisp is so clumsy anyway, there wouldn't be much payoff. The most you might be able to do is define new reader syntax like [mapcar f], but you'd need to be able to query the arity of the function being called
<stylewarning>
And even then, it would be restricted to named, known functions only. Coalton gets away with it because all functions have their types statically known at compile time, so we can resolve "the meaning" of a curried expression with full generality, regardless of how many combinators are being composed and used
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
aeth has quit [Ping timeout: 252 seconds]
aeth has joined #commonlisp
rotateq has joined #commonlisp
lisp123 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
taiju has quit [Ping timeout: 252 seconds]
cage has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
<kakuhen>
I just learned that, like all textbooks, the Art of the MOP is not free of errors; obvious in hindsight, but interesting to see anyway
<beach>
kakuhen: I think it depends on the implementation whether a method on validate-superclass is needed.
s-liao has quit [Quit: Client closed]
s-liao has joined #commonlisp
treflip has quit [Remote host closed the connection]
Jing_ has quit [Remote host closed the connection]
Jing has joined #commonlisp
rogersm has joined #commonlisp
treflip has joined #commonlisp
dre has joined #commonlisp
lisp123 has joined #commonlisp
sterni has quit [Quit: WeeChat 2.9]
sterni has joined #commonlisp
lisp123 has quit [Quit: Leaving...]
attila_lendvai has joined #commonlisp
cuz has joined #commonlisp
<cuz>
Hey all, quick question. I have a list of a list of numbers and I want to create a new list that is the sum of each of those e.g. ((1 2 3) (4 5 6)) turns into (6 15). Is there a simple function for this?
<hayley>
(flet ((sum (xs) (reduce #'+ xs))) (mapcar #'sum '((1 2 3) (4 5 6)))) is the best I can think of.
<hayley>
(mapcar #'reduce '#1=(+ . #1#) '((1 2 3) (4 5 6))) is the worst I can think of.
<cuz>
yeah i've got some ugly mapcar apply combo... I guess it's not too bad but i'm suprised there isn't something standard
<contrapunctus>
hayley: what does "xs" mean?
<hayley>
Nothing.
<hayley>
Perhaps just "list-of-some-stuff" in Haskell/ML speak.
<semz>
it's the face #commonlisp makes when it sees haskellisms
<Krystof>
how often do you think generating a list of list sums happens, that there should be a standard function for this?
<Krystof>
supplementary question: if there were a standard function for this, what would its name be?
kennyd has quit [Quit: CGI:IRC (Ping timeout)]
kennyd has joined #commonlisp
s-liao has joined #commonlisp
<flip214>
(MAPCAR-REDUCE #'+ list), of course
<Krystof>
|mapcar-(reduce-+)|
<flip214>
patches to alexandria-2 might be accepted ;)
Algernon666 has joined #commonlisp
<kennyd>
should probably have sum that takes a flat list first
<kennyd>
not sure if there's already something like that in alexandria and friends
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Algernon91 has quit [Ping timeout: 250 seconds]
<rotateq>
+/2 3⍴⍳6
<semz>
for + you don't get much over (reduce #'+ ...)
<semz>
but for string concatenation, it's mildly annoying that there is no variant that takes a sequence
<semz>
(not that it's hard to write)
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
terrorjack has joined #commonlisp
Algernon666 has quit [Ping timeout: 252 seconds]
kennyd has quit [Quit: CGI:IRC (Error)]
Lycurgus has joined #commonlisp
<cuz>
This is a pretty common pattern for me, where I have a function and then I want to apply it to multiple inputs. EG lets say I want to send an email to multiple people but can only send it to one at a time, then I would make a list of each persons email and then apply the email function to each email in that list
kennyd has joined #commonlisp
kennyd has quit [Client Quit]
frgo has quit [Ping timeout: 256 seconds]
kennyd has joined #commonlisp
<kennyd>
it doesn't buy you much over reduce. but summing a flat list is probably a lot more common than summing a 2d one. and once you have a flat sum, summing a 2d list is short enough that we don't really need a new function, (mapcar #'sum ...), or (sum (mapcar #'sum ...)), depending on the desired result
<kennyd>
or even (sum (flatten list))
pranavats has left #commonlisp [Error from remote client]
<cuz>
Interesting
amb007 has quit [Read error: Connection reset by peer]
<scymtym_>
etimmons: i'm not aware of anyone hooking Eclector into CL:LOAD. what's the use case?
<minion>
scymtym_, memo from etimmons: Do you know of any success stories using Eclector as the reader for CL:LOAD (without completely replacing the implementation's reader)? I tried using Fare's reader-interception, but it has issues. Trying to decide if I should fix them or hop to something else that already works.
amb007 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
lottaquestions has joined #commonlisp
<akater[m]>
Krystof: Such operations are certainly very useful in multilinear algebra. But they should probably be in a multilinear algebra system. Wolfram named this one ArrayReduce: https://reference.wolfram.com/language/ref/ArrayReduce.html
random-nick has joined #commonlisp
cuz has quit [Ping timeout: 256 seconds]
<lottaquestions>
Hi all, where can I get details in the hyperspec about #1= and #1#?
<kennyd>
akater[m], isn't ArrayReduce just mapcar?
<kennyd>
nm, I missed last argument
tyson2 has joined #commonlisp
d_run has quit [Quit: Connection closed for inactivity]
nature has joined #commonlisp
pranavats has joined #commonlisp
<akater[m]>
kennyd: You're right: if you only have #'+ and not #'sum, it's not the same thing. Wolfram's apply takes a similar spec (“levelspec”) and so a hypothetical (wolfram:apply #'+ matrix '(1)) would effectively reduce the rows of matrix with #'+. It's a common enough operation to have infix for it. I used it quite often; Wolfram is very strongly oriented towards operating on “multidimensional” lists. levelspecs and dimension specs
<akater[m]>
are offered consistently in the language, where Lisp would offer &rest, essentially. &rest approach is ultimately more limited and less useful when dealing with arrays with higher ranks.
<akater[m]>
&rest is more handy in very simple cases and conses less, unless the multidimensional-oriented approach implements fusion.
* hayley
thinks petalisp:lazy-reduce or petalisp:lazy-reduce* takes a dimension (RIP petalisp:β)
s-liao has joined #commonlisp
Algernon666 has joined #commonlisp
Algernon91 has joined #commonlisp
Algernon666 has quit [Ping timeout: 250 seconds]
aartaka has quit [Ping timeout: 252 seconds]
theothornhill has joined #commonlisp
Lycurgus has quit [Quit: Exeunt]
<beach>
Krystof: Well put. I was just thinking of how to say it.
theothornhill has quit [Remote host closed the connection]
theothornhill has joined #commonlisp
kennyd has quit [Quit: CGI:IRC (Ping timeout)]
s-liao42 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
Bike has joined #commonlisp
theothornhill has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
yewscion has joined #commonlisp
<etimmons>
scymtym_: More details after I left the memo. But short story is I've got some package hacks I'd like LOAD and COMPILE-FILE to use.
semz has quit [Ping timeout: 252 seconds]
azimut_ has joined #commonlisp
azimut has quit [Ping timeout: 276 seconds]
<scymtym_>
etimmons: i see. i only have worked towards side stepping the implementation completely (for something like static analysis) which is pretty difficult in general since loading or compiling a file is not just a READ loop. instead READ must be interleaved with certain side effects. "just" replacing the implementation's READ could be easier. an implementation specific solution could be advising CL:READ such that it calls Eclector's READ
<scymtym_>
when, say, a certain special variable is true
<etimmons>
Ok, I'll look into that if my fixes to reader-interception fail
<etimmons>
It was working for a while. But then I had the gall to include a comment at the end of the file and it blew up.
pve has joined #commonlisp
semz has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
cosimone has joined #commonlisp
* attila_lendvai
has updated his build scripts to work on Guix
johnjay has quit [Ping timeout: 256 seconds]
johnjay has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
<Xach>
attila_lendvai: now nyxt is busted - but peace is restored in the dwim.huniverse
s-liao42 has quit [Quit: Client closed]
Algernon666 has joined #commonlisp
Algernon91 has quit [Ping timeout: 252 seconds]
epolanski has joined #commonlisp
<ns12>
Xach: "now nyxt is busted" - ???
<ns12>
Hi, what is the copyright status of the Common Lisp draft standards?
<beach>
ns12: Public domain.
<beach>
... or so the consensus appears to be.
<ns12>
beach: Interesting. Is there a document that says so?
<beach>
No, but we had Kent Pitman write it as I recall.
<beach>
Check with scymtym.
esb has quit [Remote host closed the connection]
<Guest74>
midnight is too late to do AoC. I kept reading part two wrong and kept reading the figure horizontally instead of vertically.
<attila_lendvai>
hrm, nyxt looks interesting. are many CL people using it?
LoopMacro has quit [Ping timeout: 256 seconds]
johnjay has quit [Quit: WeeChat 3.3]
<etimmons>
pve: Thanks! Looks like you pull tricks similar to reader-interception. And even avoid the bug reader-interception fell in to!
<etimmons>
pve: You wight want to also consider a WITH-ECLECTOR macro, so that any LOADs within its body automatically get the Eclector reader. So that a file can use it without needing to call ENABLE
<etimmons>
It never returned (VALUES) from its reader macro function
<pve>
oh right
Alfr is now known as Guest3612
Alfr has joined #commonlisp
Cymew has quit [Ping timeout: 252 seconds]
<pve>
etimmons: I wonder what would break if I enabled a client globally at startup (e.g. in .sbclrc) that translates all occurrences of cl:load to "my-load"..
Cymew has joined #commonlisp
Guest3612 has quit [Ping timeout: 252 seconds]
<jcowan>
Probably a good thing to do after writing a long and difficult (to write, not to read!) programming book.
<jcowan>
(take a sabbatical, I mean)
<etimmons>
pve: Hmmm. Only one way to find out! But You might have trouble making it happen. I think SBCL LOADs .sbclrc, so *READTABLE* is bound. You'd probably have to actually mutate the standard read table, which sounds scary
<jcowan>
On Unicode:
<jcowan>
Supporting Unicode does not mean supporting every Unicode character.
<jcowan>
Unicode already defines what "alphanumeric" means, though it does not include APL symbols.
<jackdaniel>
unicode is a terrible mess, second only to previous situation with gazzilions of incompatible encodings
* jcowan
notes similar remarks about democracy
tyson2 has quit [Remote host closed the connection]
Oladon has joined #commonlisp
<pve>
etimmons: oh, I was under the impression that sbcl does read-eval or something on .sbclrc, and not load
<jcowan>
Some of the complexity is accidental or historical-only, but most of it is essential complexity: writing systems are complex, end of.
Alfr has quit [Quit: Leaving]
<etimmons>
pve: Huh. A quick glance makes it look like a hybrid...
ec_ has joined #commonlisp
<etimmons>
pve: pathname and truename are bound, but not readtable or package
<pve>
anyway, I guess stuff like (find-symbol "LOAD" :cl) would slip through :)
Guest74 has quit [Quit: Connection closed]
Cymew has quit [Ping timeout: 252 seconds]
kennyd has joined #commonlisp
<etimmons>
Naaaah, just replace FIND-SYMBOL and INTERN as well!
epolanski has quit [Quit: Connection closed for inactivity]
karlosz has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
varjag has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
Oladon has quit [Quit: Leaving.]
lisp123 has joined #commonlisp
Inline has joined #commonlisp
kevingal has quit [Remote host closed the connection]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
karlosz has quit [Quit: karlosz]
<phantomics>
jcowan: took a look at the document, the criteria there look good in terms of categorization, the alphabetical and numeric Unicode categories are a bit more expansive that what SBCL has
treflip has quit [Quit: good night]
<jcowan>
phantomics: Thanks
<phantomics>
Mainly I see that they include the "number letter" categories that SBCL doesn't, APL characters definitely shouldn't be included, there's something weird with Allegro's system
tyson2 has quit [Remote host closed the connection]
alvaro121_ has joined #commonlisp
alvaro121 has quit [Ping timeout: 240 seconds]
Guest74 has joined #commonlisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
<contrapunctus>
attila_lendvai: is this your site? http://dwim.hu/ You may want to serve JS over HTTPS, and update that Freenode link to libera.chat...
<attila_lendvai>
contrapunctus, thanks for the headsup. that site is somewhat... well, abandoned. there's plenty of potentially useful features that should be fixed/finished, but we're not working much in CL anymore.
<contrapunctus>
A pity 🙁️
* Xach
forces attila_lendvai to work on CL from time to time
<attila_lendvai>
:) heh, right, when Xach notifies me of the breakage, then i fix our libs up to the point where they compile and run the dwim.hu code
<Xach>
attila_lendvai: i appreciate it - but if it becomes too much of a bother, please let me know.
<attila_lendvai>
Xach, no, not at all! i always have the option to not react, so please keep me posted! and thanks for all the work on ql!
<Xach>
A reaction is always good, even if it is "stop bothering me"
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
cosimone has quit [Read error: Connection reset by peer]
<attila_lendvai>
Xach, i'll communicate that, don't worry. it already feels it was a waste what went into writing all the hu.dwim libs. i don't want to let them bitrot, maybe there are some users out there.
Algernon666 has quit [Ping timeout: 252 seconds]
waleee has joined #commonlisp
ec_ has quit [Ping timeout: 276 seconds]
ec_ has joined #commonlisp
igemnace has quit [Ping timeout: 256 seconds]
<pve>
attila_lendvai: Any highlights in those libs you feel we should know about? (I'm not familiar with them)
karlosz has joined #commonlisp
<attila_lendvai>
pve, hu.dwim.perec is a rather nice ORM. it has a query compiler that compiles queries given in sexp form to SQL, and when it cannot do that, then it transparently runs it in the lisp VM. it can even compile parts of the query to SQL, and run a hybrid lisp+SQL query
<attila_lendvai>
hu.dwim.web-server is reasonable
<rotateq>
ah nice
<pve>
attila_lendvai: cool, I was just thinking about how to ORM the other day
<attila_lendvai>
hu.dwim.stefil is i think by far the best unit test lib (simply wraps defun to ensure a dynamic environment, but tests are otherwise defun's. very nice experience in slime.)
<attila_lendvai>
there are all kinds of little utils, like hu.dwim.defclass-star to make defclass less verbose
lisp123 has quit [Remote host closed the connection]
* rotateq
still likes the power of property testing
<attila_lendvai>
hu.dwim.computed-class is a functional reactive programming lib that makes class slots reactive (they get automatically recalculated as needed)
<jcowan>
attila_lendvai: Do you have a writeup (other than the source) of the sexp-to-SQL mapping? It's a hard problem.
<rotateq>
sounds good for UI stuff
<attila_lendvai>
hu.dwim.reiterate is an 80% iterate replacement, but it's much better. it uses a proper walker, hu.dwim.walker.
<rotateq>
jcowan: and then the question for which SQL standard :)
<attila_lendvai>
rotateq, we used it on postgresql. another groups used it with oracle, but they made quite some changes. the merging is a pending TODO... for the last several years.
<attila_lendvai>
s/groups/group/
<pve>
attila_lendvai: thanks for the intro, I'll check out perec at least
<rotateq>
attila_lendvai: cool also a lib for lazy evaluation :) read yesterday that Simon Peyton-Jones had his last day at the MS research group
<attila_lendvai>
pve, i suggest getting it from ql because the darcs HEAD contains half baked stuff. or the LIVE darcs repo from dwim.hu... but you're better off with ql.
<rotateq>
the SQL stuff is also something i want to look into
<pve>
attila_lendvai: ok, will do
<pve>
because as usual, I was contemplating rolling my own, but I'm not sure that's a good idea :)
<random-nick>
does hu.dwim.computed-class do things differently from the cells library?
<attila_lendvai>
hu.dwim.lazy-eval is closer to a proof of concept. but we used it in live code. authorization in our web ui was done so that a large form was constructed, and then it got lazy-eval'd, and then automagically evaluated at each point where it was needed. we could even generate english doc from who can do what in the system, and the rules were of course editable
<attila_lendvai>
jcowan, i know... :/ something broke with the entry point a few years ago. navigating from the dwim.hu menu works, but most project has little useful data. (the UI is constructed based on metadata)
<attila_lendvai>
to be honest, i'm surprised it's still this functional after some 10 years of potential bitrot.
* jcowan
nods
VincentV` has joined #commonlisp
tyson2 has joined #commonlisp
karlosz has quit [Quit: karlosz]
VincentVega has quit [Ping timeout: 252 seconds]
lisp123 has joined #commonlisp
rain3 has quit [Remote host closed the connection]
<Guest74>
anybody know why slime occassionaly starts indenting forms when trying to use autocomplete? It's pushing my stuff to the end of the screen.
<lisp123>
Guest74: Never saw that before. Try C-h m and see if you have any indent minor modes active
<lisp123>
I have Electric-Indent, but perhaps you have something else which may be conflicting with slime
<lisp123>
Also try #Emacs, there used to be a command / way to debug more estoric issues in Emacs, they might be able to help tell you how to
<Guest74>
nope. It does it occasionaly to random indents.
<Guest74>
random indententations across sessions, stays pretty constant in same session, might increase.
osp has quit [Quit: Leaving]
<lisp123>
I see. Sounds annoying, but unfortunately I haven't faced that yet so dunno what could be the cause
cage has quit [Ping timeout: 252 seconds]
varjag has quit [Ping timeout: 256 seconds]
mfiano has joined #commonlisp
theothornhill has joined #commonlisp
mfiano has quit [Client Quit]
lisp123 has quit [Remote host closed the connection]
mfiano has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
cage has joined #commonlisp
<Guest74>
oh well, finally got drakma to download AoC inputs.
varjag has joined #commonlisp
theothornhill has quit [Remote host closed the connection]
Fare has quit [Ping timeout: 256 seconds]
Fare has joined #commonlisp
Fare has quit [Ping timeout: 252 seconds]
sjl has quit [Quit: WeeChat 2.2-dev]
sjl has joined #commonlisp
cosimone has joined #commonlisp
VincentV` has left #commonlisp [ERC (IRC client for Emacs 27.2)]
<pjb>
the function count-positive should clearly count the positive reals in the sequence…
yewscion has quit [Quit: Connection closed]
<pjb>
dre: there was no link in a comment to the specifications, so I guessed that the file only contained integers, and that you didn't really want to just take the first integer on each line.
<pjb>
just using read should be faster than read-line + parse-integer, if the file is well formed.
kennyd has quit [Quit: CGI:IRC (Session timeout)]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<Guest74>
pjb: that's not doing the same thing.
aartaka has quit [Ping timeout: 252 seconds]
Algernon666 has joined #commonlisp
Algernon91 has joined #commonlisp
<hayley>
jcowan: Sharing, mutability, or both and insanity, pick one.
<hayley>
I guess displaced arrays count as the last one...
gpiero_ is now known as gpiero
Lycurgus has joined #commonlisp
Algernon666 has quit [Ping timeout: 250 seconds]
varjag has quit [Ping timeout: 256 seconds]
shka has quit [Ping timeout: 252 seconds]
<dre>
pjb, yeah that's not doing the same thing
<dre>
this is for AoC day 1 part 2 puzzle
<dre>
sorry my code is a little unreadable lol
<dre>
it should be "count increases" i guess. it's counting the number of increases from the nth value to the nth + 3 value
<dre>
tomorrow will be a better day
<pjb>
hence the importance of choosing names carefully.
<rotateq>
"which of your CARs is that now?" "oh, it's my nth"
gaqwas has quit [Ping timeout: 256 seconds]
<Guest74>
dre: I made the same 'mistake'. It makes not sense to use an if to transform a T or Nil to 1 or 0 to sum the count when you can just (COUNT T list)
Algernon91 has quit [Ping timeout: 252 seconds]
<Guest74>
I still think my favourite for part 2 is (COUNT T (MAPCAR #'< list (CDDDR list)))
Guest74 has quit [Quit: Connection closed]
* jasom
feels a bit embarassed to not have thought of that one
<jasom>
I did observe that (A + B + C) < (B + C + D) ≡ A < D though
<pdietz>
< is not guaranteed to return T for true, although in most (all?) CL implementations it does.