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") ;-)
11:30:40
no-defun-allowed
sbcl's loop implementation has notices from Symbolics and the MIT AI Lab so it's possible
11:33:12
no-defun-allowed
sounds like something Interlisp's CLISP would do though, it let you put meaningless words like `(if (foo-p thing) then ... else ...)` in places to make it more readable
11:58:54
jackdaniel
(so I recommend skipping tl;dr attitude and see what is said by one of the construct authors)
11:59:55
no-defun-allowed
i did read it, must have missed the obvious introduction that pointed out that PG didn't write that
12:00:27
_death
no-defun-allowed: well, I sympathise with both camps :).. I think it's good to be skeptical of both loop/antiloop and clos/anticlos :)
12:00:41
no-defun-allowed
(though "I consider Loop one of the worst flaws in CL, and an example to be borne in mind by both macro writers and language designers." in the parens suggests i'm not wrong, just completely off the point)
12:08:53
_death
consider the premise that object-oriented style is just one possible paradigm out of many
12:11:10
_death
jumping straight to clos, or delving deep into the mop to make it suitable to your problem may not be the most efficient or clear approach to get at what you actually want
12:12:35
_death
of course, sometimes what you actually want brings you to clos/mop, and that's great
12:13:10
jmercouris
granted, you cannot make the argument that it required any changes to Lisp to implement
12:14:09
jmercouris
I'm not sure where I'm going with this, but I cannot imagine Lisp without introspection and CLOS
12:15:19
_death
CL itself due to its history has CLOS almost as an addon.. so it's easy to imagine CL-sans-CLOS
12:15:49
jmercouris
I'm using the expression in the sense of, "it would be very unfortunate", not that I cannot imagine it literally
12:16:14
jackdaniel
it is not said that if there were no "clos" CL wouldn't incorporate other kind of OOP
12:16:14
jmercouris
of course when I was learning Lisp (still learning of course), I did not yet know CLOS and was working without it
12:16:53
jackdaniel
also object orientation and encapsulation are orthogonal concepts, you may write protocol for accessing complex data which has underlying structure in form of a vector whatsoever
12:17:00
jmercouris
I know the other OO systems though, and I don't like them nearly as much, I can't think of an argument for them anymore
12:17:40
jmercouris
sure you can, just how you could drop down into assembler, but abstractions that objects provide make it far easier to persist/access data
12:17:55
jmercouris
and I will disagree with you object orientation and encapsulation are *NOT* orthogonal concepts
12:18:08
jackdaniel
also using clos daily encourages sloppy code where there are dangling methods (and it is hard to follow how the program behaves)
12:18:10
jmercouris
that is one of the big reasons behind Java's different type of class members, they are closely tied
12:18:32
jmercouris
I will not say that one necessitates they other, but I will not say they are orthogonal
12:19:05
jmercouris
jackdaniel: see this section; https://en.wikipedia.org/wiki/Object-oriented_programming#Encapsulation
12:20:04
_death
shka: the funny thing is I remember reading AMOP for the first time and thinking how _simple_ much of CLOS is... :)
12:20:30
jackdaniel
either way I see that you feel very emotional towards clos and oop in general, so I'll just back off
12:21:48
jackdaniel
it is worth noting, that I was speaking about programming techniques (I am aware that every value in CL has its class)