freenode/#lisp - IRC Chatlog
Search
18:58:42
tyrese
I have (loop for c across format do (if (eq c \#%) ..., how can I get the next character in the loop?
18:59:58
pjb
tyrese: characters may be not eq to themselves. And their reader syntax is #\% not \#% which would be symbol, and therefore a free variable!
19:14:29
pjb
Of course, the original was programmed on a vectorial screen, so it was different, but the following ones that were programmed on raster screens used that trick.
19:54:58
p_l
pjb: I did a presentation on basics of design of operating system with a historical view back in High School, specifically as teaching material
20:16:02
rpg
Quick question: the gitlab docs say that it's possible to do a squash merge to accept a merge request. But on cl.net I don't see this option. Anyone know how to use it? Or is this feature unavailable on cl.net?
20:51:23
aeth
member typep is faster than find in a sequence, at least for characters (where the sequence is a string) and unlike the latter it can be entirely resolved at compile time (find will iterate even if everything's constant)
21:54:51
dacoda
I was wondering if it was possible to create an array displaced to another array of a different type
21:55:15
dacoda
For example, if I have one array of '(unsigned-byte 8) and I wanted to displace another array of '(unsigned-byte 16), is this possible?
21:55:28
dacoda
Otherwise, how can I re-use the data of the first array while interpreting it as 16-bit integers?
21:56:46
MichaelRaskin
I wouldn't expect this to work well, given that many implementations «tag» the data to keep track of types
21:57:43
dacoda
Hahahaha, that would be an interesting way around it! Just have a C function that takes in a uint8_t buffer and casts it to a uint16_t buffer, eh?
21:58:09
dacoda
I'm using it for a little toy script, and if that's the solution, I might as well write it in C
21:58:29
MichaelRaskin
Well, FFI has functions for direct manipulation of foreign memory, no need for the C function.
21:59:50
MichaelRaskin
Note that you give up any and all Common Lisp safety when you do foreign memory manipulations by hand…
22:09:27
dacoda
(let ((original (make-array 2 :element-type '(unsigned-byte 8) :initial-contents '(255 0))))
22:11:01
dacoda
Thanks for pointing me in the right direction, I'm going to mess around with this nonsense and see how it goes
22:11:18
dacoda
Ahhh, I wonder if the result of the convert-from-foreign is a new array or the same...
22:17:00
aeth
ah, I see, with-pinned-objects should behave similarly (but it isn't used in static-vectors)
22:45:24
aeth
You should probably use static-vectors because it's portable, but... I'm not sure if its implementation method in SBCL is better than yours and what the various drawbacks are.