phoe changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
wyrd has quit [Remote host closed the connection]
<yottabyte> should I use fset:equal? instead of equalp for fset:set equality? both appear to work
waleee has quit [Ping timeout: 250 seconds]
karmichammer has joined #commonlisp
waleee has joined #commonlisp
wyrd has joined #commonlisp
karmichammer has quit [Ping timeout: 240 seconds]
tyson2 has joined #commonlisp
mon_aaraj has quit [Ping timeout: 250 seconds]
mon_aaraj has joined #commonlisp
karmichammer has joined #commonlisp
waleee has quit [Quit: WeeChat 3.4]
karmichammer has quit [Ping timeout: 256 seconds]
morganw has quit [Remote host closed the connection]
waleee has joined #commonlisp
random-nick has quit [Ping timeout: 250 seconds]
jeosol has joined #commonlisp
karmichammer has joined #commonlisp
nij- has joined #commonlisp
akoana has joined #commonlisp
karmichammer has quit [Ping timeout: 240 seconds]
samps has quit [Ping timeout: 240 seconds]
s-liao has joined #commonlisp
Oladon has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
xsperry has quit [Remote host closed the connection]
karmichammer has joined #commonlisp
nij- has quit [Quit: #guix]
s-liao has quit [Ping timeout: 256 seconds]
karmichammer has quit [Ping timeout: 240 seconds]
scymtym has joined #commonlisp
xsperry has joined #commonlisp
samps has joined #commonlisp
pmwals09 has joined #commonlisp
karmichammer has joined #commonlisp
jealousmonk has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
epony has quit [Ping timeout: 240 seconds]
akoana has quit [Quit: leaving]
dec0d3r has quit [Quit: Leaving]
Catie has quit [Quit: good night my friends]
Jing has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
_73 has left #commonlisp [ERC 5.4 (IRC client for GNU Emacs 28.0.90)]
russe has joined #commonlisp
karmichammer has joined #commonlisp
EsoAlgo has joined #commonlisp
s-liao has joined #commonlisp
samps has quit [Ping timeout: 256 seconds]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #commonlisp
karmichammer has quit [Ping timeout: 240 seconds]
<beach> Good morning everyone!
s-liao has quit [Ping timeout: 256 seconds]
tyson2 has quit [Remote host closed the connection]
Bike has quit [Quit: Lost terminal]
Oladon has quit [Quit: Leaving.]
<lispy> morning beach
luis9 has joined #commonlisp
luis has quit [Ping timeout: 250 seconds]
luis9 is now known as luis
pmwals09 has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 250 seconds]
lispy has quit [Quit: O/]
samps has joined #commonlisp
user__ has joined #commonlisp
semz_ has quit [Ping timeout: 250 seconds]
karmichammer has joined #commonlisp
s-liao has joined #commonlisp
karmichammer has quit [Ping timeout: 268 seconds]
epony has joined #commonlisp
samps has quit [Ping timeout: 240 seconds]
s-liao has quit [Ping timeout: 256 seconds]
user__ is now known as semz
s-liao has joined #commonlisp
jealousmonk has quit [Quit: ERC (IRC client for Emacs 27.1)]
aartaka has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
Inline__ has joined #commonlisp
tyson2 has joined #commonlisp
EsoAlgo3 has joined #commonlisp
frodef_ has joined #commonlisp
scymtym_ has joined #commonlisp
form_fee- has joined #commonlisp
<remexre> is there a library for representing sets as sorted vectors?
leo_song has joined #commonlisp
jdz_ has joined #commonlisp
xantoz_ has joined #commonlisp
<beach> remexre: Sets are tricky things. There is really no abstract data type called a "set" because it is impossible to have all set operations be efficient simultaneously. That is why every abstract data type that contains other objects is defined by the operations that are supported. If you give us the operations you like, perhaps we can help.
<beach> remexre: But in general, such a representation would not allow for many operations to be efficient.
<remexre> small sets of strings, I want fast intersection, union, and emptyp
<beach> If they are small, then just concatenate and sort for union.
<moon-child> remexre: why not use a hash table?
<moon-child> sorted vector gives you binary search if you care for it, but no in-place intersection or union
<remexre> moon-child: I thought there was a "two-finger" O(n) intersection
<beach> remexre: For intersection, convert to lists, do the intersection, convert to a vector, sort.
<remexre> and if I'm fine with excess capacity + a fill pointer, union is O(n)
<beach> remexre: It won't matter if the sets are small.
<remexre> yeah, and that's where vectors would be a win, right? b/c of cache effects?
EsoAlgo has quit [*.net *.split]
russe has quit [*.net *.split]
scymtym has quit [*.net *.split]
Inline has quit [*.net *.split]
mzan has quit [*.net *.split]
frodef has quit [*.net *.split]
phantomics has quit [*.net *.split]
fitzsim has quit [*.net *.split]
amk has quit [*.net *.split]
iamFIREc1 has quit [*.net *.split]
xantoz has quit [*.net *.split]
hineios has quit [*.net *.split]
dstein64 has quit [*.net *.split]
ski has quit [*.net *.split]
les_ has quit [*.net *.split]
joast has quit [*.net *.split]
jdz has quit [*.net *.split]
TMA has quit [*.net *.split]
leo_song_ has quit [*.net *.split]
hubvu_ has quit [*.net *.split]
form_feed has quit [*.net *.split]
materialfuture has quit [*.net *.split]
skyl4rk has quit [*.net *.split]
<beach> That sounds like premature micro-optimization without any measure to determine whether it is necessary.
<beach> remexre: You are comparing cache effects and asymptotic complexity. They are not the same order of magnitude.
<beach> remexre: My guess is that you are going to spend all the time comparing characters in strings anyway.
EsoAlgo3 is now known as EsoAlgo
<moon-child> beach: 'For intersection, convert to lists, do the intersection, convert to a vector, sort' hmm? If you were using such a representation--and you cared for performance--you could do it in O(m+n) by iterating over both vectors and VECTOR-PUSH-EXTENDing a result
<moon-child> (and if you don't care for performance, just use a list and don't bother with anything else)
<beach> It won't matter if the sets are small.
<remexre> the point with the asymptotics was that they're not terrible; not ruining the cache by using vectors was more of the point
<moon-child> indeed. Hence 'don't bother with anything else' (including sorting)
<beach> moon-child: You can't use a list if the prerequisite is to use a vector.
<moon-child> sure. I think the problem is insufficiently motivated/contextualized. If it's desirable for some reason to use a vector in the first reason, that same reason may also make it undesirable to use an intermediate list (which was your suggestion)
<beach> moon-child: And you can't not sort if the prerequisite is to use sorted vectors.
<beach> moon-child: Oh, totally.
<moon-child> given two sorted vectors, you can produce a sorted intersection vector in linear time, without consing an intermediate list and calling SORT on it
<beach> But it won't matter if the sets are small.
<moon-child> yes. And if it doesn't matter then you can just use lists. We are going in circles :P
amk has joined #commonlisp
russe has joined #commonlisp
ski has joined #commonlisp
mzan has joined #commonlisp
hineios has joined #commonlisp
dstein64 has joined #commonlisp
les_ has joined #commonlisp
TMA has joined #commonlisp
hubvu_ has joined #commonlisp
materialfuture has joined #commonlisp
skyl4rk has joined #commonlisp
iamFIREc1 has joined #commonlisp
<beach> moon-child: You can't use a list if the prerequisite is to use a vector. :)
phantomics has joined #commonlisp
<moon-child> remexre: can you motivate your problem? Do you have set-processing code which is slow?
<remexre> no, I'm planning on writing code that I don't want to go back and change the set representation for
<moon-child> I see
<moon-child> if your interface is properly abstracted, it should not be prohibitively difficult to change your representation
bollu has quit [Quit: Ping timeout (120 seconds)]
<remexre> right, but i know the representation I want, and I would be surprised if I needed to change *from* that later
bollu has joined #commonlisp
karmichammer has joined #commonlisp
artchad has joined #commonlisp
karmichammer has quit [Ping timeout: 260 seconds]
tyson2 has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 240 seconds]
aartaka has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
s-liao has quit [Ping timeout: 256 seconds]
s-liao has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
Cymew has joined #commonlisp
occ has joined #commonlisp
iamFIREc1 has quit [Ping timeout: 256 seconds]
<qhong> Any reason for not just using `fset'?
EsoAlgo has quit [Ping timeout: 268 seconds]
karmichammer has joined #commonlisp
pve has joined #commonlisp
artchad has quit [Read error: Connection reset by peer]
karmichammer has quit [Ping timeout: 250 seconds]
rain3 has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
Guest6655 has quit [Quit: Lost terminal]
Major_Biscuit has joined #commonlisp
jasom has quit [Ping timeout: 245 seconds]
Algernon69 has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
attila_lendvai has joined #commonlisp
jasom has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
jasom has quit [Ping timeout: 250 seconds]
varjag has joined #commonlisp
karmichammer 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]
karlosz_ has joined #commonlisp
amb007 has joined #commonlisp
karmichammer has quit [Ping timeout: 250 seconds]
jasom has joined #commonlisp
OlCe has joined #commonlisp
euandreh has quit [Ping timeout: 240 seconds]
euandreh has joined #commonlisp
OlCe has quit [Remote host closed the connection]
Dynom has joined #commonlisp
s-liao has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 260 seconds]
kevingal has joined #commonlisp
occ has quit [Ping timeout: 250 seconds]
euandreh has quit [Ping timeout: 250 seconds]
euandreh has joined #commonlisp
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 240 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
OlCe has joined #commonlisp
OlCe has quit [Remote host closed the connection]
kevingal has quit [Ping timeout: 240 seconds]
kevingal has joined #commonlisp
karmichammer has joined #commonlisp
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mgl has joined #commonlisp
Jing has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
shka has joined #commonlisp
OlCe has joined #commonlisp
karlosz_ has quit [Quit: karlosz_]
shozo has joined #commonlisp
cage has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 252 seconds]
Lord_of_Life_ is now known as Lord_of_Life
karmichammer has quit [Ping timeout: 250 seconds]
<neominimum> Anyone have a more elegant solution to finding the first element of a list and all sub-lists than what I have managed to hack together? https://pastebin.com/raw/6W6ppPTb
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
attila_lendvai_ has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
karmichammer has joined #commonlisp
mon_aaraj has joined #commonlisp
s-liao has quit [Ping timeout: 256 seconds]
<flip214> We've got a CI/CD pipeline for Alexandria now. Are there volunteers for finding out why some implementations disagree with the majority? https://gitlab.common-lisp.net/alexandria/alexandria/-/jobs shows 4 of 8 failing (in overlapping sets of tests).
karmichammer has quit [Ping timeout: 250 seconds]
cosimone has joined #commonlisp
karmichammer has joined #commonlisp
cosimone has quit [Read error: Connection reset by peer]
cosimone has joined #commonlisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
<phoe> flip214: you have found bugs in ABCL!
<phoe> according to ABCL, (ALEXANDRIA:TYPE= (QUOTE LIST) (QUOTE (OR NULL CONS))) ;=> NIL T
<phoe> same story with (ALEXANDRIA:TYPE= (QUOTE NULL) (QUOTE (AND SYMBOL LIST)))
* phoe makes an abcl ticket
amb007 has quit [Read error: Connection reset by peer]
notzmv has quit [Ping timeout: 250 seconds]
amb007 has joined #commonlisp
<phoe> flip214: regarding CLISP, (+ 0.0 #C(0 2)) ;-> #C(0.0 2)
karmichammer has quit [Ping timeout: 256 seconds]
<phoe> I have no idea if this is conforming, because the complex number has different types for realpart and imagpart
<phoe> no idea about cmucl and allegro - cmucl complains about some undefined function, which is weird, and acl has some type failures as well as a copy-hash-table failure
* phoe runs off for work
Algernon69 has quit [Ping timeout: 250 seconds]
amb007 has quit [Ping timeout: 240 seconds]
<flip214> phoe: (EQUAL #C(0.0 0.0) 0.0) -- That's what my testing branch shows as difference. Looks like clisp doesn't see them as EQL...
amb007 has joined #commonlisp
notzmv has joined #commonlisp
<phoe> oh, #C(0.0 0.0) doesn't decay into 0.0
<phoe> that's a conformance bug AFAIK
<phoe> clhs 12.1.5.3
<specbot> Rule of Canonical Representation for Complex Rationals: http://www.lispworks.com/reference/HyperSpec/Body/12_aec.htm
<phoe> actually it isn't a conformance bug
<phoe> if I am reading this correctly, if their parts are floats, then they are not meant to be EQL
karmichammer has joined #commonlisp
attila_lendvai_ is now known as attila_lendvai
random-nick has joined #commonlisp
<flip214> phoe: I pushed a workaround - starting with #c(0.0 0.0) should make it work
samps has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
<pjb> phoe: #C(0.0 0.0) cannot decay into 0.0, because 0.0 is not 0.0, but 0.0±ε
<phoe> pjb: yes
<flip214> phoe: https://gitlab.common-lisp.net/alexandria/alexandria/-/jobs/27975 (allegro) has the same subtypep problems
<flip214> pjb: but 4 implementations agree that (EQL #C(0.0 0.0) 0.0)
<flip214> http://www.lispworks.com/documentation/HyperSpec/Body/f_eql.htm#eql says " If an implementation supports positive and negative zeros as distinct values, then (eql 0.0 -0.0) returns false. Otherwise, when the syntax -0.0 is read it is interpreted as the value 0.0, and so (eql 0.0 -0.0) returns true."
<pjb> flip214: Nope, https://termbin.com/txqo you're confusing EQL and =.
<pjb> #C(0.0 0.0) cannot be eql to 0.0, since it's 0.0±ε + 0.0±ε * i
Algernon69 has joined #commonlisp
<flip214> pjb: I don't understand where you get the ε from - the zero can be expressed exactly (though perhaps non-unique because of ±), and so 0.0 == 0.0??
<pjb> flip214: it's because floating points are used to represent real numbers.
<flip214> https://gitlab.common-lisp.net/alexandria/alexandria/-/pipelines/5874 shows that 4 implementations were okay with (EQUAL #C(0.0 0.0) 0.0)
<pjb> All floating points are exact. But they represent a range of real numbers.
<pjb> flip214: yes, EQUAL uses = for numbers.
<pjb> = performs the range comparison.
<pjb> double-float-epsilon #| --> 1.1102230246251568D-16 |#
<flip214> pjb: http://www.lispworks.com/documentation/HyperSpec/Body/f_eql.htm#eql has the example (eql 3.0 3.0) => true
<flip214> http://www.lispworks.com/documentation/HyperSpec/Body/f_equal.htm says if they are numbers that are eql,
s-liao has joined #commonlisp
<pjb> This is precised in the Note: Two complex numbers are considered to be eql if their real parts are eql and their imaginary parts are eql. For example, (eql #C(4 5) #C(4 5)) is true and (eql #C(4 5) #C(4.0 5.0)) is false. Note that while (eql #C(5.0 0.0) 5.0) is false, (eql #C(5 0) 5) is true. In the case of (eql #C(5.0 0.0) 5.0) the two arguments are of different types, and so cannot satisfy eql. In the case of (eql #C(5 0) 5), #C(5 0)
<pjb> is not a complex number, but is automatically reduced to the integer 5.
karmichammer has joined #commonlisp
<beach> neominimum: You omitted (1 2 3).
amb007 has quit [Ping timeout: 240 seconds]
<beach> neominimum: And FORM is a bad name for the parameter.
amb007 has joined #commonlisp
tyson2 has joined #commonlisp
<neominimum> beach: ah yes, that was intentional. removing `(atom (caar form))` prints (1 2 3)
<yitzi> Hello beach. How are things?
<beach> yitzi: Very busy still. ELS paper deadline is Sunday.
<beach> neominimum: The form (and root (print (car form))) is better written as (when root (print (car form)))
<yitzi> beach: gotcha. Hope it goes well!
<beach> neominimum: AND should be used only to return Boolean values.
karmichammer has quit [Ping timeout: 256 seconds]
<beach> yitzi: Thanks. It has been a very busy week, mostly with uninteresting tasks.
<beach> yitzi: What about you?
amb007 has quit [Read error: Connection reset by peer]
mgl has quit [Quit: Client closed]
amb007 has joined #commonlisp
<neominimum> beach: alright, using when there looks better
<beach> neominimum: I also don't understand what ROOT is there for. It is only true for the top-level expression.
<neominimum> beach: Yeah,
<neominimum> I was going to bring that up
<yitzi> beach: Lots of non-interesting real life distractions. Trying to get back into the groove though. I am still seeing that SICL issue I mentioned about a month ago, but I made some progress on isolating it. I'll bug you when I have something useful and you have time. :)
<neominimum> I was stumped trying to print the root of the tree in the same recursive function that returns the first elements of all sub-lists
<beach> neominimum: And I think (and form (listp form)) is just (consp form) which has the additional advantage of not using arbitrary lists as Boolean values.
<beach> yitzi: I understand.
<neominimum> beach: The optional root parameter seems hacky to me as well
OlCe has quit [Ping timeout: 240 seconds]
<beach> neominimum: Also, it would be better to return a list of the objects you want, rather than printing them. That way, client code can print them, or do something else with them. Right now, they are useless.
artchad has joined #commonlisp
<neominimum> beach: sure, I was only printing them so that I could tell that the appropriate elements were being isolated.
<beach> neominimum: And I think you should be able to have the base case of the recursion be simpler.
<beach> So I don't understand why you omitted (1 2 3) because that was not part of your specification.
<beach> Is the specification to "return/print the first element of each sublist, provided it is an atom"?
<beach> Er, "return/print the first element of each non-empty sublist, provided that element is an atom"
<neominimum> beach: yes that's correct I should have been more specific
karmichammer has joined #commonlisp
<beach> The recursion on the CDR is fundamentally different from the recursion on the CAR it seems. So I would either use different functions for the two, or use LOOP instead of recursion on the CDR.
occ has joined #commonlisp
<neominimum> beach: okay thanks, I'm trying your suggestions
karmichammer has quit [Ping timeout: 245 seconds]
<beach> (defun tt (thing) (if (atom thing) '() (append (if (atom (car thing)) (list (car thing)) '()) (loop for element in thing append (tt thing)))))
<beach> Something like that.
<neominimum> Oh nice, thanks beach for the example. It's good to see how you approach the solution.
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 268 seconds]
karmichammer has joined #commonlisp
<beach> Pleasure.
karmichammer has quit [Ping timeout: 240 seconds]
pranavats has joined #commonlisp
samps has quit [Ping timeout: 256 seconds]
kevingal has quit [Ping timeout: 250 seconds]
nij- has joined #commonlisp
kevingal has joined #commonlisp
attila_lendvai has quit [Ping timeout: 250 seconds]
dim has quit [Remote host closed the connection]
karmichammer has joined #commonlisp
karmichammer has quit [Ping timeout: 256 seconds]
samps has joined #commonlisp
fitzsim has joined #commonlisp
Bike has joined #commonlisp
karmichammer has joined #commonlisp
mgl has joined #commonlisp
kevingal has quit [Ping timeout: 256 seconds]
kevingal has joined #commonlisp
OlCe has joined #commonlisp
xsperry has quit []
Josh_2 has joined #commonlisp
kevingal has quit [Ping timeout: 252 seconds]
kevingal has joined #commonlisp
jealousmonk has joined #commonlisp
<lagash> Would anyone know of a Common Lisp ANSI escape codes parser? Not bindings to say Curses or anything like that.
<phoe> lagash: cl-ansi-term?
<phoe> or do you mean something else?
<lagash> phoe: that generates escape codes, so no
OlCe has quit [Ping timeout: 256 seconds]
<phoe> oh, you want to do the inverse
<Josh_2> Hi
<lagash> say, something like converts escape codes to CSS?
<Josh_2> huh
<phoe> CSS? you mean the web styling technology?
<Josh_2> Well if you know the characters you want you can probably knock something together easily using LASS
<phoe> I am curious what's your idea for turning terminal escape codes for something that is meaningfully understandable by browsers - escape codes can include stuff like colors that is trivially CSSable, but also things like query-terminal-size and set-cursor-position
<phoe> I have no idea how much CSS-fu is required to encode this
eddof13 has joined #commonlisp
s-liao has quit [Quit: Client closed]
<lagash> phoe: just the colors, really
<lagash> I suppose the task is rather trivial, I just don't like reinventing the wheel :)
s-liao has joined #commonlisp
s-liao has quit [Client Quit]
<Josh_2> Because you can just use (char-code <char>) you can quickly generate colours for the ascii character codes using LASS
<lagash> Josh_2: pardon, LASS?
<lagash> Oh, right, sounded familiar
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mon_aaraj has quit [Ping timeout: 256 seconds]
<Josh_2> LASS is very cool, I am a big fan
jeosol has quit [Quit: Client closed]
eddof13 has joined #commonlisp
<Josh_2> LASS mixed with spinneret and CLOS beats any templating library
<Josh_2> unless you need some non lisp peasant to read your code and understand it ofc
mon_aaraj has joined #commonlisp
scymtym_ is now known as scymtym
jeosol has joined #commonlisp
xsperry has joined #commonlisp
<lagash> Any other similar projects?
samps has quit [Ping timeout: 252 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waleee has joined #commonlisp
<neominimum> beach: You were right about the CAR and CDR recursion representing different objectives, I didn't fully understand what you meant by that at first, but it clicked and I have something I'm happy with now. https://pastebin.com/raw/bxJxX9wp
<neominimum> I tried to implement something different to your solution as an exercise. It uses recursion still + a simple switch to indicate whether a sub-list has been found before attempting to get the atom at the head of the list.
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
madand has joined #commonlisp
jeosol has quit [Quit: Client closed]
kevingal has quit [Ping timeout: 256 seconds]
kevingal has joined #commonlisp
samps has joined #commonlisp
<beach> neominimum: WHEN should be used only in a context where the value is not needed. If the value is needed, use and IF with an explicit `else' branch.
<beach> neominimum: In this case, your `else' branch would be '().
<beach> Same thing with UNLESS.
OlCe has joined #commonlisp
Inline__ has quit [Quit: Leaving]
<neominimum> Ah okay, I suppose it makes sense to make the return values explicit. Is that what you intended?
<beach> Yes, the message you send to a person reading your code when you use WHEN or UNLESS, is that the body has only side effects, and the value is not used, like in a PROGN when it is not the last form.
samps has quit [Ping timeout: 245 seconds]
<neominimum> that's great, thanks!
<beach> Sure.
dim has joined #commonlisp
<beach> neominimum: You might want to join #clschool. This channel is not really for help with simple stuff, though some amount of that is tolerated.
<neominimum> alright, will do
epolanski has joined #commonlisp
morganw has joined #commonlisp
Guest7475 has joined #commonlisp
Cymew has quit [Ping timeout: 256 seconds]
joast has joined #commonlisp
treflip has joined #commonlisp
ski has quit [Ping timeout: 256 seconds]
aartaka has quit [Ping timeout: 256 seconds]
Fare has joined #commonlisp
aartaka has joined #commonlisp
eddof13 has joined #commonlisp
samps has joined #commonlisp
jeosol has joined #commonlisp
nij- has quit [Remote host closed the connection]
nij- has joined #commonlisp
raeda has quit [Ping timeout: 240 seconds]
waleee has quit [Ping timeout: 250 seconds]
raeda has joined #commonlisp
samps has quit [Quit: Leaving]
mon_aaraj has quit [Ping timeout: 268 seconds]
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
karmichammer has quit [Ping timeout: 256 seconds]
mgl has quit [Quit: Client closed]
mon_aaraj has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
treflip has quit [Remote host closed the connection]
<mzan> neominimum: I'm a newbie too. In CL recursive functions are not used as much as in Haskell. It favours explicit loop/iterate.
<mzan> The CL standard does not guarantee tail call optimizations, so there can be problems for some compilers, if you recurse on a big list.
<beach> More precisely, iteration is preferable on linear structures, because it is more efficient, and with recursion on linear structures, there is a risk to blow the stack.
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mzan> I'm using the "iterate" macro, and I like it a lot. https://common-lisp.net/~loliveira/tmp/iterate-manual/iterate.html#Control-Flow
<beach> Recursion is fine on tree-like structures when the depth is limited to (say) logarithmic.
<mzan> yes
<beach> mzan: I would not recommend an external library over a standard operator to a newbie. It is fine if that's your choice, but I would be more careful with recommending it to others.
<mzan> At least I didn't suggested Haskell :-)
<mzan> or Scheme
<mzan> neominimum: you are using recursion. Use Scheme because it supports tail call recursion directly in the standard :-)
djuber has left #commonlisp [ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
karmichammer has joined #commonlisp
<mzan> beach: in any case I disagree. LOOP is a macro, so it must be studied apart. "Iterate" is a very similar macro, but better. "Iterate" is used a lot, so it is not standard, but for sure not esoteric. It is nearly standard. In case he had to read legacy code, if he knows "iterate" macro, he can understood LOOP macro.
dre has quit [Ping timeout: 240 seconds]
<beach> Of course.
<beach> I mean "of course you disagree".
<_death> some thoughts I had about iterate a while ago https://old.reddit.com/r/adventofcode/comments/e92jm2/2019_day_11_solutions/faht58g/?context=3 ... since then the breaking change was committed btw
masinter has joined #commonlisp
didi has joined #commonlisp
djuber has joined #commonlisp
<mzan> _death: ah ah, funny enough I discovered that if I try to optimize the code with "iterate", SBCL complains because variables like "x1", "x2" in your example can be "nil" and not only "fixnum" or something of similar. But probably there are sane workarounds, and it is also my fault in specifying typing constraints.
<mzan> Your example code is very clear.
<mzan> I like a lot the CL loops.
Algernon91 has joined #commonlisp
<_death> according to its source code iterate existed since 1989, and perhaps made into a library in 2003.. so when a breaking change is introduced in 2021 I think it's a good argument for LOOP
mgl has joined #commonlisp
<mzan> And to be fair, if you "iterate" on an empty data-structure, then the returned "x1" can be nil, and the code must take in account this. So SBCL is right.
<mzan> ah ok, you were "deadh" in the thread, not "oantolin". I will read better, sorry.
eddof13 has joined #commonlisp
Algernon69 has quit [Ping timeout: 252 seconds]
amb007 has quit [Ping timeout: 240 seconds]
karlosz has joined #commonlisp
amb007 has joined #commonlisp
Major_Biscuit has quit [Quit: WeeChat 3.3]
Jing has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<_death> probably beach's point had a different rationale, btw.. a CL newbie should learn to read and write CL proper well before getting too comfortable with (reliant on) external libraries purporting to replace or improve upon some CL counterpart
<mzan> _death: I read better now. Yes. Probably in a perfect world, one should change the version of "iterate" and other macro, every time there is a breaking change. So one can import something like "iterate_v2", and this will not break code using "iterate_v1".
<_death> in a perfect world one would not need to create new versions, since everything would be perfect already ;)
<mzan> LOOP for sure is more stable, because it is part of the standard. And then there are also "mapcar" & C. that are more standards and more direct.
<mzan> Probably a newbie should first exsercise with mapcar & C. Then study LOOP and/or "iterate".
<Alfr> tagbody anyone?
<Bike> considered harmful
<Alfr> The problem with loop is, imho, that it has non-obvious rules regarding clause placement.
<Alfr> s/rules/restrictions/
<didi> Puzzle: How to print "X A\nX B\nX C\n" from (X A B C) using only format? i.e., without transforming (X A B C) into something more suitable. I think, if at all possible, it might involve ~? and ~*.
varjag has joined #commonlisp
<edgar-rft> the only reason why there is no edgar-v2 is because I'm already perfect? probably no...
<Alfr> Bike, just in case someone doesn't like the other constructs.
<mzan> _death: "probably beach's point had a different rationale, btw.. a CL newbie should learn to read and write CL proper". Yes. If one is serious, it should start from the bases, and then build up.
<Alfr> Bike, also many things are considered harmful, and I guess manually writing tagbodies may actually be unhealthy.
<mzan> BTW I studied a little of CL basic (but not too much), and then I started playing with macro and other powerful features, for discovering the funny/powerful parts of CL.
<phoe> hey why is tagbody considered harmful
<ck_> is it?
<edgar-rft> try to tag your body and you'll instantly know
<phoe> Bike did mention it
<Bike> well you see, our intellectual powers are rather geared to master static relations
<ck_> maybe because of go because of goto because of "Dijkstra decreed it"
jmpeax has joined #commonlisp
<Bike> not because dijkstra decreed it, but rather because his reasons make sense. better to use higher level constructs in almost all cases.
jeosol has quit [Quit: Client closed]
<ck_> doesn't PCL use it as an example for how awesome a direct translation of one of Knuths algorithms can be done using tagbody, as a first step for refacoring it
<Bike> 's not like i'd want it removed from the language or anything.
<ck_> yeah was about to say something like that
<Bike> but i wouldn't recommend using it instead of loop or iterate.
<ck_> maybe "harmful" bothers me too much as a descriptor
<mzan> "can be harmful"
<_death> to get better context for Dijkstra, imagine (tagbody <your whole program here, using go to jump around>)
<Bike> the context of dijkstra's paper was that people were regularly using goto when they could have used better control constructs. nowadays that's not really a problem with tagbody
<Bike> yeah
<Bike> people rarely use tagbody, and when they do use it it's for some weird shit that's hard or impossible to express with higher level constructs. like in eclector off the top of my head
karmichammer has quit [Ping timeout: 256 seconds]
<mzan> +1
<didi> (tagbody <your whole ...>) reminds me of an assembly program.
<mzan> (+0.25 because I'm a newbie :-)
treflip has joined #commonlisp
<_death> didi: indeed.. or old time BASIC, which Disjktra also had some thoughts about
<didi> _death: Are your mind damaged forever?
<Bike> dijkstra was also writing when "structured programming" was new, instead of now where it's so basic people don't remember it had to be invented
<didi> s/Are/Is
<_death> didi: only since I learned BASIC I guess.. but I started with LOGO :)
<didi> :-)
<mzan> Between GOTO and structured programming there were...
<mzan> ... GOSUB :-)
eddof13 has quit [Ping timeout: 250 seconds]
<ck_> also COME FROM
<yottabyte> I'm not too knowledgeable about namespaces, but when I quickload a library, how do I add it to my namespace so I don't have to call functions from it with the name? like instead of library:function just call function. I guess this can become a problem if the library contains a function that's already defined in your namespace? but yeah.
<yottabyte> I'm pretty certain that this library doesn't
<didi> Oh, well, I can't solve my format puzzle. I'll transform the argument. /me likes format "puzzles"
<Bike> yottabyte: use-package (or :use specified in your defpackage)
<_death> Bike: aside from tagbody being useful for state machines and such, it may also be useful to expand to in macros..
<yottabyte> so Bike I just did (ql:quickload :arrow-macros)
<Bike> Okay
<Bike> ?
attila_lendvai has joined #commonlisp
<yottabyte> I don't know what you mean
<_death> yottabyte: (defpackage :yottabyte (:use :cl :arrow-macros)) (in-package :yottabyte) (-> "Hello" write-line)
<yottabyte> I see
<didi> Done. Bo-ring.
<_death> in a real program, consider using (:import-from :arrow-macros :->) instead of :use, to explicitly import the symbols you care about
<didi> phoe: Sorry, but what's the name of the library which has literal tabs inside strings again?
karmichammer has joined #commonlisp
kevingal has quit [Remote host closed the connection]
karmichammer has quit [Ping timeout: 256 seconds]
rain3 has quit [Ping timeout: 260 seconds]
z3t05 has joined #commonlisp
Alfr has quit [Killed (erbium.libera.chat (Nickname regained by services))]
Alfr has joined #commonlisp
epolanski has quit [Quit: Connection closed for inactivity]
jgkamat- has joined #commonlisp
Shinmera- has joined #commonlisp
danieli3 has joined #commonlisp
z3t0 has quit [Read error: Connection reset by peer]
jgkamat has quit [Ping timeout: 256 seconds]
contrapunctus has quit [Ping timeout: 256 seconds]
cross has quit [Ping timeout: 256 seconds]
ryanbw has quit [Ping timeout: 256 seconds]
kagevf has quit [Ping timeout: 256 seconds]
aeth has quit [Ping timeout: 256 seconds]
z3t05 is now known as z3t0
kagevf_ has joined #commonlisp
ryanbw has joined #commonlisp
aeth has joined #commonlisp
cross_ has joined #commonlisp
danieli has quit [Ping timeout: 256 seconds]
Shinmera has quit [Ping timeout: 256 seconds]
stack has quit [Ping timeout: 256 seconds]
snits has quit [Ping timeout: 256 seconds]
Shinmera- is now known as Shinmera
snits has joined #commonlisp
karmichammer has joined #commonlisp
stack has joined #commonlisp
danieli3 is now known as danieli
masinter has left #commonlisp [#commonlisp]
masinter has joined #commonlisp
karlosz has quit [Quit: karlosz]
Algernon91 has quit [Read error: Network is unreachable]
karmichammer has quit [Ping timeout: 252 seconds]
attila_lendvai has quit [Ping timeout: 268 seconds]
didi has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
masinter has left #commonlisp [#commonlisp]
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
karmichammer has joined #commonlisp
treflip has quit [Quit: good night!]
tyson2 has quit [Remote host closed the connection]
jasom has quit [Quit: WeeChat 3.1]
jasom has joined #commonlisp
jasom has quit [Client Quit]
perrierjouet has quit [Quit: WeeChat 3.4]
karmichammer has quit [Quit: leaving]
jasom has joined #commonlisp
stack has quit [Killed (NickServ (GHOST command used by stack69!~StackDoub@45-29-51-69.lightspeed.cicril.sbcglobal.net))]
stack1 has joined #commonlisp
aartaka has quit [Ping timeout: 240 seconds]
kevingal has joined #commonlisp
aartaka has joined #commonlisp
waleee has joined #commonlisp
amb007 has joined #commonlisp
<Josh_2> _death: I agree with your sentiments about iterate
kpoeck has joined #commonlisp
mon_aaraj has quit [Ping timeout: 245 seconds]
<pjb> yottabyte: you must read the documentation of the system, to know what packages it defines, and from what package it exports the names of the functions you want to use.
<pjb> yottabyte: note: systems are named by lower case strings such as "foo"; while packages are usually named by uppercase string like "FOO".
mon_aaraj has joined #commonlisp
lispy has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
artchad has quit [Read error: Connection reset by peer]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
aeth has quit [Ping timeout: 252 seconds]
aeth has joined #commonlisp
nij- has left #commonlisp [#commonlisp]
pve has quit [Quit: leaving]
dra has joined #commonlisp
kpoeck has quit [Quit: Client closed]
<phoe> didi: cl-interpol
Dynom has quit [Quit: WeeChat 3.4]
<_death> Josh_2: I actually stopped pulling changes from iterate because some library that used it broke, iirc
Algernon69 has joined #commonlisp
Algernon91 has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
Algernon69 has quit [Ping timeout: 268 seconds]
aeth has quit [Ping timeout: 250 seconds]
aeth has joined #commonlisp
Guest339 has joined #commonlisp
Guest339 has quit [Client Quit]
jeosol has joined #commonlisp
Inline has joined #commonlisp
aeth has quit [Ping timeout: 240 seconds]
Oladon has joined #commonlisp
aeth has joined #commonlisp
tyson2 has joined #commonlisp
Algernon91 has quit [Remote host closed the connection]
Algernon91 has joined #commonlisp
Algernon91 has quit [Read error: Connection reset by peer]
cosimone has quit [Remote host closed the connection]
Guest7475 has quit [Quit: Connection closed]
cosimone has joined #commonlisp
aeth has quit [Ping timeout: 250 seconds]
random-nick has quit [Ping timeout: 252 seconds]
Catie has joined #commonlisp
aeth has joined #commonlisp
dra has quit [Quit: Leaving]
varjag has quit [Ping timeout: 256 seconds]
aeth has quit [Ping timeout: 250 seconds]
aeth has joined #commonlisp
mon_aaraj has quit [Ping timeout: 268 seconds]
Oladon has quit [Quit: Leaving.]
mon_aaraj has joined #commonlisp
OlCe has quit [Ping timeout: 256 seconds]
occ has quit [Ping timeout: 245 seconds]
madand has quit [Ping timeout: 256 seconds]
aartaka has quit [Ping timeout: 256 seconds]
kevingal_ has joined #commonlisp
nij- has joined #commonlisp
cosimone has quit [Ping timeout: 250 seconds]
aartaka has joined #commonlisp