freenode/#lisp - IRC Chatlog
Search
23:50:11
margaritamike
I'm not sure if anyone remembers from last time, but I'm hoping to get Common Lisp added to more competitive programming websites, where you can solve algorithmic problems. The effort is progressing for Kattis and there is a possibility of getting SBCL added to Codeforces as well. I was asked a technical Lisp question I did not have the experience to answer. I'm hoping someone could help, because it seems like this may be
23:50:11
margaritamike
the last technical portion in the way before SBCL is added to the Kattis online judge. The question is kind of long so I put it on paste bin
0:13:03
pjb
margaritamike: for multi-file submissions, it would be better to use asdf to deal with compilation-time loading of the dependent files. Otherwise I would add load compile-file of hello in main at compilation-time: https://pastebin.com/2wL73rxc
0:14:47
pjb
margaritamike: notice that in this case, hello.lisp is compiled twice: once when compiling main.lisp, and once when compiling hello.lisp independently. asdf would avoid that. (or using a more complex form in eval-when :compile-toplevel, such as testing for the presence of fasl and timestamps.
0:21:42
pjb
It's ok. asdf is included in sbcl. It can be used to load the system provided by the user.
0:24:40
pjb
asdf = makefile. If they allow multi-file submissions, perhaps they already allow Makefiles for other languages? Otherwise the problem we have to solve is the compilation-time dependencies between the files. We need to load some files into the compilation environment of others (kind of like #include, but we have to compile the included files too).
0:25:50
pjb
Oh, it is also possible to (defparameter *default-pathname-defaults* #P"/src/") to avoid the explicit merge-pathnames. This could be put in ~/.sbclrc.lisp, if --no-userinit is removed from my commands.
0:27:59
pjb
or: sbcl --noinform --non-interactive --no-userinit --eval ' (defparameter *default-pathname-defaults* #P"/src/")' --load /src/main ; then main.lisp could contain just: (eval-when (:compile-toplevel) (load (compile-file "hello"))) (eval-when (:load-toplevel :execute) (load "hello"))
0:28:39
pjb
In any case, it would be a good idea to add this --eval ' (defparameter *default-pathname-defaults* #P"/src/")' to all the sbcl commands, even when using asdf.
0:30:06
pjb
Well, unless it is expected the programs will have access to files in the current working directories. In that case, it may be better to leave (defparameter *default-pathname-defaults* #P"") which is the default.
0:31:04
pjb
(actually, the *default-pathname-defaults* is the absolute pathname of the current working directory with sbcl.)
0:36:16
copec
You know, pastebin offering night mode only to pro users actually made me think about subscribing for half a second
0:38:16
no-defun-allowed
then write a js snippet that flips everything dark if you must have night mode
0:46:00
margaritamike
pjb: thank you for the response. When I get home, I will properly read what you have said to try to give them a concise reply. I'm so excited that it's looking like sbcl is getting added to the kattis platform.
0:52:45
copec
I mean, I'm not totally ignorant - I know of the modern web standards are their relationships with each other, its just not an area I've breached for a long time
2:26:23
margaritamike
pjb: it sounds like life would be easier for them to just use what you have prescribed with asdf and sbcl.
2:26:57
margaritamike
They are trying to add the sbcl implementation anyway, so I don't see why using asdf would be a problem.
2:44:56
pjb
It's built-in most implementations, including sbcl. This is why you can get it with just (require 'asdf).
2:45:54
pjb
margaritamike: on the other hand, this means they will have to have two cases: single .lisp file, or multiple .lisp files with a .asd.
3:05:48
pjb
margaritamike: I wrapped it in a script at ftp://ftp.informatimago.com/users/pjb/clipboard/compile-and-run-with-lisp.tar.bz2