freenode/#lisp - IRC Chatlog
Search
8:57:42
jackdaniel
johnnymacs: if there is gcc which can produce webassembly binaries, you could compile ecl or clisp
8:58:48
Shinmera
Anyway, good luck shipping like 10-20mb of wasm CL runtime or whatnot to run your few kilobytes of actual CL code.
8:58:55
jackdaniel
for instance there were builds of ECL to NaCL and pNaCL (obsolete chrome runtimes)
8:59:41
Shinmera
didi: (or symbol function), if you're talking about any function, and not specifically eq.
8:59:45
jackdaniel
Shinmera: given wasm binaries are not much bigger than linux ones, ecl should fit in around 1mb, what is comparable to some js scripts I saw in production
8:59:50
lerax
If someone have interest in Propositional Logic, I've been written this library with some efforts: https://github.com/ryukinix/lisp-inference
9:00:26
didi
Shinmera: Thanks, but I'm specifically talking about eq. Actually, eq, eql, equal, and equalp.
9:02:46
jackdaniel
then if you have time and resolve try compiling ecl and clisp and see how far you can get ;)
9:05:19
Shinmera
Anyway, checking a value for a certain... well, value, with a type, seems just plain wrong to me
9:05:52
didi
Shinmera: Use case: I have a data structure that uses only eq, eql, equal, or equalp as a test.
9:10:11
heisig
lerax: This is a nice little project. Since you decided to represent statements as lists, have you considered using DEFSTRUCT with (:type list)? Then you get accessors and predicates for free.
9:12:15
lerax
This a old project that I'm re-touching this again now. Probably I'll define later better data-structures for this. On those days, I just was trying getting fun with propositional logic and Lisp. Later that I read some books... well, things changed. Yes, I need review that.
9:13:11
beach
johnnymacs: Even if you manage to translate Common Lisp to webassembly, you still need a complete Common Lisp system in the target (I assume a browswer), including all the "library" functions, the memory manager, etc.
9:13:49
lerax
But I don't have sure if defstruct for this specific problem is a good idea because in general manipulating lists sometimes is basic always I need to parsing logic statements... but well, maybe with defstruct I can reduce the verbosity.
9:15:29
heisig
lerax: Unless you are under severe performance constraints and know what you are doing, represent your data with CLOS.
12:19:21
beach
"fruit flies like a banana", but there are actually many more ways of parsing that sentence. It could mean "please measure the time that flies take, just the way that you would measure the time an arrow takes".
12:19:48
beach
Or "please measure the time that flies take, just the way an arrow would measure the time that flies take".
13:06:43
flip214
perhaps that call wasn't inlined because the function definition wasn't available yet.
13:13:01
|3b|
well, can't be much more specific than that, somewhere in the inlined code it didn't know the type of the first argument of something
13:13:39
|3b|
(there could be multiple calls to same inlined function with different notes, do it can't really point you at the original source either)
13:20:13
shrdlu68
|3b|: I would expect it to issue the compiler note when I compile the inlined function itself in that case.
13:21:13
Shinmera
When it inlines it, well, inlines the code, which will lead to different inferences.
13:22:25
Shinmera
For instance (defun foo (a) (typecase a (integer 1) (character 2))) (defun bar () (foo 0)) is going to eliminate the useless branch if foo is inlined.
13:23:41
Shinmera
The optimisation constraints of the inliner are also going to affect the inlinee code.
13:26:32
Shinmera
In the most basic sense think of inlining as copy-pasting the code before compiling for real.
13:52:18
shrdlu68
How do I fix "Unable to optimize because Upgraded element type of array is not known at compile time"
13:53:51
Bike
i don't know what your code looks like, but sbcl might not be smart enough to guess the element type at the access point based on that
13:56:06
Bike
a form being underlined just means that there's a note or warning or whatever about it, btw
13:56:32
Shinmera
you can also hover over the underlining with your mouse and it should display the note
16:29:12
Shinmera
flip214: You can follow development here https://github.com/european-lisp-symposium/els-web
16:32:36
Shinmera
The latter being preferable because it means all your data will be automatically recorded with the transaction.
16:33:32
Shinmera
The bank transfer stuff is annoying because it means someone has to manually confirm that you are you and that you paid your registration.
16:34:42
Shinmera
I don't know what Didier does with his bank stuff and don't think it's my business either.
16:35:04
Shinmera
What I can do is offer CC payment which should be more convenient for both payer and payee.
16:35:44
flip214
is there some easy way to tag strings as different classes? like firstname, surname, street, etc.
16:37:15
Shinmera
Whether a string is a name, street, or whatever depends on who looks at it, so that information should be encoded in the container.
16:39:02
flip214
well, currently I'm storing a list of strings (just to print them out in the same order again)
16:47:09
Shinmera
Or don't store a list of strings, but a list of compund objects that carry that associated information
16:50:18
_death
since strings aren't usually used for their identity the hash-table solution could be fragile
16:50:50
flip214
Shinmera: yeah, that's what I'm doing now... is there a way to embed the string structure in my class slot and not have another indirection, to conserve memory?
16:51:35
Shinmera
A string indirection is free as long as the type is known as the header will just be a constant offset to the contents.
16:56:57
flip214
one of the input files is 19M lines, each being parsed into multiple items... so 2 tagged-strings in a line would be 2*16 byte (?) for the indirection
16:58:24
Shinmera
Besides, if you are sure you need to keep that much data around at all times (rather than, say, stream it), then classes will be too heavy anyway and you probably want structs instead.
16:59:42
Shinmera
My advice would be to investigate other means of processing your data (stream oriented) so that you don't need that much memory to begin with.
17:32:35
asarch
One stupid question: From this chapter: http://www.gigamonkeys.com/book/macros-standard-control-constructs.html
17:33:13
asarch
In the DO section: "As with the variable definitions in a LET, if the init-form is left out, the variable is bound to NIL. Also as with LET, you can use a plain variable name as shorthand for a list containing just the name."
17:34:22
beach
asarch: It means you can write either (let ((x nil)) (let ((x)) ...) or (let (x) ...)
17:34:30
dlowe
it means like you can do (let ((foo nil)) ...) and (let ((foo)) ...) you can also do (let (foo) ...)
17:41:18
beach
asarch: Let me take advantage of your question to point out the (moral, not semantic) difference between (let ((x nil)) (let ((x '()) and (let (x).
17:41:27
beach
In the first case, you initialize x either to a Boolean false value or to some default value. It is fine to use x before assigning to it and to (conditionally) assign to it before using it, but you would not unconditionally assign to it before using it.
17:41:32
beach
In the second case, you initialize x to the empty list. Again, it is fine to use x before assigning to it and to (conditionally) assign to it before using it, but you would not unconditionally assign to it before using it.
17:44:23
beach
asarch: Imagine (let (x y) ... Is that the same as (let ((x y)) or the same as (let ((x nil) (y nil))?
17:46:46
beach
asarch: Because of what I wrote. It could either mean both X and Y to NIL, or binding X to Y.
17:48:52
shrdlu68
The second form would not be possible in a let form that took the form (let (x 1) (y 2)
17:49:05
_death
beach: it wasn't meant as an advice, just an attitude perhaps meant for someone more experienced ;)
17:49:52
shrdlu68
You'd have to always use (let (x nil) explicitly. But as _death points out, it's entirely possible to create such a let macro.
17:53:58
stacksmith
Alexandria's when-let compromises: if you only have a single binding, you can (when-let (a whatever) ...), and if you have multiple, it looks like (let).
17:56:57
stacksmith
The 'founding fathers' could have gone with a lambda-list-like syntax: a name or a list containing a name and an initializer... (let (a b (c 9)) ...)
18:01:51
stacksmith
_death: I am not sure how useful they are - I always wind up with the second form needing unless, for some reason :)
18:28:13
Shinmera
Rational operations typically require reduction after the actual operation, which is likely expensive
18:42:20
asarch
In "(do ((n 0 (1+ n)) (cur 0 next) (next 1 (+ cur next))) ((= 10 n) cur))", is next part of the DO statement?
18:45:27
_death
asarch: cur is zero in the first iteration, and then receives the value of next at the end of the iteration
18:48:27
asarch
Ok. Let's go by parts. Accordingly with the book, the general form of DO is: (do (variable-definition*) (end-test-form result-form*) statement*)
18:49:48
asarch
In this expression "(do ((n 0 (1+ n)) (cur 0 next) (next 1 (+ cur next))) ((= 10 n) cur))", the (variable-defition*) part is "((n 0 (1+ n))", right?
18:52:22
Bike
((n 0 (1+ n)) (cur 0 next) (next 1 (+ cur next))) are the variable definitions. (= 10 n) is the end-test-form. (cur) is the result forms.
19:02:50
oleo
well if the one of the variables is not what you return, but you rather accumulate in the body or so....that can be done yes
19:06:37
stacksmith
Can anyone think of a reason why SBCL compiles an extra check against structure layout when one would do? Given a structure mytype, an expression (if (mytype-p foo) 1 2) results in a double conditional, with two different things compared to <SB-KERNEL:Layout for MYTYPE>?
19:08:17
stacksmith
I cannot decipher the indirections. In one case it's RAX after some loadings, in the second case, an indirect DWORD PTR [RAX+17] in my case.
19:12:07
_death
such a question should include the form, its disassembly, your expectations and the deviation
19:14:47
stacksmith
_death: true enough; however, in absence of inheritance what would _ever_ be a reason to check type more than once? It is more of a philosophical question - or a puzzle if you will, as in can you think of a scenario where checking exactly twice makes sense?
19:17:25
stacksmith
I've run across this a few times, leading me to veer away from dispatching on type and storing redundant type data in structures when optimization is necessary... But I just cannot think of a reason why...
19:18:56
stacksmith
Bike: it compares something against the 'layout' twice, and there is an extra conditional
19:21:22
Bike
i'm looking at a similar diassembly. it looks like it compares with the layout, then jumps to a return if the comparison succeeds.
19:22:49
stacksmith
With (speed 3)(safety 0)(debug 0)? I have 4 conditional jumps and 5 labels in my disassembly of (defun xtest (obj) (declare (optimize (speed 3) (safety 0) (debug 0))) (if (ldesc-p obj) 1 2))
19:24:43
_death
stacksmith: the first comparison may be for the object being of the exact type mytype (the usual), the second comparison may be needed for proper subtypes..
19:26:11
stacksmith
that's what I thought, but there are no subtypes, and SBCL knows that. I can see CLOS checking just in case something changes, but structs...
19:27:36
stacksmith
Bike: true, but structs are not generally too forward-looking in my experience, unlike CLOS.
19:28:07
Bike
many kinds of redefinition are forbidden, but that doesn't change the fact that you could define a subtype
19:34:48
_death
"The sb-ext:freeze-type declaration declares that a type will never change, which can make type testing (typep, etc.) more efficient for structure types."
20:01:12
Josh_2
Does CLX let me get the position of my mouse in my current x session or only in one created with CLX?
20:01:34
flip214
Shinmera: stream oriented isn't possible, some early data might need fixing up when the later items are processed...