freenode/#lisp - IRC Chatlog
Search
10:37:30
shrdlu68
Heh, the thing about Lisp letting you prototype if analogous to painting. Watercolors are infamously difficult to paint (all the more reason to admire people who actually master them). They dry too quickly, the water runs off and diffuses in weird ways, etc. Lisp, then, is like oil painting - it lets you play around.
10:50:33
schjetne
When I was a kid they made us paint watercolor on copier paper for art class. It's as if they set us up to fail, I still resent that.
10:54:05
no-defun-allowed
Oh yeah, I remember watercolours. We got oil paint later in the year, though.
10:54:56
no-defun-allowed
It was like jumping from Python to CL, I had something I could actually work with. (except I can't paint, and I got a D for art :)
10:58:43
schjetne
I'd rather compare it to Forth or APL. Very elegant, but hard to wrap your head around. I wish we had been given proper brushes, paper and actual useful instruction, because I love the medium and wish I knew how to do it. I think what they did to us was downright cruel.
11:20:43
schweers
Spaceman77: how do you understand a programming problem without attempting to solve it?
11:20:49
Spaceman77
When i worked half-time at my job, i found that i could write better solutions, because i had the time in-between to actually think about the whole problem
11:21:36
Spaceman77
schweers: Of course, you do it and bump into all the necessary roadblocks until you understand the problem
11:44:40
Ukari
I noticed that (defpackage foo (:use :cl)) will include all symbols exported by package :cl, which will cause name confilcts in some condition. for example, I could't (defstruct count) because there has been a function named count in package :cl. Is there any way to make (:use :cl) works with some stuff like (:exclude :cl :count) to save the name space?
11:47:39
shka__
however, it is usually better (in practical terms) to avoid conflicting with #:cl at the very least
11:50:11
splittist
alternatively, don't USE cl, and when you want cl:count or cl:signum, say so. Of course, this means you need cl:defun etc. But it's a style.
11:50:20
phoe
when I see SIGNAL then I expect that it's CL:SIGNAL - otherwise it causes me confusion
11:52:43
shka__
anyway, there are situations where this becomes useful, but as a rule of thumb you either use package (cl, maybe alexandria) or import just required symbols (other utils) or use a prefix (everything else)
12:22:17
White_Flame
how annoying. With just 1 of my cond clauses, I need to store the test value for use in the body
12:27:02
White_Flame
the definition of FOO would have to be somewhere above, and encompass much more than its use
13:08:43
makomo
White_Flame: take a look at On Lisp's CONDLET (i asked the same question ~2 weeks ago :-))
13:09:13
makomo
oh, actually, never mind, i also concluded that CONDLET doesn't fit what i wanted to do (which i think is the same as you're trying to do)
13:10:30
makomo
iirc, CONDLET conditionally establishes bindings and then executes a body, which is not what you're trying to do
13:13:13
White_Flame
but you'd have to declare var for every case. IT is simpler, but I guess less clean
13:14:02
White_Flame
really, we need specific macro support for every possible use, which would only lead towards NLP
13:18:17
White_Flame
ggole: there's no input data to pattern match against. it's an arbitrary predicate clause
13:18:54
White_Flame
unless you mean self-contained within the test clause, but then it doesn't encompass the value passing outside of that, and leaves you at square one
13:19:03
_death
abstractions have costs.. in my opinion it's better to use the setq idiom and concentrate on those with more bang for buck
13:19:31
White_Flame
one could consider an ad-hoc unabstracted setq idiom to be technical debt a well
13:20:27
makomo
i just remembered what i wanted to do with my COND. i wanted to reuse 2 values that were calculated as part of the test form, but not really the result of the test form itself
13:21:19
_death
White_Flame: sure.. throughout the years I've experimented with many styles.. and there was a time where I too preferred acond
13:21:54
shka__
https://github.com/sirherrbatka/cl-data-structures/blob/b2bdbb168ebcf24f1b5d74f8ff1438f40c9594c6/src/utils/macros.lisp#L4
13:23:21
White_Flame
if the value derivation is expensive, you absolutely want to defer until the actual test needs it, if it's conditionally reached
13:26:48
makomo
ACOND (and a hypothetical generalization of it that would allow every clause to have its own set of bindings) is nice, because the bindings are localized
13:30:33
White_Flame
for maximum insanity, a cond test clause could return a PROGV binding set applied to the handler body
13:56:35
dtornabene
curious if anyone has some strong opinions on the currently available xml libraries, I'm wanting to use them for parsing some webpages fwiw
14:20:32
Josh_2
I've done quite a bit with plump, I like but it does sometimes throw errors when passing 'normal' sites
14:28:35
splittist
I would plump for plump. But that may be because of ancient not-so-good experience with cxml. And I wasn't parsing web stuff.
17:59:12
drmeister
The docs say - Return a foreign pointer to VECTOR(including its header). VECTOR must be a vector created by MAKE-STATIC-VECTOR.
18:24:31
jmercouris
I want to go over some objects, manipulate them, and then collect some operations on them
18:26:56
jmercouris
I literally just wrote (loop for object in object-list do (method-call object) collect (accessor-call object))
18:32:06
ggole
(loop for i in (list 1 2 3 4 5) when (evenp i) do (incf i) collect i) vs (loop for i in (list 1 2 3 4 5) when (evenp i) do (incf i) and collect i)
18:33:35
jmercouris
I know they are much more common in C languages, but there are still use cases for flags in lisp, and I'm not sure how to name them
18:33:55
jmercouris
I have a database where I have a flag that indicates an account has been manipulated in some way that requires processing
18:34:04
verisimilitude
Also, you can avoid the AND if you just use END to delimit conditions, instead, which is what I use whenever something gets difficult to understand at a glance.
18:37:27
verisimilitude
I suppose an alternative convention would be is- or are-, as in ARE-TARGETS-CHANGED?
18:38:49
sjl
What airport are folks flying into for ELS this year? MXP, and then take public transit to Genova?
18:49:50
sjl
Yeah, not sure how efficient it'll be coming from the US though. There are direct flights from jfk <-> mxp at least. I'll poke around on ITA though
18:52:11
cage_
yes i also do not think there are direct flight form US, but it should not be a long journey from Milan to Genova
18:58:40
sjl
The US itself is within a few percent of the size of Europe. So when I'm looking at different cities on the map trying to figure out how to get to ELS I need to remind myself to calibrate my expectations properly.
19:00:05
surrounder
3.5 hours will get me in places where I won't understand anyone and the culture will probably be different too\
19:15:38
emaczen
the paste gives a backtrace showing where I call make-instance with several keywords and their corresponding arguments, and then two initialize-instance methods that are called, but the keyword arguments became nil...
19:16:16
emaczen
I write after methods on initialize-instance all the time, and I have never seen this happen before
19:19:00
emaczen
The only difference from my past usage of make-instance is that the object's class is a subclass of standard-class, but I've only overriden validate-superclass, and added an after method on ensure-class-using-class
19:38:31
sjl
... how in the hell can it possibly be six (6) USD per day to rent a car from MXP? Is Kayak lying to me? If so, heck, I'll just drive to ELS from MXP.
19:51:20
jmercouris
it appears more expensive on paper, but that is the true price, and they won't play games with you when it comes to insurance claims, upselling, and the like
19:52:36
sjl
I might rent a car anyway. I took the entire week off from work, so after ELS I might go to Florence and visit some of the math-related museums.
19:59:09
lumonom
Hey i am really new here so pls tell me if i do something wrong. I wanted to ask if there is an easy way to check if a float number only has a 0 after the decimal point
20:47:52
makomo
check out the section "understanding compiler diagnostics" or something similar in SBCL's manual
20:49:51
makomo
yeah, in any case, it's not seeing DEFTABLE as a macro but as a normal function, so it goes on to examine the arguments
20:50:02
jmercouris
I'm going to clear my cache and recompile on my own machine and see if I have issues
20:52:11
jmercouris
though it may be faster this time, since all of the dependencies are compiled, I'll do it as a last resort
20:58:52
dxtr
Can I do something like (loop for (a b) on '((1 2 3 4))) where (a b) has a length that depends on a variable?
21:00:47
makomo
dxtr: assuming arbitrary lengths, would you then access the destructured elements? you wouldn't know how many to destructure
21:01:38
makomo
LOOP's destructuring acts (almost, there's some corner case or something) like destructuring-bind's, so you can use stuff like &optional, etc.
21:01:50
dxtr
Well, if I could catch them as a list then that'd be great because that's essentially what I want to do
21:04:13
sjl
I don't think it's true that you can portably use destructuring-bind type stuff in LOOP binding clauses
21:04:38
sjl
Destructuring allows binding of a set of variables to a corresponding set of values anywhere that a value can normally be bound to a single variable. During loop expansion, each variable in the variable list is matched with the values in the values list. If there are more variables in the variable list than there are values in the values list, the remaining variables are given a value of nil. If there are more
21:06:31
sjl
You can use a dotted list to do the equivalent of &rest, and you can use NIL to ignore values, but it's not full destructuring-bind level of power.
21:07:44
dxtr
Well if it's not possible it's not possible. Just figured that it doesn't hurt to ask so I don't re-invent stuff that exists
21:09:28
sjl
dxtr: it's still not clear what you're trying to do. That example will return '((1 2) (2 3) ... (9 10) (10 nil)). Is that not what you want?
21:09:48
makomo
dxtr: i'm not completely sure what you want to do. the example you gave above evaluates without errors. i was expecting an example where you provide the destructuring, the input and the values of A and B you want
21:12:26
Bike
well, you can't get a bunch of variables (like A and B) from a number, you'd get a subsequence
21:12:36
sjl
There's no way to do that kind of thing with destructuring, no. You could do something like:
21:12:52
sjl
(defun ngrams (n list) (loop :for x :on list :repeat (- (length list) n) :collect (take n x)))
21:13:35
Bike
you could do (loop for sublist on list by (lambda (l) (nthcdr n l)) for real-sublist = (subseq sublist 0 n) ...work with real-sublist here...)
21:13:49
makomo
dxtr: as mentioned, you can't really do that with destructuring. the problem is that X is a run-time thing, while the destructuring specification has to be known at compile-time, at the moment you write the code (and "tricks" like &rest don't really help here)