freenode/#lisp - IRC Chatlog
Search
18:37:49
jasom
light2yellow: of course most of the time you'd just do (list '* 1 2) but what's happening under the hood is the cons
18:38:40
light2yellow
yes, I know, spent quite some time trying to understand the recursiveness of all the definitions. in the end it's very simple
18:40:01
light2yellow
the eye-opener this time was that I can use an operator quote (which is just a function, which is just a symbol, which is an atom) in the cons
18:40:55
phoe
because, if it was a function, it would have its argument evaluated, which is exactly what we want to prevent.
18:41:22
light2yellow
no, I mean an arithmetic operator, phoe. by "operator quote" I meant (quote op), where op is some operator
18:42:57
light2yellow
jasom: that intern usage, is that to prevent name clashing or smth? if smb redefines * for me?
18:43:24
light2yellow
I mean, I suppose I know what intern does - it returns an object given a string
18:43:46
jasom
light2yellow: that intern is what the reader does for you when it encounters a symbol. (read-from-string "*") will intern "*" in the current package
18:44:17
jasom
assuming the current package has used the common-lisp package, then it will yield common-lisp:*
18:45:30
jasom
but the function returns the symbol, so it was a silly trick to get a symbol without having to use QUOTE
19:01:01
jasom
lisp does some really fancy things with some really simple primitives, so the first 3 years or so I used it I overthought *everything*
19:29:59
light2yellow
is sequential evaluating guaranteed by ANSI CL? I suppose it isn't? otherwise progn wouldn't exist?
20:05:08
light2yellow
a question about slime. with this snippet https://pastebin.com/LgrXKbZa , if I slime-eval-buffer, I get the correct NIL in the end, but if I select everything and slime-eval-region, it returns T. what's going on?
20:05:09
aeth
light2yellow: Quite a few forms have an "implicit progn" http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_i.htm#implicit_progn
20:17:04
light2yellow
phoe: I guess I figured it out. if I select the line after the last one too (which is the end of buffer or whatever), it returns T for some reason.
20:23:51
light2yellow
right, never mind, it returns nil and t in sequence after each evaluation - once former, once latter. so, thanks, rme, defparameter solves it
20:34:27
phoe
_death: I've applied your solution to PROTEST and it works much better now. Thanks for pointing the issue out to me!
21:40:19
caffe
i'm curious if anyone can explain what's going on here: (do ((x N)(c 0)(i 2 (+ i 1))) ((= x 1) R)
21:55:25
aeth
Do is basically let, but with a step form in the bindings section and then a termination form plus a result before the body
22:00:24
cgay
That CLHS page has some bad indentation in the examples. Is anyone maintaining it these days?
22:03:22
caffe
so if i break it up into smaller pieces, what exactly is something like (x N) supposed to do?
22:06:03
cgay
caffe: (x N) is binding the variable name 'x' to the value of the variable named 'N'. 'c' and 'i' are also being bound there.
22:07:54
caffe
okay. thanks. sorry for the dumb questions, but i haven't had much success testing single expressions from this program
22:11:37
cgay
caffe: You're in luck. I've had exactly zero Euler problems come up in the workplace in the past 40 years.
22:28:02
cgay
ok, that was uncalled for. What's up, mid-teir-lisper? Generally on IRC you should just ask your question...
2:17:53
insi
noob question, but, how do i avoid adding the same sublist to a list? like if i have a list (a b c (b d))
2:24:31
White__Flame
in real non-homework use, there's also PUSHNEW which you can modify the test as well
3:20:31
ealfonso
is there a good way to destructure a REST pathname in hunchentoot, like for extracting 123 and 456 in "/a/123/b/456"
3:39:43
PuercoPop
This is what I do https://gist.github.com/PuercoPop/fb40d1cb8025272c3ba2437e71f26a3a
4:48:24
drmeister
That's why I post this stuff. Like a olden times printer - putting his work up in the public square for free editing. :-)
4:49:11
drmeister
Four numbers for the components of a quaternion and then three x, y, z coordinates.
4:50:45
drmeister
#(-180.66919427590497d0 -881.2260182904439d0 231.43257852229718d0 -479.9920154012122d0 1992.9829583918222d0 -14.490829798676634d0 -67.1107262767643d0 122.77569926522422d0 840.6421670541661d0 -291.06636154816147d0 397.8898934964087d0 1971.7084478581778d0 -35.35365262319839d0 -56.41564091073567d0)
4:53:31
drmeister
I'm taking a single long helix with a centroid and quaternion to describe the orientation and breaking it up into smaller helices that lie along the larger one.
4:53:34
phoe
drmeister: (defun bar (part-position part-pos-start) (flet (((setf foo) (new-value index) (setf (elt part-position (+ part-pos-start index)) new-value))) (setf (foo 3) 42)))
4:55:19
phoe
also you can FINALLY (RETURN PART-POSITION) from inside LOOP at the end to be a little bit more idiomatic
4:56:00
White_Flame
(replace part-position (list eha ehb ehc ...) :start1 part-pos-start) is probably the shortest way to do the final batch of ELTs, if I'm reading your code right
4:56:19
drmeister
I'll do the finally thing - that's nicer. But I don't have a big problem with the repeated invocations of elt. They get across what I'm trying to do.
4:56:21
White_Flame
and there's opportunity for the implementation to optimize that away, to avoid creating the intermediate list
5:03:48
White_Flame
it would be nice to use something similar to destructuring-bind to collapse the 1st set of ELTs
5:05:07
phoe
I still think a FLET and DECLARE INLINE would be a bit shorter, but I agree that this current version is readable.
5:19:39
jack_rabbit
How do you guys deal with providing patches for libraries? I've got a few PRs up on github, but some have been there for ~2 months with no response. Is it bad form to directly email an author? I know people are busy - am I being impatient waiting only 2 months?
5:20:09
ealfonso`
PuercoPop thanks. where is the match symbol coming from? I don't see it in hunchentoot or ppcre
5:30:56
ealfonso`
PuercoPop I ended up using something similar to yours, but using ppcre:register-groups-bind
5:32:38
jack_rabbit
On a similar note, I've been looking to do more contributions to lisp projects. I'd still classify myself as a beginner. Does anyone know of any libraries or projects in need of some love?
5:41:40
PuercoPop
ealfonso`: Yeah sorry, I was going to comment on that. It is TRIVIA:MATCH, a pattern matcher, in this case it is basically syntactic sugar around ppcre
5:53:50
jack_rabbit
I would say so, yes. Secondary would be to increase the overall quality of available CL libraries.
6:00:06
beach
I have an embryonic GUI application for double-entry bookkeeping, but that might not be what you are looking for.
6:00:32
beach
It is a pretty simple system when it comes to logic, but there are plenty of small features that could be added to it.
6:02:26
beach
It is also an application that I don't think anyone is using, so you can go ahead and experiment on it as much as you like.
6:03:17
beach
Sure. I am not sure that this is what you want, of course. If not, I'll try to dig up something else.
6:21:53
beach
jack_rabbit: The application is also interesting because it uses CLOS a lot, including the APPEND method combination for the I/O part. So despite its small size, it exercises a lot of Common Lisp. And, it uses CLIM/McCLIM, of course, so that's positive too.
6:23:08
jack_rabbit
Excellent. I've been usinc McCLIM quite a bit lately, and want to do more. I also have been looking for reasons to exercise the less common features of CLOS.