freenode/lisp - IRC Chatlog
Search
18:32:33
aeth
jcowan: There are probably enough northeast Lispers that a meeting in the geographic middle would be possible. I guess Philadelphia?
18:33:34
aeth
Now the real question is if any are actually in Philadelphia, which I'm guessing would be the convenient geographic average of DC, Pittsburgh, NYC, and Boston.
18:41:39
anamorphic
Hi, bit confused on array types... how come I can (typep #2A((1 0 0) (0 1 0) (0 0 1)) '(simple-array number 2)) => T, but not (typep #2A((1 0 0) (0 1 0) (0 0 1)) '(simple-array bit 2))?
18:43:06
Bike
(simple-array number) is probably (simple-array T) on your implementation- you can check with (upgraded-array-element-type 'number)
18:43:47
Bike
the element-type of an array is a property of the array itself, not whatever it happens to have in it.
18:47:16
pjb
Inded. Notably: (let ((a (make-array 1 :element-type 'integer :initial-element 42))) (list (type-of a) (type-of (aref a 0)))) #| --> ((simple-vector 1) (integer 0 1152921504606846975)) |#
18:47:37
pjb
I mean: (let ((a (make-array 1 :element-type 'integer :initial-element 42))) (list (array-element-type a) (type-of (aref a 0)))) #| --> (t (integer 0 1152921504606846975)) |#
18:48:12
pjb
Or even: (let ((a (make-array 1 :element-type 'fixnum :initial-element 42))) (list (array-element-type a) (type-of (aref a 0)))) #| --> (fixnum (integer 0 1152921504606846975)) |#
18:49:43
pjb
Yes, but not the relationship. (assert (every (lambda (element) (subtypep (type-of element) (array-element-type vector))) vector))
18:51:05
pfdietz
All sorts of invariants for subtypep, though. Which is delightful for property-based testing.
18:53:57
jcowan
I think the only things you need to parameterize a portable subtypep on are (a) what array element types exist and (b) what types of floats and complex numbers exist.
18:54:35
jcowan
(and obviously what structure and class types exist, which is not known until run time)
19:00:23
jcowan
Am I right to think that an implementation can return an object of type (complex float) even if the arguments to `complex` are rational numbers, provided the imaginary part is not rational 0? There seems to be nothing to forbid it.
19:12:57
Xach
Boston may as well be on another planet right now, sadly - wish I could make it to a Lisp pal gathering but it requires much more planning than before.
19:26:49
pjb
notably, clhs complex says: Type upgrading implies a movement upwards in the type hierarchy lattice.
19:28:18
pjb
There is real above both integer and float, but you're considering (complex float), not (complex real), and ther is no direct instance of real, it's an abstract class.
19:31:27
pjb
Actually, it would be very difficult to insert any new type in the number type hierarchy.
19:35:00
jcowan
after all, single-float and double-float are not subtypes of each other either, and cannot be.
19:36:37
pjb
There's no upgrading there, since float and real are abstract, and you cannot make a complex of complex…
20:27:15
jcowan
Sure. Upgrading is about actual implemented types as opposed to describable CL types
22:02:28
dim
Xach: FYI following-up on our chat about buildapp earlier, I did something very simple for pgloader, for testing: https://github.com/dimitri/pgloader/blob/master/src/save.lisp
22:03:07
dim
if I can get enough testing, it might replace the whole Makefile that I have now... well after adding a couple features (DYNSIZE comes to mind)
22:14:20
aeth
As far as northeast Lisp meetups go, the fairest thing to do might be to rotate cities along this line: https://upload.wikimedia.org/wikipedia/commons/7/70/Boswash.png
22:33:56
stylewarning
Any BABEL users? I'm curious how one might write strings to a stream that get encoded per an encoding like ASCII or UTF-8 without generating intermediate data.
22:51:01
White_Flame
stylewarning: I think flexi-streams will output without creating intermediate buffers, but that doesn't mean it won't cons at all
23:17:25
White_Flame
ideally, the best performance route would be buffer-to-buffer with reused buffers, so it's not constantly consing
23:19:19
White_Flame
oh, trivial-utf-8 does have write-utf-8-bytes that takes a string and an output stream, so it's not all just buffers
0:54:06
elderK
mobile_c: Read itself converts the characters and stuff into a tree of lists and things. READ is fundamental.
0:54:22
elderK
If you're used to parsing like, things from another language like C, you will have to roll that mechanism yourself.
0:55:24
mobile_c
how can i parse something like this https://paste.pound-python.org/show/K4QGpELlMYw0VWUjbl37/ using lisp
0:56:10
elderK
mobile_c: If you'd like to learn about how the reader works, you can find out here: http://clhs.lisp.se/Body/02_.htm
0:56:34
didi
I think we are dismissing READ too quickly. It's amazing that we can do it. We should praise it more.
0:57:54
elderK
mobile_c: To parse something like that, you'll probably do a lot of stuff you're used to doing in other languages if you've parsed by hand. Or, you can learn to use one of the many parser-generator libraries available for Lisp.
0:59:10
mobile_c
as i want to parse it like a parser grammar (since technically at the moment it is very similar to one)
1:01:31
malice
With problem definition like this, I'd take a look at parser generators: https://www.cliki.net/parser%20generator
1:02:47
mobile_c
as the main problem is figuring how how to parse it like a rule definition/rule expamsion
1:03:27
elderK
mobile_c: If you want to do it by hand, you could just write a simple lexer and recursive descent parser :)
1:03:59
malice
(also note that the site could use updating; some of the entries are 404 and there are probaly a couple of new ones not listed)
1:05:34
malice
mobile_c: I'm afraid I don't understand the problem well enough to suggest an optimal solution. One of the things I do not understand is the need for Lisp parser
1:06:14
malice
then I do not understand the goal - do we want any parser, some specific parser, what representation of AST should we produce, how do we handle the errors, etc.
1:08:59
malice
although writing your own parser won't be much different from other languages, I guess.
1:12:06
aeth
keep in mind that cliki is probably 15 years old, and not as popular as random github pages like https://github.com/CodyReichert/awesome-cl these days
1:14:56
malice
mobile_c: there's also rdp generator here: http://www.informatimago.com/develop/lisp/index.html
1:33:11
aeth
I think that for a reader macro as long as it returns (turns into?) one thing you can just quote it, but I could be wrongly generalizing from read-eval.
2:48:15
antonv
a library (an ASDf system) shoudl chose a dependency (another ASDF system) based on what OS / distro it runs on
2:48:52
antonv
simply speaking, depending on OpenSSL version installed, we should choose an FFI wrapper to load
3:43:35
fiddlerwoaroof
however, if it's something like "which openssl version is installed", you might have to do a bit of work to get the features setup appropriately.