freenode/#lisp - IRC Chatlog
Search
2:45:40
aeth
Missing commas are pretty annoying. You wind up trying to access a variable that doesn't exist because the macro author only tested the macro with outer variables having the same name as the macro variable.
2:54:01
Bike
so like if a standard function "should signal an error" in some circumstance, if a call to it is safe an error will be signaled
3:12:36
Xach
Hmm, I thought change-class involved :default-initargs, but it doesn't seem to from my reading of the spec and experiments.
4:36:48
beach
asarch: If you find yourself using RETURN-FROM a lot, it might be that your programming style is not that great.
4:38:17
beach
Occasionally, in a loop, when the final value becomes known, it can be a good solution.
4:39:58
asarch
If a function need something like (foo ... (lambda (x y) ...)), how could I put (lambda ...) in a function and the pass that function to (foo ...)?
10:43:21
jmercouris
is there a type of AND macro or form that instead of returning the result of evaluating the last form returns t or nil?
10:44:18
jmercouris
you could of course wrap the AND in a WHEN and have t as the body of WHEN, but that seems a bit clunky
10:54:10
jackdaniel
"you" is implicitly pointing at jmercouris as the person to whom I address the question
10:56:27
jmercouris
I would say about 1/25th of all times I write conditionals do I want it to be explicit that it is a bool
10:56:59
shka_
aeth: thing is that storing is orthogonal to logical operators. You will need to do the same with a lot of functions in multiple places, creating custom versions of each of those is pointless
11:01:45
beach
The only exception I can see would be when some standard Common Lisp function returns a generalized Boolean, such as DIGIT-CHAR-P.
11:03:16
jmercouris
beach: well, in this case I was using a find-if basically to check if some element exists in the list, and it was returning that element instead of a Boolean
11:04:18
jmercouris
I have been thinking about it, and while it is more verbose instead of just leaving it as a find-if, it more clearly conveys intent
11:05:48
jmercouris
I think that would be a bit strange like (defun my-predicate-p (when (and ...)))
11:05:50
beach
jmercouris: If the AND form is in an IF, COND, WHEN, UNLESS or something like that, you will never see the value.
11:06:18
beach
Right, but then my-predicate should only appear in such a position, so again, you won't see it.
11:07:16
jmercouris
_death: SOME and NOTANY are things I have not encountered, and do seem more clear than FIND-IF which is meant to operate on the element if it is found
11:08:59
jmercouris
that's the thing with software engineering and languages, it is so philosophical :D
11:10:01
jackdaniel
jmercouris: difference between and /and/ every is that the latter evaluates all its arguments because it is a function
11:10:06
beach
jmercouris: What I am trying to say is that the return value of AND should only ever end up in a conditional, so then the exact nature of the true value is unimportant.
11:11:24
jackdaniel
this is important distinction if the arguments are forms which have side-effects (or take long to process)
11:14:02
_death
jackdaniel: you're right but note that EVERY will also stop checking if the predicate returns false.. the difference is that AND is connective and EVERY is a (Common Lisp) predicate
11:14:07
jmercouris
jackdaniel: I'm having trouble understanding what you are saying, are you talking about short circuiting?
11:15:12
jackdaniel
jmercouris: try this: (every #'identity (print 1) (print 2) nil (print 3)) and try this (and (print 1) (print 2) nil (print 3))
11:15:24
jmercouris
jus to be clear I'm referring to: https://en.wikipedia.org/wiki/Short-circuit_evaluation
11:17:04
jmercouris
I feel like one needs a degree in LOOP to understand it, like a four year program or something
11:17:47
jackdaniel
when you put enough constructs on top of a hack it becomes standard (see: "posix") ;-)