libera/#commonlisp - IRC Chatlog
Search
0:25:01
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
0:27:01
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
0:27:37
kagevf
I use emacs for CL and org mode, and vim (or something with a vim plugin) for everything else ... it works out alright
0:28:49
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
0:30:14
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)
0:31:20
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.
0:31:38
pjb
dre: I used vi a long time ago, on A/UX. Then I switched to NeXTstep and emacs. It's possible!
0:32:46
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
0:32:54
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
0:34:14
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
0:35:12
dre
my only real issue is that python support on emacs seems to be a bit sub-par? or atleast the LSP support.
0:55:38
GreaseMonkey
someone mentioned VLIME earlier... my experience is it has a nasty habit of forgetting how to indent Lisp code
0:56:35
GreaseMonkey
if it weren't for that it'd be fine, but nope, that bug renders the whole damn thing unusable
1:00:42
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
1:42:12
LoopMacro
Recommendations on a unit test framework? I used LISP-UNIT a few years ago. Others I should consider?
1:43:08
hayley
I usually use Parachute. But there is still no feature that has it print "Where we dropping, fellas" before running tests.
1:46:41
LoopMacro
Much appreciated. I see a new one called ROVE, but don't yet know anything about it.
1:49:56
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.
1:52:18
stylewarning
But i've been using FIASCO for 6-ish years now so maybe some cooler things exist
1:52:20
jeosol
stylewarning: thanks, no need to apologize; I was just confused by the sequence of messages
1:52:57
jeosol
but not in a full CI/CD workflow, just running simple system level tests. I will like to get to the former
1:53:35
LoopMacro
In the summary of the link I posted, the author lists Parachute, Fiasco and LispUnit2 as #1, #2, and #3, respectively.
1:59:06
stylewarning
Not as cool as I thought it might look. https://usercontent.irccloud-cdn.com/file/7TNLrpkM/1638323934.JPG
2:01:00
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
2:01:33
stylewarning
Line 5674 is pretty marvelous https://usercontent.irccloud-cdn.com/file/yd6hMVkP/1638324077.JPG
2:02:57
phantomics
I just discovered how inconsistent (alphanumericp) is between implementations, they have widely varying ideas of what an alphanumeric char is
2:03:24
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)
2:04:26
phantomics
The lengths for different implementations are SBCL : 49088 CCL : 48391 ECL : 48757 ABCL : 49142 Allegro : 65438 LW : 124
2:05:01
phantomics
Allegro counts practically everything in UTF-8 as alphanumeric, the exceptions are mostly just characters on the keyboard: !, &, > etc.
2:05:59
phantomics
Meanwhile in LW, only these chars count: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
4:04:16
beach
What is the "UTF-8 range"? UTF-8 is an seconding that maps Unicode code points to byte streams.
4:09:33
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
4:10:04
hayley
The JVM uses surrogate(?) code points to support the rest of the Unicode code points.
4:10:56
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
4:11:49
hayley
It appears SBCL uses "UCD general categories" to determine if something is alphanumeric.
4:12:09
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)
4:14:38
phantomics
Didn't know that, why does it require 3 bytes? It appears 2 is all that's needed to store those codes
4:15:37
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.
4:16:40
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
4:16:50
hayley
UTF-8 takes additional bits to represent the length of a character, as a character is represented by a variable number of bytes.
4:17:26
phantomics
If you saw the numbers above, different CLs consider widely varying numbers of characters to be "alphanumeric"
4:17:43
hayley
...and subsequent bytes are tagged as "continuation" bytes, so that one cannot parse rubbish if they start in the middle of a character.
4:25:40
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
4:27:21
beach
You could format your suggestion as a WSCL issue if you like, but I think it is probably outside the scope of WSCL.
4:34:25
_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
4:34:54
beach
phantomics: We already have other proposals that are great and still outside the scope of WSCL, like Bike's memory model.
4:35:31
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
4:35:47
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.
4:38:57
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
4:41:09
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
4:41:09
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.
4:42:14
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
4:42:23
semz
although many big programs just set the locale to something like "C" because C's locales are capital A awful
4:44:51
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
4:45:12
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.
4:50:35
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 ::
4:53:04
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.
4:54:13
etimmons
I think they're fixable, but if someone's already got a method that works I'd like to switch over to it.
4:54:59
beach
We should encourage Common Lisp implementations to have something like a *READER* special variable.
4:57:32
etimmons
But what attracted me to reader-interception is that it should work for COMPILE-FILE as well
5:04:11
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.
5:09:18
etimmons
I think an ELS paper would be great. I certainly wish I knew about it before I did.
6:19:12
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
6:38:53
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))))
7:08:41
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
7:17:02
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.
7:25:32
beach
It is not about semantics. It's about the message you send to the person reading your code.
7:28:30
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.
7:29:02
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.
7:31:11
dre
well when I think plus I think of the action, compared to 'positive' which would be an adjective
7:32:11
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.
7:35:15
dre
https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrl3xc/?utm_source=reddit&utm_medium=web2x&context=3
7:35:50
dre
countif / mapcar was what I was originally trying before getting stuck in that loop business.
7:37:33
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.
7:38:57
stylewarning
In case you're interested in the Coalton solution for AoC 1: https://github.com/stylewarning/aoc/blob/main/2021/1/1.lisp
7:40:07
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
7:44:47
_death
stylewarning: why not have a coalton-load that evaluates forms in coalton-toplevel context? (can also have a coalton-compile-file)
7:45:32
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 :[
8:02:04
kennyd
I wonder if it would it be possible to get similar currying working in plain CL, with a custom progn-like macro
8:08:18
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
8:09:32
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
9:20:12
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
10:13:18
beach
kakuhen: I think it depends on the implementation whether a method on validate-superclass is needed.
10:52:32
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?
10:54:42
hayley
(flet ((sum (xs) (reduce #'+ xs))) (mapcar #'sum '((1 2 3) (4 5 6)))) is the best I can think of.
11:00:05
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
11:08:20
Krystof
how often do you think generating a list of list sums happens, that there should be a standard function for this?
11:09:01
Krystof
supplementary question: if there were a standard function for this, what would its name be?
11:21:10
semz
but for string concatenation, it's mildly annoying that there is no variant that takes a sequence
11:27:34
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
11:31:40
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
11:38:32
scymtym_
etimmons: i'm not aware of anyone hooking Eclector into CL:LOAD. what's the use case?
11:38:33
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.
11:44:28
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
12:16:48
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
12:16:49
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.
12:21:34
akater[m]
&rest is more handy in very simple cases and conses less, unless the multidimensional-oriented approach implements fusion.
12:22:35
hayley
ACTION thinks petalisp:lazy-reduce or petalisp:lazy-reduce* takes a dimension (RIP petalisp:β)