freenode/#lisp - IRC Chatlog
Search
19:58:45
phoe
one of my most recent frustrations with the standard is related to the naming of simple-arrays and simple-vectors
20:00:02
sjl
it is a little odd that vectors are one-dimensional arrays, but a one-dimensional simple-array is not necessarily a simple-vector
20:03:42
Shinmera
Sure, but point being if you have an immediate type you don't need to tag check, making it even faster.
20:04:28
pjb
makomo: in any case, it is not useful to use defconstant to bind instances to variables.
20:04:32
phoe
yep, but simple-vectors are built around the idea of *not* having element-type information.
20:05:46
pjb
makomo: the point of defconstant is to tell the compiler that it may generate the value as immediate value (thus making copies of the value) in the binary instructions. Therefore it's only useful for values that can be immediate in the native instruction set, ie. basically integers and characters.
20:39:36
borei
is it possible to define setf for entire object, not for particular slot, but entire object ?
20:44:58
aeth
Although it's confusing to have a setf function without an equivalent regular function and I'm not sure what a regular function would do by default.
20:45:10
pjb
slots can contain immutable data (that can be copied), or references to immutable data (the reference can be copied, thus sharing the immutable data), or references to mutable data (that may or may not be copied, thus sharing or not sharing the mutable state), or also the may contain derived data or cached data, that is computed and updated "automatically".
20:45:35
pjb
borei: therefore we cannot give you a generic method to copy the slots from one instance to another: you have to provide it yourself!
20:46:31
phoe
you can't modify whole objects in-place - you can only modify references. and places are references.
20:47:59
pjb
phoe: No, war is over, the USA won, and Europe is vasal. We can be raped anytime, and this occurs all the time
20:48:02
aeth
borei: If you write an accessor that only works on one value you can use with-accessors just like a CLOS accessor, and then you could do (setf matrix 5.0d0) while really calling the accessor
20:48:26
aeth
borei: If you write an accessor that works on more than one value, you'll have to manually use symbol-macrolet yourself, but the same principle applies
20:48:52
aeth
(technically the setf accessor really has one more value than it looks like it has, though, the new value)
20:50:00
jmercouris
pjb: "Middle English, borrowed from Anglo-French, borrowed from Medieval Latin vassallus" - it's kinda french :P
20:51:51
jmercouris
there's a lot of french speaking countries that refuse to learn english, don't feel so bad :P
20:52:20
jmercouris
i like the people that suggest that we'll all be speaking chinese, like population of speakers is the only criteria for adoption of language, nevermind the impossible writing and pronounciation
20:52:56
aeth
The heart of with-accessors or something similar to it is (let ((thing (gensym))) `(let ((,thing ,object)) (declare (ignorable ,thing)) (symbol-macrolet #|fancy stuff|#) ,@body)))
20:55:31
pjb
jmercouris: Chinese, not because of the population, but because of the economic might. The USA is falling fast.
20:56:55
aeth
pjb: That doesn't take into account that French was still the lingua franca after France stopped being the superpower, during pretty much the entire era of the British Empire's dominance
20:57:41
aeth
English afaik really became the world language after 1945, with the primary countries of the competing languages of French and German in ruins
21:00:25
jmercouris
Russian was a language forced onto all of their satellite countries, I wouldn't say it was "competing" so much as "coerced"
21:00:54
jmercouris
as much as english sucks, it's an easy language to speak incorrectly and still be understood, the same cannot be said of most other languages
2:09:17
madpengu
(defparameter *a* (list 1 2 3)) (defparameter *b* (list 4 5 6)) (defparameter *c* (append *a* *b*)) (setf (first *a*) 55)
2:15:22
madpengu
Okay, figured, append is only allowed to reuse the last structure, not just any one of them
2:20:08
pjb
madpengu: append is not destructive, but the result shares the last argument, so if you mutate the result, it could be destructive!
2:20:56
pjb
(let ((a (list 1 2 3)) (b (list 4 5 6)) (c (list 7 8 9))) (tailp c (append a b c))) #| --> t |#
2:21:00
madpengu
I was just confusing about what is reused, it seems only the last structure, no the first one.
2:21:52
pjb
Notice that this is what lets you use append to build a dotted list: (append '(1 2 3) 4) #| --> (1 2 3 . 4) |#
2:23:15
dmiles
(otherwise indeed it may have been nice to have had it resue the first structure to save space)
2:23:44
pjb
(let ((a (list 1 2 3)) (b (list 4 5 6)) (c (list 7 8 9))) (tailp a (nconc a b c))) #| --> t |#
2:29:00
pjb
madpengu: you can also use (com.informatimago.common-lisp.picture.cons-to-ascii:draw-list (cons '(1 2 3) 4))
3:57:59
drmeister
I realize that nil is not a character - but I have some code (not my own) that is invoking unread with nil.
4:09:27
jasom
ebrasca: every object in lisp is either a cons or an atom. The type atom is literally the same as the type (not atom)
4:10:30
jasom
ebrasca: it's a bit silly that vectors and hash-tables are atoms, but the atom/cons distinction predates lisps having those
4:41:27
jmercouris
anyone know a cl lib that provides functionality similar to: https://www.passwordstore.org or perhaps a wrapper for it?
4:50:51
madpengu
jmercouris: That is a stupid simple wrapper around gpg. You could probably write in cl in 2 lines of code ;)
5:14:02
jmercouris
I'm hesitant to recreate it in CL because I think there are some users of pass already, and I'd like to integrate with their workflow rather than break it
5:43:56
madpengu
jmercouris: I use pass all day erry day. And considering that it is just a bash script, I am not sure how you can find a cl library.
5:48:48
beach
jmercouris: I consider it progress whenever some existing software can be rewritten in pure Common Lisp, or at least as pure as possible, depending on the task at hand. It makes the software safer and easier to maintain for us.
5:51:50
jmercouris
Ironclad also looks like a nice library: https://github.com/sharplispers/ironclad
5:59:41
beach
jmercouris: There have been some issues with Ironclad. I suggest you ask Bike and drmeister.
6:27:18
beach
I have almost all the customization code in place. I think only what backquote returns need to be customized.
6:28:39
beach
Extracting it would be the good opportunity to make sure it is truly implementation independent, and also the opportunity to document it properly.
7:32:03
beach
The fact that Common Lisp has several implementations can be confusing to "modern" programmers who are used to single-implementation languages, where the language and the implementation evolve together.
7:32:09
beach
But having a fixed standard like Common Lisp does, and having several possible implementations of that standard to choose from is actually a good thing.
7:32:10
beach
A commercial software project that chooses a single-implementation language is actually taking a great risk.
7:36:57
dmiles
zhoujingrui: paste an entire function to pastebin, RET is used in a certain dialect of lisp that i am very familiar with
7:38:09
dmiles
hah i see now, i thought the refernce to the keyboard was a joke.. but now i see this is instructions