freenode/#lisp - IRC Chatlog
Search
7:01:59
Demosthenex
i was just reading https://stackoverflow.com/questions/1403717/how-do-i-iterate-through-a-directory-in-common-lisp where someone says cl-fad doesn't handle symlinks, but the cl-fad docs i was browsing says it can optionally follow them...
7:07:34
jackdaniel
osicat is another solution (it is also ffi based, but it doesn't libfixposix) which behaves thesame on all implementations
7:30:52
jackdaniel
ffi gives you uniform behavior, because you aim directly at your operating system interfaces
7:31:19
jackdaniel
so there are divergencies on how these chapters are interpreted by different CL vendors
7:32:36
jackdaniel
iolib uses library called libfixposix which fixes some inconsistencies between POSIX implementations (hah!)
7:33:39
Demosthenex
i'd have used the default or cl-fad, but i don't do much with files atm, still learning
7:33:56
Demosthenex
it only came up because i was discussing finding files in a dir via wildcard with Blackbeard
7:34:48
Demosthenex
cheap plug: i'm loving stumpwm. its so cool to be able to connect slime to my WM and update it live
7:36:49
Demosthenex
and being able to port over several pages of lua code for awesomewm for my window management into a single function was enlightening
7:51:06
|3b|
trying to make a large file smaller, currently saves ~50MB with normal *print-circle* on individual forms, but still lots of repeated keywords
7:53:57
heisig
Just for fun, have you tried converting the data to a single quoted literal in a file and compile it to a fasl? Then the compiler would coalesce the shared structure for you :)
7:54:09
|3b|
maybe i should just leave it as 108MB of readable source instead of 50MB of line noise :p
7:54:34
|3b|
fasl isn't really suitable for checking into git repo though, particularly if i ever want to upgrade my lisp :)
7:55:52
|3b|
ACTION could also try to combine circularity between forms, but that would probably require writing it out and reading back in, which would lose formatting
7:56:46
Shinmera
|3b|: Still not as big as the fasl qtools generates if you precompile all qt method wrappers
7:57:10
|3b|
something like 4.5k defpackage forms + same # of forms to specify how to call the methods named by the packages
7:59:18
|3b|
ggole: i'm writing a cl-like compiler targeting dalvik bytecode, and this is the FFI definitions for the android APIs
7:59:48
|3b|
Shinmera: maybe i should just generate the .fasl directly from the .jar file and check that in instead
8:01:01
|3b|
though probably a bit slower to load jar, parse it and generate package defs than to read and compile the generated lisp file
8:02:54
|3b|
compiler has exactly enough to compile calls to a superclass, or to methods of arbitrary class, passing either arguments to the method being defined or literal integers, assuming all have type declarations :p
8:04:01
|3b|
which is enough to define an onCreate method that sets the view to a hello world screen defined as a resource
8:05:56
Shinmera
what's your ultimate end-goal? The Android API is so unbearable that I don't know if even writing Lisp could fix that
8:08:29
|3b|
few small utilities, like scanning a barcode and sending to a web server, and also playing with the android AR stuff
8:12:11
|3b|
don't really /need/ the barcode thing, and the AR stuff is as much for fun as anything, so if i'm having similar fun writing compilers i might as well :)
8:12:49
|3b|
hmm, parsing the .jar file is only ~2sec if it doesn't spam debug prints, that isn't too bad
8:13:05
Shinmera
I was just having horror flashbacks to writing Ocelot, an Android client for the Lichat protocol
8:13:28
|3b|
ACTION wonders how hard it would be to build the defpackage and ffi info directly from it instead of printing it to a file
8:14:39
|3b|
not sure how hard it would be to get a monitor running on android that i could send chunks of code to for interactive dev from slime
8:16:24
|3b|
ACTION things it has an API for runtime loading from memory, but not sure how it interacts with attempts at redefinition. might need a dev mode where stuff calls stubs i can redefine or something
9:53:19
phoe
I have a protocol class named MESSAGE. It's going to be subclassed many times to create concrete classes representing different kinds of the messages in my system.
9:53:58
phoe
Messages are also going to have responses - if there's a message named HELLO, then there are going to be responses named (OK HELLO) and (ERROR HELLO).
9:55:34
no-defun-allowed
well i want to create a class programatically, so i can take a netfarm schema and create an equivalent CLOS class
9:56:15
phoe
I kind of want a dual inheritance scheme, where each message can be named after its class - HELLO, LOGIN, LOGOUT, SEND, ... and so on
9:57:00
phoe
But I also want each message to have this "state" - it can either be a normal message (NIL), be a confirmation to an earlier message (OK) or an error reply (ERROR)
9:58:35
phoe
Shinmera: did I? DEFCLASS makes a new instance of the CLASS object and gives it a global name
9:59:34
no-defun-allowed
i can make an anonymous function with lambda, is there a similar thing for classes?
9:59:39
beach
no-defun-allowed: http://metamodular.com/CLOS-MOP/initialization-of-class-metaobjects2.html
9:59:57
shka_
phoe: i think that you can simply create operation class and then have generic function called message that will simply dispatch on operation and accept &rest arguments
10:00:04
phoe
Anyway - in my use case, I'll have messsages named HELLO, (OK HELLO), (ERROR HELLO), LOGIN, (OK LOGIN), (ERROR LOGIN), ...
10:00:58
phoe
Anyway - it makes sense to me to have mixins for MESSAGE, OK-MESSAGE and ERROR-MESSAGE, and then the hierarchy HELLO, LOGIN, LOGOUT, SEND, ...
10:01:46
heisig
shka_: I am not sure whether I will use lparallel for managing my threads or not. It is certainly a great library. I use it mostly for its utilities, like queues and promises.
10:01:53
phoe
But this means that I'll need to define classes like HELLO, OK-HELLO, ERROR-HELLO, ..., which causes me to define 3*n classes in total. This looks like combinatorial explosion to me.
10:02:47
Shinmera
phoe: what I do in Lichat is I define error classes for specific circumstances and tag every message with a unique id that others can reference
10:03:46
beach
no-defun-allowed: It is a bit involved to do that. You need to read that page and a few more to understand what you need to do.
10:04:36
phoe
To avoid creating statuses, I could use keywords and EQL specializers, methinks. (NIL :OK :ERROR) sound like a good choice.
10:06:02
phoe
shka_: my status would be a very dumb object though, it's literally a member of (NIL :OK :ERROR).
10:07:16
shka_
anyway, you can simply abstract this in make-message where you are accepting operation and status symbol
10:09:31
shka_
because :error appears to be something that should contain some sort of description of what wen wrong
10:10:21
no-defun-allowed
i might need to do more reading but to make the slot you need the class definition and to make the class you need the slot definition
10:10:44
phoe
no-defun-allowed: you might want to read AMOP, where a CLOS-like object system is implemented in raw CLOS-less Common Lisp
10:11:14
phoe
basically, you can go from a CLOS-less Common Lisp to a CLOS-ful Common Lisp using nothing but the facilities embedded in the language
10:11:42
shka_
it has it's default implementation and it is really nice, but it is not the only possible
10:13:36
beach
no-defun-allowed: I am in the middle of implementing CLOS, so I have much of that relatively fresh in my head. So let me know if you need help.
10:14:10
beach
no-defun-allowed: If you had read up on that, you would have seen that they are just lists.
10:15:32
beach
"Each canonicalized slot specification is formed from the corresponding slot specification as follows: ..."
10:15:33
no-defun-allowed
the example on http://metamodular.com/CLOS-MOP/initialization-of-class-metaobjects.html is handy
10:21:00
Demosthenex
so anyone here using sly? worth trying as a n00b, or functional enough to get by?
10:21:58
jackdaniel
some people are using it (here included) and they seem to like it more than slime
10:21:59
Xach
Demosthenex: it has a lot of cool features and is probably easier to try for someone new than someone with a lot of slime muscle memory
10:22:28
Xach
I want to use sly more but I have a tension between wanting to be as productive as I am with slime and learning a different way
10:24:47
phoe
Is there any way to print only N first characters of an object's printed representation?
10:25:29
phoe
For (1234567890) if I want to print only five chars, I'd like to get "(1234.." or something similar
10:27:47
jackdaniel
four riders of the apocalypse: loop, format, clos and clim, none intelligible (half joking ;)
10:32:48
jackdaniel
phoe: if you make something of your own, take into account, that if it fits it sits. if you'd like to have at most 5 characters, then it would be "(12.."; but for (123) you should have full "(123)"
10:36:50
jackdaniel
McCLIM has quite elaborate transformations api which as everything one would need (given we take only transformations into account)
10:37:54
Xach
Shinmera: oh, that is so easy you could almost accidentally write it from scratch every time!
10:38:41
Shinmera
yea, which is why there's already so many matrix-y libs out there (plus innumerable ad-hoc ones, I'm sure)
10:50:05
jackdaniel
currently software renderer uses cl-vectors, but vecto api looks like a hit for it
10:50:51
cods
Xach: hi. Is someone maintaining cl-vectors these days? I doubt it was perfect as is :)
10:51:35
cods
I was supposed to convert the documentation to something more usual at some point, but never took the time to do it.
11:07:02
Xach
jackdaniel: http://report.quicklisp.org/2018-09-27/failure-report/mcclim.html#mcclim-raster-image fyi
11:12:20
Xach
jackdaniel: how about mcclim-clx-fb? http://report.quicklisp.org/2018-09-27/failure-report/mcclim.html#mcclim-clx-fb
11:20:24
Xach
cods: thank you, by the way, for making cl-vectors etc perfect so quickly, because i have been able to use it for so many happy things over the years
11:20:51
Xach
cods: my latest project involves making real roadside signs out of vinyl, paint, and wood, and it started from a program powered by cl-vectors
11:22:41
jackdaniel
Xach: will you be willing to accept such PR? or there is already a way to achieve that?
11:23:12
eminhi
Hi, I'm browsing sbcl source and came across, (declare (explicit-check)). What is this used for?
11:24:14
jackdaniel
eminhi: it looks like sbcl-specific interface. probably enforces checking declared variable types despite (i.e) succesful inference
11:25:27
no-defun-allowed
I guessed the opposite but that's less reasonable: type checks are explicitly required.
11:30:37
scymtym
jackdaniel: eminhi: it means arguments should not be checked against the declared ftype in the function prologue because the function body will perform an explicit check (hence the name) and error signaling itself
11:41:07
eminhi
sbcl has many instance of code like, (defun 1+ (number) (declare (explicit-check)) (1+ number). recursive without checks?
11:42:04
beach
eminhi: As I understand it, there are primitives that are directly known by the compiler, like CAR and CDR. I guess 1+ must be one of them.
11:44:20
beach
No, it's that (1+ number) does not mean "Call the function 1+ with the number" to the compiler. It means, generate code for what you already know about 1+.
11:45:59
eminhi
What happens when 1+ is used elsewhere in the same file? compiler generate code or defun application?
11:47:05
beach
I am not the right person to answer, because I don't know the details. But, as I understand it, wherever 1+ is used in a function-call position, like (1+ <any-form>), the compiler recognizes 1+ and just generates code for what it means.
11:47:14
no-defun-allowed
The same logic applies. If the function is declared inline, the compiler can optimise as much as it wants out of it.
11:48:16
scymtym
eminhi: 1+ is present as an ordinary function (in case it is called indirectly) and as compiler-level construct, a "source transform" (SLIME's M-. will show all of those). the function is implemented in term of the source transform, therefore the apparent recursion
11:49:13
scymtym
eminhi: asking SBCL-specific questions in #lisp is not the best approach. study the code and ask in #sbcl if you get stuck
11:53:40
no-defun-allowed
How does :initfunction work in the canonical direct slot specification work?
11:54:10
no-defun-allowed
By the looks of things initform is pretty useless and initfunction is a thunk which evaluates to the wanted default value.
11:55:35
Xach
jackdaniel: i would accept the pr, sure. you can snoop on the 8-bit sample image data by using :: right now but I understand the interest in a supported option.