freenode/#lisp - IRC Chatlog
Search
14:17:25
jmercouris
this is an opinion question, I have a system file where I have a base system next, with systems next/cocoa and next/gtk. next/cocoa includes customizations necessary for next/cocoa
14:17:45
jmercouris
you CANNOT load next by itself because it assumes some functions will exist, should I provide default implementations of those functions?
14:20:15
|3b|
though sounds more like it would be better to rename it to be more obviously not the whole thing
14:21:00
loke`
jmercouris: you could always create three systems: root/gtk, next/gtk and next. root/gtk would depend on next/gtk followed by next. SO the thing you'd load is root/gtk if you want the gtk one.
14:21:01
|3b|
maybe add another system that tries to guess which of gtk or cocoa would be more useful
14:21:04
jmercouris
here's another good question, do you think I should use conditional reader macros, or separate sytems?
14:21:42
jmercouris
I want the user to be able to just (ql:quickload :next) and it automatically loads the appropriate files depending on OS
14:21:58
|3b|
or else rearrange them so next/gtk and next/cocoa are what you load to get a working setup (so would load internal /gtk or /cocoa system, then load main system)
14:22:03
jmercouris
which is why I'm leaning away from using 3 systems, as I currently have, and just using conditional macros
14:22:56
jmercouris
here's the file: https://github.com/atlas-engineer/next/blob/remote-gui/next.asd
14:25:27
|3b|
if it is just 1 file, and you can easily detect it from *features* (like always cocoa on osx, otherwise gtk), i'd probably just move the specific file to :next system with :if-feature
14:26:20
|3b|
then you would have a next/release with similar feature check to load the correct -release file
14:27:07
jmercouris
and I'll make the if-feature check gtk for linux and bsd, and then cocoa for darwin
14:42:28
jackdaniel
then why won't you provide a minimal example project with files, so others may try to help troubleshot it?
14:48:26
|3b|
but does look right comparing with https://github.com/nikodemus/sb-cga/blob/master/sb-cga.asd#L32
15:06:37
jmercouris
so I had the syntax right, it just wasn't working the way I was expecting due to the mac os being also part of :unix within the if
15:16:51
jmercouris
I am support anything that runs GTK, which could be just about anything except darwin
15:17:10
jmercouris
so yeah, what you wrote, above is what it will have to be (:and :unix (:not :darwin))
15:20:40
makomo
what's the usual way to configure a build in the lisp world (well, ASDF world), i.e. the equivalent of CMake's configuring process or Make's ./configure script?
15:20:44
pjb
jmercouris: (eval-when (:compile-toplevel :load-toplevel :execute) (defun gtk-present-p () (not (not (some (lambda (libdir) (directory (merge-pathnames "**/libgtk*.*" libdir))) '("/lib/" "/usr/lib/" "/usr/local/lib/" "/opt/local/lib/")))))) #+#.(cl:if (cl-user:gtk-present-p) '(:and) '(:or)) (do-something-with-gtk)
15:21:32
jackdaniel
makomo: there isn't (except pushing features and doing what jmercouris does) or adding some ad-hoc method to asdf
15:22:10
jmercouris
the names are a red herring, they are just compatibility layers for how to interpret keybindings from those systems
15:23:59
makomo
jackdaniel: ah :/, so basically you would have some project-specific features you would push then?
15:24:11
pjb
jmercouris: perhaps you could avoid using gtk (at least directly). Have a look at: https://cliki.net/pgl
15:24:54
jmercouris
okay, so I have a cross-platform lisp core that depends on absolutely nothing at all
15:25:18
jmercouris
on Linux I've written a GTK front-end GUI that listens via XML-RPC, on MacOS I've written a Cocoa front-end GUI that listens via XML-RPC
15:25:30
pjb
jmercouris: pgl is written in pure lisp, with as only dependencies the packages: "TRIVIAL-GRAY-STREAMS" "BORDEAUX-THREADS" "ORG.MAPCAR.PARSE-NUMBER".
15:26:03
jmercouris
for it to make any sense to run Next on a non-darwin system, GTK must exist so that the GTK front-end can run
15:26:16
jmercouris
so no, my Lisp program does not directly depend on GTK, only on its sister program, its port
15:27:56
jmercouris
I see it as a different way, I am agnostic of any FFI implementation, and I can run across a network etc
15:28:09
jmercouris
I don't depend on the front-end not crashing, the Lisp core will always be stable
15:28:39
jmercouris
I think it is a very intelligent design, and I get to say that, since it is not my own
15:29:25
jmercouris
the only interface one must implement is a simple API within the Port to support some commands from the Lisp core such as make window, make buffer, etc, it is all abstracted on a very high level
15:30:04
jmercouris
I didn't spend 9 months contemplating this to do something absolutely idiotic, perhaps think for a few minutes why I might have done this before dismising my work
15:31:39
jackdaniel
people spend decades working on things which are not very smart; but since it seems to tick you off, I'll get back to whatever I was doing
15:32:50
jmercouris
I'm upset because I have worked many hours with a lot of thought, and you come in, without any context or understanding of the program architecture and make a blanket statement, it wasn't one with intent to understand, but with intent to injure
15:39:30
jackdaniel
I've criticized the approach, not you, but I'm not much into drama so I'll step aside. keep in mind, that bashing out at people who criticize things leaves you either in hostile environment or in an echo chamber
15:40:55
jmercouris
you appear sincere in your statement, I take it as a criticism of the approach, then
15:41:33
jmercouris
and I'm hardly one to stick in an echo chamber ignoring feedback from others, Next has been now rewritten 5 or 6 times at the behest of the suggestions from people in this channel
15:42:21
jmercouris
https://source.atlas.engineer/view/repository/next you can check out the remote-gui branch
15:42:37
jmercouris
loke`: the backend is agnostic, there will be multiple built, the first one is GTK
15:45:49
loke`
jmercouris: for it to actually play nicely with CLIM, the individual components needs to be represented as CLOS objects somehow though. Like buttons on a web page, or even a DIV, for example.
15:47:05
jmercouris
there is a lot to say about the port architecture and how to implement a port, I think we'll write a blog article
15:48:55
loke`
jmercouris: Might be an interesting experiment. A CLIM-based full operating environment is something that would be really nice, and something I'd like to work on at some point. I am, however, realistic enough to note that an environment without a "full" browser is not going to be complete, and I'm certainly not going to be able to write a full browser in Lisp, so this may be a workable alternative.
15:50:47
jmercouris
loke`: yes, that is my reasoning as well, that is why I leverage the work of other port maintainers, otherwise I would be constantly chasing the html spec, which in ofitself would be hard to implement efficiently
15:51:02
jmercouris
that is something that I see as "down-the-road" work, if possible, and if there is a lot of money available
18:09:16
jcowan
I do wish I could coerce eval-when into properly marking a macro-expansion-time only function, but I can't find any combination that works.
18:10:02
margaritamike
Hey, folks! Good news! Someone is having a look at the submission of using SBCL for Kattis! There is one issue, though. The output of the given solution is spitting out an unnecessary newline. Does anyone know how I could fix the solution to not spit that newline out at the beginning? The solution I'm talking about is here: https://github.com/optimisticlisper/kattis_sbcl_different/blob/master/accepted.lisp
18:10:20
margaritamike
It is meant for the following problem: https://open.kattis.com/problems/different
18:10:52
margaritamike
If you were to provide the input in a file named 'in', it can be run with the following command sbcl --dynamic-space-size 1024 --control-stack-size 64 --script accepted.lisp < in > out
18:11:15
margaritamike
Or if you prefer to see results printed in terminal, sbcl --dynamic-space-size 1024 --control-stack-size 64 --script accepted.lisp < in
18:12:38
margaritamike
I am not very good at common lisp, but am trying to get it added to the Kattis platform to use as a learning tool on the wonderful problem base Kattis has. I believe it will be beneficial for others too, seeing it as an available language to solve high quality problems on this online judge and help in increasing its popularity.
18:13:23
margaritamike
Would anyone happen to know how I could avoid that first new line from being spit out when running it against test data?
18:15:25
jcowan
It's because PRINT for hysterical raisins is implemented as a newline followed by the things to be printed, unlike print/println in most languages which put the newline at the end.
18:16:51
margaritamike
Is there an alternative to print that does not print a newline first? One of the admin/owner of Kattis has mentioned it is likely to break a lot of problems if there is not a reasonable way to avoid this newline.
18:20:52
|3b|
ACTION would probably get rid of the --control-stack-size 64 too unless you have some specific need for it
18:21:16
margaritamike
|3b|: I am keeping that stacksize because some problems can be pretty memory intensive.
18:22:05
margaritamike
This is their runtime settings: -XX:+UseSerialGC -Xss64m -Xms{memlim}m -Xmx{memlim}m -Dfile.encoding=UTF-8 -cp {path}
18:22:50
|3b|
(which is probably a reasonable assumption, those sorts of things tend to not need threads, or at most 1 per core)
18:25:02
|3b|
and CL has pprint, which might layout forms reasonably (or might not, depending on implementation and forms)
18:27:01
margaritamike
What executes faster? (format t "~a~%" (abs ...)) or just using (terpri) after (prin1 ...)?
18:28:31
margaritamike
Luckily this platform will be able to show memory usage and time taken to execute a program, so good for testing things! :)
18:28:38
|3b|
ACTION would expect format with constant format string to use formatter to generate something reasonably fast for simple cases like that
18:29:18
jackdaniel
yes, but it boils down to producing basically prin1 + terpri (and there is no guarantee of that)
18:29:26
jcowan
|3b|: You'd hardly be printing symbols in the solution to a portable (i.e. lowest common denominator) problem
18:54:57
jackdaniel
preferably one (or two) deftype, one small function definition and example witha a call to it
19:01:51
beach
v0|d: I am planning to submit 2 or 3 papers (co-authored). I don't know that there is a focus.
19:18:59
dim
jackdaniel: I had a working session of McCLIM on my laptop for the first time, I'm pretty excited ;-)
19:19:32
margaritamike
Thanks for the help folks. I hope that soon I'll be able to say Kattis supports SBCL
19:20:06
jackdaniel
dim: cool! if you have any problems (hopefully not!) you may find help on #clim channel (or here of course)
19:20:33
margaritamike
If it does support SBCL, I can't wait to compare the solution to C++ and Java solutions to see the difference in speed and memory use.
19:20:40
jackdaniel
in a matter of days we hope to merge improved text rendering branch if you are into this stuff (kerning, transformations etc)
19:21:34
jackdaniel
margaritamike: fwiw stassats is an expert in code golf (he beat some problem solving records using sbcl afair)
19:21:58
dim
jackdaniel: some of the rendering is strange really, when frames don't fit in the screen size, but well, that's from clicking around in the demo
19:27:19
dim
jackdaniel: where can I find hints starter-kit about doing things in the McCLIM listener like drawing simple shapes or custom presentations? say I want to code a game of minehunt
19:27:37
margaritamike
I thought it was sometimes on par with C or C++ in speed, and mostly faster than Java.
19:27:51
jackdaniel
dim: I don't know about the game of minehunt, but in clim-listener you may treat *standard-output* as a CLIM stream
19:28:15
jackdaniel
so for instance you may call (draw-rectangle* *standard-output* 100 100 150 150)
19:29:00
|3b|
it can compete well with C/C++, but for example default I/O might be be doing things you wouldn't have in C (like UTF8, with restarts for handling decode failures) that slow it down
19:29:03
jackdaniel
I think that best place to learn are Examples/ (quickload clim-examples and run (clim-demo:demodemo) )
19:30:46
jackdaniel
dim: check out file Core/clim-basic/text-selection.lisp ; shortcuts are listed there
19:31:03
|3b|
also SBCL has a relatively slow compiler (at least compared to other CLs), and you are probably compiling code for every run which might slow things down if C is getting a separate free compile step not counted in the timing
19:31:18
jackdaniel
these things are semi-internal right now, when we get to it we may change the gestures or how they are handled)
19:31:41
elderK
Guys, are there any particular rules about what the predicates for satisfies can expect?
19:31:59
elderK
:) I'm trying to make a type that ensures that values are a non-zero multiple of eight :)
19:33:44
dim
anyway I have to be AFK for awhile, I will try and learn things with McCLIM and maybe do some visual programming in CL, games and things suitable for teaching programming to the kids ;-)
19:48:11
margaritamike
So everytime you want to pass it input, it has to recompile instead of reference an executable like a.out with C?
19:52:45
|3b|
(well, sbcl has some heuristics to try to avoid compiling trivial things, but generally it compiles everything)
19:53:36
|3b|
it does some things like disabling the debuggers, and exiting when it finishes instead of leaving you in a rfepl
19:54:55
|3b|
on errors you want it to just print some message and exit, so disabling debuggers is good
19:55:43
margaritamike
so instead of sbcl --dynamic-space-size {memlim} --control-stack-size 64 --load {path}
19:55:50
margaritamike
i want sbcl --dynamic-space-size {memlim} --control-stack-size 64 --script {path}
19:57:23
margaritamike
i need to push changes to that repo to reference --script instead of load, though
19:59:27
jcowan
elderK: The main thing with SATISIFIES is to be sure the predicate can accept *any* object and not, say, just numbers.
20:00:27
jcowan
so you may need to say something like (and (numberp x) (foo x)) in the definition of the predicate (it won't work to use AND in the type expression because it is unordered)
20:02:37
elderK
jcowan: Thank you jcowan. Knowing this, is there any reason to use and in combination with satisfies in a deftype?
20:03:21
jcowan
(and (satisfies thisp) (satisfies thatp)) comes to mind. Just make sure there is no dependency between the two
20:03:52
jackdaniel
if object is known to not be of type foo, then you may decide without invoking arbitrary function
20:04:16
jackdaniel
i.e (and integer (satisfies bloop)) ; bloop may be expensive, but we may know that #\c is not an integer
20:28:45
aeth
jcowan, elderK: Depending on the compiler, (and (integer 0 32) (satisfies foo)) might be the way to go even if #'foo then repeats the test because now the compiler knows it's an integer from 0 to 32.
20:31:45
aeth
(You'd pay more in the test, but get faster generated code in those two cases, and maybe just those two cases. I'm counting all numeric types that aren't bignum as "non-bignum numbers" here, not just fixnums.)
20:52:28
margaritamike
Anyone know if common lisp is a suitable language for cyber security, or know of instances of it being used for such?
20:53:13
margaritamike
I see python is starting to be used as a generic scripting language as a replacement for bash and windows scripting
20:54:06
margaritamike
i wonder if common lisp could do all the things python does here https://github.com/Gallopsled/pwntools
20:56:04
margaritamike
Inline: in what sense then? Obscurity? In what since do you think i'm referring to? I was asking in terms of being a fast automation tool as a replacement for what python is typically being used for in cyber right now
21:18:24
Xach
i like working with real objects and real conditions and stuff. sbcl's run-program makes it nice and it is easy to wrap to make common things simpler.
21:19:53
aeth
It depends on the length of the program. Nothing beats bash for one-liner scripts. bash does in 1-20 lines what anything else would do in hundreds. Once you're doing something substantial, though, I definitely wouldn't want to touch bash. (I say bash because bash's extensions make sh more usable so usually such scripts specifically run bash)
21:20:36
Xach
I'd really really like to wrap the pty capability of run-program into something like Expect but for SBCL.
21:20:57
Xach
unfortunately the pty stuff seems to be broken on macos for me, and that's where i do 99% of my hacking to start.
21:28:42
v0|d
I dont prospect anybody building a replacement for autotools in near future, hence bash will stay as it is.
21:43:19
jcowan
With the drastic shrinkage of platforms and increasing standardization, autotools is IMO obsolete. Set up the sensible cases and if someone wants to run it on their VAX running 4.0bsd, tell them to provide their own Makefile.
22:36:00
elderK
Man, I'm having trouble wrapping my head around what I need to be available at compile time, load time and execute time :|
22:36:27
|3b|
ACTION thinks it usually isn't worth bothering, since those times tend to overlap too much
22:37:04
elderK
Like, I've written a bunch of stuff. And, most of my macros expand into stuff that doesn't have an eval-when. Because, well, it's not necessary.
22:37:43
elderK
But for another macro, my define-binary-structure, I need a bunch of that information available at compile-time.
22:40:33
jcowan
elderK: If a function is called by a macro, wrap it in triple eval-when; otherwiser not.
22:41:22
elderK
The thing is, like, so far at least, all these "type metathings" are being added to a hash table at runtime, I guess.
22:42:03
elderK
It would be smarter to persist that information, if you say, save your stuff to a FASL.
22:46:07
|3b|
it isn't quite like a .o file in C, since loading it still has all the side effects you would get from LOADing the original .lisp file
22:46:24
elderK
And, like, let's say you ARE doing a bunch of stuff at runtime that's costing a lot of time. Now for a binary-types type library, a lot of the types a user defines will be known when they compile their program. That information could be persisted, and somehow... thawed on load, without having to go through re-executing all the stuff to recreate hte metadata. If you /did/ wanna persist it, so that loading was
22:46:41
|3b|
and it can store some fairly complex data structures, which requires more effort than just mmapping it into memory
22:49:54
|3b|
probably depends on specifics, maybe just a variable in .fasl, maybe in a separate file
22:51:33
|3b|
for example in the case of binary parsers, it would be complicated since you'd probably have data from a bunch of different files
22:52:37
|3b|
but maybe you could do something like caching them per thing that uses it in a way that was quick to merge into the main data set
22:58:51
elderK
:| Man. What started off as something so simple (define-binary-structure), I've wond up spending like, four hours just thinking...
23:04:17
jcowan
Is there any straightforward way to load the whole of Quicklisp so it can be searched?
23:05:44
pfdietz
The problem is that various systems in quicklisp are incompatible, due to package name collisions.
23:06:16
elderK
|3b|: This is my first "real thing" other than, like, the school assignments I was redoing.
23:06:35
elderK
|3b|: I don't have any ambitious things in my little binary library, just the same stuff that's in binary-types really.
23:06:55
pfdietz
I have 'kind of' loaded all of quicklisp, but only in a quick and dirty way to get stuff that looks like lisp for mutation testing purposes. This doesn't have to really read the lisp, and bails out if it encounters any reader errors.
23:07:00
elderK
Just, it's my one. And it has a few things different that are more suited for what I want to do, and how I Want to use it
23:08:27
pfdietz
I think it should be possible to do better, using Eclector and being smarter about things. But in general reading a lisp file may depend on setting up arbitrary lisp capabilities for the reader macros.
23:09:01
Xach
I think the way to go is to load each in turn and use sbcl's introspection to dump a searchable offline database.
23:09:27
|3b|
elderK: yeah, just a potentially complicated task if you want to handle all the odd things various binary formats do
23:09:47
pfdietz
It was pretty hacky. I had to be able to handle undefined packages, so I hacked the SBCL reader to just use *package* when it found a package it couldn't recognize.
23:11:13
pfdietz
I put in a ticket to enhance the SBCL reader so there were some useful restarts for the package not found error, but that hasn't happened yet.
23:12:23
Xach
I've mentioned it before, I'd really like a query system for the image so you could ask things like "show me all functions with two arguments" or "show me all functions with an argument named DOG" or other things (not necessarily only about function argument lists!)
23:13:14
Xach
i think the advantage of load + dump is you don't have to try to fake loading and work around reader macros and package problems.
23:15:39
Xach
the stuff needed to support M-. and who-calls and who-references could be fun to query arbitrarily
23:22:52
fiddlerwoaroof
elderK: I wrote a little thing that's sort of like what you're doing, if I understand correctly
23:25:22
fiddlerwoaroof
The usage looks like this: https://gist.github.com/fiddlerwoaroof/dc1cfe4738a9d82d48bce6046af53fbe#file-zipfile-lisp-L113
23:25:39
fiddlerwoaroof
Here's how I define the format: https://gist.github.com/fiddlerwoaroof/dc1cfe4738a9d82d48bce6046af53fbe#file-zipfile-lisp-L81
23:25:59
fiddlerwoaroof
And here's the entrypoint of the parser: https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/bin-parser.lisp#L78
23:48:06
jcowan
Of course the code has long since rotted and was never Maclisp compatible in the first place, but it shows what could be done by introspection
23:50:32
jcowan
http://www.softwarepreservation.org/projects/LISP/interlisp-d/3100186-Interlisp_Oct83.pdf pp. 351-372 (of the PDF)
0:35:33
fiddlerwoaroof
elderK: if I had to guess, you're not properly escaping # when you call xdg-open
0:41:08
jcowan
I'm still trying to get a list of all quicklisp projects. (ql:system-apropos "") returns only 73; using quickdocs with an empty search field returns only 0. What's the righteous way to do this?
0:41:50
fiddlerwoaroof
git clone https://github.com/quicklisp/quicklisp-projects && ls quicklisp-projects/projects | wc -l
0:45:57
fiddlerwoaroof
I was wrong anyways, it looks like source-disabled.txt is used in cases where there is an old repository
0:52:55
fiddlerwoaroof
Hmm, that's going to be a bit tricky to do precisely, without reading in the source
0:57:43
pfdietz
(length (remove-duplicates (mapcar #'ql-dist:release (ql-dist::provided-systems (ql::dist "quicklisp"))))) ==> 1682
1:09:50
jcowan
okay, created a shell script that repeatedly calls sbcl --disable-debugger --eval '(unwind-protect (progn <import ql> <load project>) (quit)'
1:18:22
pfdietz
Goodness. ql-dist::dependency-tree can produce a very large tree for some systems. Need a dependency-dag.
1:31:20
pfdietz
There are just 344 systems in the current ql dist that are not in the required-systems list of another system.
1:48:42
aeth
pfdietz: It might be better to use projects as the basic unit and see if there are any projects where every contained system in that project is not depended on by any external project's systems.
1:58:27
fiddlerwoaroof
I believe ql-dist::provided-releases gives you all of the quickloadable projects