freenode/#lisp - IRC Chatlog
Search
23:22:50
moon-child
how come (*) and (+) are usually well-defined (to multiplicative and additive identities), but (/) and (-) produce an error?
23:24:49
yottabyte
has anyone gotten drakma to work with windows 10 here? when I try e.g. (drakma:http-request "http://www.lisp.org/index.html") I get https://pastebin.com/MNLZeyS3
23:25:26
yottabyte
I tried to do some searching and it seems to be a CL+SSL error, but all I did was quickload drakma
23:26:15
aeth
moon-child: probably because / and - are actually two functions, depending on the lengths of the arguments provided, i.e. 1 argument vs. 2 or more arguments
23:27:21
moon-child
otoh, they still have well-defined identities, that are consistent for both forms
23:27:40
aeth
if they were defined like + and * then there would be no difference with (- and +) or (* and /) for 0 and 1 arg calls and there would need to be separate functions for negation and inverse
23:28:39
pjb
moon-child: the mathematical principle, is that (op) returns the neutral element for op. What is the neutral element of / or of - ?
23:29:21
aeth
(/ x) is (/ 1 x) instead of the "expected" x if it were just an extension of / for 2+ args and (- x) is (* -1 x) instead of the "expected" x if it were just an extension of - for 2+ args.
23:29:51
moon-child
pjb: ahh, I see. So it's not because there are separate forms, but because parameter order matters
23:30:22
pjb
moon-child: well, at least for neutral elements. an operation can be anti-commutative, but the neutral element should still commute.
23:30:29
aeth
or I suppose you could define (- x) as (- 0 x) instead so it parallels / more. That is, (- x) is (- (+) x) and (/ x) is (/ (*) x)
4:48:54
markasoftware
I want to pass the value of a variable as an argument to a function, if that variable is non-nil
4:49:07
markasoftware
otherwise i want to omit the argument so that the function can use its default value for it. (it is &optional).
4:49:51
markasoftware
Do I just make my own macro to handle this? Or is there some convenient way I am overlooking?
5:12:46
akoana
markasoftware: maybe use something like this: (defun f (&optional (p 'default supplied-p)) (if (and supplied-p (null p)) 'default p))
5:18:16
beach
I guess &aux is on my mind because I used it in my paper on representing method combinations.
6:45:25
Shinmera
p_l: I used &aux in a custom macro to denote special bindings that should be emitted. https://shinmera.github.io/for/#bindings
6:46:12
beach
p_l: Yes, maybe so. I would certainly not want to see it disappear in this famous updated standard that so many people seem to want.
6:53:10
beach
I don't think there is a difference. But in my paper on method combinations, I analyze the lambda list. It would be much harder to analyze the body of the function.
6:54:08
heisig
phoe: Since &aux fits into the lambda list, it can sometimes shorten your code by one line. And it means that you have a central place to put your declarations (after the lambda list).
6:54:19
Shinmera
The &aux are used to emit bindings that surround the entire loop block, whereas the body is emitted within the iteration loop.
6:54:42
kpoeck
3.4.1.5 Specifiers for aux variables .... &aux variable processing is analogous to let* processing.
6:54:42
Colleen
kpoeck: karlosz said 9 hours, 44 minutes ago: https://github.com/robert-strandh/SICL/pull/153 fixes the maxima issue, it compile instantly now
6:54:42
Colleen
kpoeck: karlosz said 9 hours, 9 minutes ago: that means you don't need to comment do-inlining out. if you do, everything will be kinda slow.
6:54:53
heisig
And of course &aux is important in cases where you have no body - like struct constructors.
9:01:05
phadthai
2 should be the result, maybe something mistyped... there's an extra opening paren before your defvar
9:01:56
phadthai
and yes it's important to understand the distinction between defvar and defparameter
9:15:46
no-defun-allowed
doomlist3: Check your parens (and the structure suggested by your indentation).