freenode/lisp - IRC Chatlog
Search
14:57:34
beach
xmonader: So if a form is [say] (= (+ 1 2) 3) then the call will look like this: (report-result (= (+ 1 2) 3) '(= (+ 1 2) 3))
15:01:24
beach
You will have something like (progn (dolist (f ((= (+ 1 2) 3) (= (+ 1 2 3) 6) ...)) ...))
15:07:51
beach
... and when you say (report-result ,f ',f), the comma before f makes f refer to something outside `(progn (dolist ...)) but there is no f outside.
15:08:27
beach
xmonader: He is doing the computation at compile time by preceding the LOOP with a comma.
15:08:57
beach
xmonader: You kind of removed the main point of the macro by not doing the DOLIST at compile time.
15:09:57
beach
xmonader: Now, if you can tell me what the purpose of this modification was, we might be able to patch it up.
15:10:33
xmonader
beach, not really a purpose it just came to my mind why not to use dolist instead :D
15:12:42
beach
I never use dolist myself, but you will have to precede it with ,@ just as with LOOP, and you will have to return a list of forms pretty much the same way the LOOP did.
15:17:14
beach
(defmacro checkmany2 (&body forms) (let ((result '())) `(progn ,@(dolist (f forms result) (push `(report-result ,f ',f) result)))))
16:12:35
flip214
Posterdati: This is not a file name, but a directory name. therefore probe-file does not work.
16:12:56
flip214
you could test for some specific file in there, or rely on other standard mechanisms...
16:21:53
Bike
puthash is not a standard function. sbcl defines an internal puthash that it uses to modify hash tables.
16:24:52
Bike
you can (defun puthash (key table value) (setf (gethash key table) value)) if you want. i don't know why you'd want to, though.
16:26:12
compro
simply because i will have to write less. don't know why this decision was made in the first place
16:28:39
Bike
and if there is a puthash kind of function, setf can just expand directly to it, so it's just as efficient.
16:31:46
Bike
drdo: yeah, i didn't say anything to you. i hardly know the filesystem functions anyway
16:34:44
Bike
oh, yes, well. the standard is mostly solid, so there's not a lot of impetus for improvements.
16:35:03
Bike
and when there are it's not impossible to get widely used extension standards, such as bordeaux threads and CFFI.
16:36:54
Bike
the C++ book i learned some programming for in middle school is worth jack shit now. tragic.... (it wasn't good to start with, but still)
16:37:26
beach
I am very pleased that I can :USE the COMMON-LISP package without having to fear symbol collisions in the next iteration of the standard.
16:39:10
Bike
but, i think haskell is worthwhile to learn, and also that learning one thing or another thing should not be a competition.
16:42:38
beach
compro: Oh, you are in the wrong channel then. Common Lisp is not a good example of a functional programming language.
16:44:01
beach
compro: So if functional programming is what you want, Haskell or some ML variant might be preferable. Or Clojure, I guess.
16:47:43
beach
compro: Oh, and by the way, PUTHASH would be a strange thing to want in functional programming, since it has side effects.
16:51:21
beach
compro: Not sure what you are asking, but "functional programming" typically means programming without side effects, so that calling a function returns a new object rather than modifying an existing one: https://en.wikipedia.org/wiki/Functional_programming
16:53:09
cromachina
instead of a hash table, you would probably end up using a tree or heap. further reading: https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
18:13:27
circ-user-2fvK9
When I'm using the loop macro, is there a way to do a "continue" like in C?
18:16:19
circ-user-2fvK9
no, I mean skip the rest of the processing for this loop iteration and proceed to the next loop
18:19:09
circ-user-2fvK9
e.g. in the body of the "do (block continue ..." I can't use the sum clause from loop because I think loop's macro expansion doesn't follow into there
18:21:27
axion
I agree I don't like this, but a better question might be what you are specifically doing that requires this. It may turn out the DO family is a better fit.
18:33:20
axion
WITH initialized a variable before the first iteration, so IF VALID in each iteration does not seem to make sense to me, nor why WITH is written after iteration bindings
18:42:57
circ-user-2fvK9
so something like "for valid = ... then ..." where ... is the same in both places?
19:03:29
dim
socket in CLOSE_WAIT but SBCL still trying to get more content from it, SB-IMPL::SYSREAD-MAY-BLOCK-P is waiting
19:04:53
dim
it might be that the read shouldn't have been for that many bytes (it wants 67 of them)
20:09:35
dim
btw, I would happily review other project's code in exchange for pgloader's code being reviewed (commit based, happens anywhen people have time, etc)
20:50:42
axion
Hmm, what's the best way to read the full contents of a file at once as an in-memory string?
21:04:41
axion
Looking at the code, it seems to be doing a lot of un-necessary steps. Definitely much more inefficient than my method.
21:08:51
loke___
The function has no way of specifying encoding, which makes it pretty useless for all but specific use cases
21:10:55
axion
The whole buffering. Testing the speed of 10,000 iterations of a small C source code file and it is about 0.5s compared to about 0.3 for mine
21:12:43
axion
Right, I do (with-open-file (in path) (let ((contents (make-string (file-length in)))) (read-sequence contents in) contents)))
21:13:12
loke___
axion: The file size can change between the call to FILE-LENGTH and the actual reading.
21:14:01
loke___
Of course, it's possible to implement a function that attempts to do it that way, and then adjust if the file size changed.
21:15:08
axion
Regardless, people using alexandria probably favor correctness over speed anyway. I know I have made a few contributions to the codebase that favors correctness anyway
21:15:43
loke___
axion: Right. That's definitely what I'd expect from alexandria (after all, “everybody” uses it, so it better be correct :-) )
21:17:07
axion
https://gitlab.common-lisp.net/alexandria/alexandria/commit/926a066611b7b11cb71e26c827a271e500888c30
21:27:15
loke___
axion: You're right. I'm looking at the old version, and your test case gives a really poor value for the old algorithm.
21:30:05
Bike
there's something about :default-component-class cl.source-file.lsp, but then it forgets what :file is
21:33:18
axion
NewLisp tagline, "Puts the fun back in Lisp" couldn't be farther from the truth. Recently had to port some code to CL.
21:34:45
axion
loke___: I ported this https://github.com/hds1/Dual-Quaternion-calculus/blob/master/dualquaternion.lsp
21:42:02
axion
This is why I dislike the language...It has a lot of functions that operate on an implicit argument. In this case I think it is returning the slots of the DQ object, though I could be mistaken.
21:44:23
loke___
axion: What's the implicit argument? Like... I call (foo 1 2 3) and (args) returns '(1 2 3) ?
21:47:54
axion
I really do not know enough. It is confusing to say the least. (args) and (self) always return () and nil respectively for me.
21:48:16
axion
I never said I knew the language...just was able to understand the general algorithms to port it :)
21:48:48
axion
It took me a day of trial and error in its REPL to understand just how a few functions worked.
22:09:10
axion
Meaning I just wanted to push an element to the front without first lexically binding the call to m-v-l
23:40:34
axion
Does anyone know how to convince Xach's salza2 library to compress with a higher level? It seems the default gzip compressor is using the least amount of compression according to FILE(1)
2:35:23
nydel
i haven't updated software in so long.. as a non-root user on a pub unix, is it better to compile slime at $HOME or to use emacs to obtain it via package-install? i'm at an openbsd system that offers both emacs25 and sbcl but no shared slime