libera/#commonlisp - IRC Chatlog
Search
11:48:54
lotuseater
yesterday I asked something in #clojure and the discussion went to that someone said "pattern matching 100% doesn't belong in a library, it's a 'fundamental' feature" ○_∘
11:51:12
lotuseater
with sentences like that someone shows well how less things are really understood
11:52:45
jackdaniel
it is not that wiring a functionality in a library make its users comprehend the topic more compared to a built in feature
11:53:34
hayley
I really don't like non-extensible pattern matchers, which so happen to usually be inbuilt pattern matchers.
11:54:26
lotuseater
yes just because something *looks* like "built-in" whereelse cause you're locked out from the beginning doesn't mean it really is
11:54:51
hayley
To a zeroth approximation, a modular pattern matcher would let you provide any accessor functions to destructure an object.
11:55:57
hayley
Of course, Clojure programmers shy at encapsulation and the use of data structures which aren't persistent vectors and maps, so it is a non-issue for them.
11:57:34
hayley
Extensible pattern matching is how DEFINE-TYPE in <https://github.com/telekons/one-more-re-nightmare/blob/master/Code/re-types.lisp> works for example.
11:57:49
lotuseater
and even more, it's a thing you don't want to have in a real language spec, cause there are too much possibilities and variations, like with regular expressions in general
11:58:50
hayley
Once I wrote that pattern matching and hash tables seemed like old ideas, but for which people can't stop inventing new implementations of. So I wouldn't want to maintain a pattern matcher really.
11:58:53
jackdaniel
I doubt that this would make a strong point when comparing clojure with commonlisp (which has quite a few "wired" behaviors, most notably for sequences)
11:59:58
hayley
.oO(Everything I don't like is anti-modular: the hayley's guide to language features)
12:01:06
rain3
Shinmera: I'd like to port https://github.com/rainthree/manardb to windows , this mmap layer is almost fine: https://github.com/Shinmera/mmap/blob/master/windows.lisp#L222 but its api accepts only pathnames , not file descriptors, while the code that has to be ported calls open-file then mmap on the descriptor . Do you allow me to clone your code and modify it as I want , or would you prefer me to fork then submit pull
12:01:06
rain3
requests? (in this case I will have to bother you about changes and you may not agree to the changes I want to make and we will waste time)
12:03:24
Shinmera
rain3: It seems like it would be simpler to me to change the code you're porting to just use the mmap library instead of open-file and mmap separately.
12:06:23
Shinmera
The mmap api does return the fd (kinda) in its second argument, so if you absolutely need it for something you can get it from there, too.
12:16:20
lotuseater
so that lisp123_ works through it but also is aware of a general function in a lirary which does it
12:27:40
lisp123_
mfiano: Thanks, I'm trying to avoid alexandria as much as possible (minimise code dependency surface)
12:28:14
rain3
Shinmera: by "too high level" I meant that it does two things (1. opening a file , 2. mmapping it) , so in the original code to accommodate to that, at this line for example https://github.com/rainthree/manardb/blob/5d8fc843057b70e831ca1bfc4912ae2b24ab73d4/src/mtagmap.lisp#L168 I will have to do an extra remap (or munmap + mmap for systems that don't have remap) . It can be done, but another way would be to make a separate
12:28:14
rain3
layer library (in which I may steal/inspire few lines from yours) that also has open-file exposed in the public api, along with other apis (that don't have anything to do with mmap)
12:29:03
rain3
*an extra remap before truncating the file because it will be already mmapped and truncate won't work before first remapping with the new length
12:37:09
Shinmera
rain3: It must do two things in order to stay properly portable across systems. The semantics of opening a file and mapping are quite different on windows vs unix.
12:59:33
hayley
Well, for the key objects for which EQUAL and EQL hash tables are equivalent, EQUAL conceptually calls EQL. So EQL might be faster?
13:01:01
didi
So let's go a step further: Should GETHASH be faster for hash tables with test EQL and testing integers than with test EQUAL and testing strings?
13:02:25
hayley
Now it depends on if EQ would work; are the integers fixnums and are EQUAL string keys EQ (possibly by some other interning)?
13:03:52
hayley
If one is true but the other isn't, the true one will be faster. If both are true, they're probably the same. If neither is true, no one knows.
14:57:25
pjb
didi: basically a eql hash-table will use as hash value either the address of the object, or (if a moving gc is used), a unique ID.
14:58:18
pjb
didi: while with an equal hash-table, for objects where that makes a difference, the hash-function will have to process the object value (eg. make an sum of some of the hash of the slots in a vector or list).
15:02:39
pjb
eg. if your keys are numbers, then equal uses eql which tests if the numbers are of same type and = ; but if your keys are string then equal uses (every 'equal str1 str2) to test each character. O(n)… Sometimes you may want to use a hash-table :test eql with strings, but in general you don't, you want the :test equal.
15:11:38
doyougnu
Hi all, does anyone have a reference or link to get started on NixOS? I'm getting errors when looking for foreign libs like libssl.so
15:33:14
doyougnu
I was just seeing if there was anyone else in here that used NixOS. I found some NixOS related posts about it, looks like PACKAGE_CONFIG_PATH needs to refer to where nixos stores binaries
15:35:43
dualinverter[m]
doyougnu: I am pretty new to common-lisp, am not using any packages so far; but this flake file works without problems:... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/c755c59039ee186f1a6a9dc98f018ce91ee78e71)
15:37:28
etimmons
doyougnu: Doesn't actually answer your question, but if you don't really need SSL support in hunchentoot you can push :hunchentoot-no-ssl to *features* before loading it
15:37:34
doyougnu
dualinverter[m]: thanks for the input. I'll toy around with some derivations. I suspect i'll have to wrap SLIME in a nix-shell to get it working.
18:05:48
akater[m]
Should (map-into #(0 0 0) #'identity) error? SBCL errors here due to invalid number of arguments but it does not error e.g. on (map-into #(0 0 0) #'identity nil nil).
18:09:48
scymtym
(map-into … … nil nil) does not call the function. (map-into (vector 1 2 3) #'identity '(1) '(2)) signals an error due to wrong number of arguments
18:11:06
scymtym
but i don't think the compiler is supposed to figure that out without calling the function
18:21:46
akater[m]
Elements are set to successive values of (funcall f). That's what should indeed happen.
18:22:12
didi
akater[m]: #'f doesn't accept arguments; #'identity does. The surprise, for me, is that `map-into' applies the function even if there is not sequence.
18:25:32
pjb
akater[m]: there's no point in naming a function with f !!! Use lambda: (map-into (make-list 3) (lambda () (random 3))) #| --> (2 2 2) |#