freenode/lisp - IRC Chatlog
Search
10:28:35
edgar-rft
loke: probably yes, but there are *many different* package formats. Which one are you talking about?
10:29:40
iago
that was what I was thinking, binary format is so application dependent that it would be hard to write a generic library to decode it
10:29:56
loke
edgar-rft: Specifically, I need to decide TCP headers. I know the format, and I can easily do it manually using lots of LOGAND and ASH
10:30:15
loke
But if there a package that allows me to neatly declare the format, things would be easier.
10:33:39
ogamita
iago: it's not hard to write a generic library: you define a DSL to describe binary format and to get generated automatically the functions to access it.
10:34:50
ogamita
iago: see for example https://gitlab.com/com-informatimago/com-informatimago/blob/master/common-lisp/data-encoding/data-encoding.lisp
10:35:56
ogamita
iago: and https://gitlab.com/com-informatimago/com-informatimago/blob/master/common-lisp/data-encoding/data-encoding-test.lisp
10:37:10
ogamita
iago: notice in data-encoding-test.lisp how definining a binary format and using it as easy as defining and using a structure or a CLOS class.
10:41:27
Xach
loke: binary-types and possibly others. and a core example in PCL is doing it via CLOS.
10:41:30
loke
iago: However, libpcap itself doesn't include any functions to parse packets. You get binary blobs.
10:42:07
loke
Here's my pcap code in case anyone is interesting. It's a work in progress: https://github.com/lokedhs/trivial-pcap
10:43:17
Xach
loke: i've often thought about rolling my own, so often that i think probably many others have, but i can't remember names
11:10:29
_death
also I once wrote a python.struct-like thingy for ad hoc munging https://github.com/death/constantia/blob/master/struct.lisp
11:52:17
sjl
cool, ELS schedule is posted http://european-lisp-symposium.org/editions/2017/content-programme-full.html
12:31:39
beach
easye: There is a tradition, but things are different this year because of the co-location with <programming>
12:32:06
beach
easye: So the banquet is on Wednesday, and it's for the entire <programming> conference.
12:33:10
beach
There is nothing organized for just ELS, and the banquet is not included in the price for just the symposium and the workshops.
12:36:00
easye
+1 on an April 3d dinner. But I have no cycles to help organize (working on abcl-1.5.0)
13:35:30
beach
So here is an idea for a cute feature of Common Lisp mode of Second Climacs: Hold the mouse over a lexical variable, and the possible definitions (such as LET bindings or assignments that may determine its value at that point) will be highlighted. Other uses of the same variable (including assignments that can not determine its value at that point) will be highlighted differently.
13:39:55
beach
It involves computing so-called DU and UD chains, but that can be done since I have a complete parse of the code.
15:22:05
ogamita
Now, depending on your hardware, it may be more efficent to fork threads and write different parts of the blob from different threads.
15:23:38
dxtr
We are migrating our ecommerce system and I have to import product images for 70k products
15:26:56
ogamita
Nowadays, we have large RAM so you can avoid hitting the SSD until you have the final file in general.
15:30:51
dxtr
#<SB-SYS:FD-STREAM for "file /home/dxtr/quicklisp/local-projects/imageimport/catalog/product/l/u/lulz" {1001F8B533}> is not a character output stream.
15:38:46
didi
So http://lisptips.com/post/53970107740/adding-an-item-to-a-sorted-list taught me how to add an item to a sorted list. But what if I want to add an item only if it is not a duplicate of an item already in the list?
15:54:39
didi
White__Flame: True. It is a possibility. But I am writing a simple implementation for now.
15:57:31
ogamita
Also, it depends on your processor and DRAM system. I hear that some DRAM system/processor cache make it so RAM accesses are done by lines of 64 bytes at once (you read one byte, the RAM sends 64 bytes; you write one byte not in cache, the RAM sends 64 bytes, the cache is updated, and the flush sends 64 bytes to the RAM).
15:59:03
ogamita
In such a system, an array of 16 or 8 elements could be updated by the processor in cache without RAM access as fast as a single RAM access, so inserting into such a small array would not be slower than inserting in a list. Probably faster in fact.
16:00:25
_death
if you expect a lot of duplicates, you can maintain both a hash-table and a sorted list
16:02:04
_death
as long as you hide the implementation detail behind an abstract data type, it's ok to start simple
17:02:53
scymtym
they are both (asdf) systems, have been written by the same authors and are both unmaintained. that's why i mention them together like that
18:15:52
dwrngr
ebrasca: what happens if outside its own package, you try packagename::*l-system* instead of just *l-system* ?
18:25:14
Bike
would you please try to explain what you mean rather than repeating code with no context
18:27:00
Bike
Sure, whatever. I'm saying that if you define *l-system* in some other package the symbols are not read as being in the turtle-graphics package.
18:27:15
phoe
if you're in your package, then list '(a b c d e f) read from the Lisp reader will be all symbols from your package.
18:27:17
Bike
Because turtle-graphics::f and some-other-package::f are distinct symbols, most likely
18:27:28
phoe
if you're in another package, then list '(a b c d e f) read from the Lisp reader will be all symbols from another package.
18:27:53
daemoz
How do I quote the result of a variable? ex. (foo 'variable) where variable equals (1 2 3) and I want the call to read (foo '(1 2 3))
18:29:23
dwrngr
ebrasca you never answered my question, it should help you understand what Bike is saying if you can
18:30:04
daemoz
phoe: Yes I am, and the result of the macro depends on a config file that for convenience has element simply written as "(1 2 3)" for instance.
18:36:19
pebblexe
I am trying to parse some json, but since it's not being returned as a string none of the decoders work
18:39:28
phoe
like, mapcar returns a list of values returned from the function, mapc returns the first original list.
18:42:28
daemoz
Bike: I'm dancing around this trying to quote the result of an evaluation and this is where I wound up T_T
18:44:02
Bike
you want midi-info to be a list of four elements, the first of which is the symbol LIST?
18:46:06
daemoz
phoe: Okay, that makes sense to me now. I for some reason though that macros would unquote their result first before passing to other macros. That was silly.
18:47:34
daemoz
That's what so amazing about Lisp to me and I think why I feel the desire to make everything a macro
18:48:31
phoe
code making code is awesome, but actually not all that practical for things like *this*.
18:49:07
Bike
well, it's what's being done here. daemoz wants a form that makes a list, for whatever reason. it's just that you can do that without bothering with nested backquotes or whatever complex silliness
18:49:11
daemoz
Okay. I'll remove pass-list, use the (cons 'list) trick and remove all the then unnecessary quotes.
18:50:28
daemoz
phoe: I feel it, dude. Definitely pass-list was totally unecessary and I see that. I was just not able to figure out how to make a list out of conses like that.
18:50:37
phoe
but when I was taking my first steps in Lisp, it was people around here who taught me that most of the time, functions are surprisingly good enough - especially that they're fully first-class in Lisp.
18:51:24
phoe
Well, backquote syntax is completely redundant as well. Macros simply return code in form of lists, and you can construct all lists with CONS, LIST and possibly LIST*.
18:51:57
phoe
It's just that in this case LIST is a step up from CONS and `, is a step up from LIST.
18:52:38
shrdlu68
I'm tryig to imagine what code with defmacro everywhere rather than defun would look like, and what it would do.
19:05:02
andyloveslisp
I've successfully parsed a json request into an alist of string. Is there a best practice way of manipulating this to an alist of symbols? I was just thinking of using (intern ..)