freenode/lisp - IRC Chatlog
Search
22:13:11
nullnullnull
man, I just wanted to try lisp and im stuck on the debugger console :| exiting the debugger is a serious business
22:25:53
Oladon_work
See how it says "restarts (invokable by number or by possibly-abbreviated name):" ?
22:26:54
Oladon_work
Yeah, what no-defun-allowed said — you're good for now, but you should learn how to use the debugger for the future
22:34:48
Oladon_work
Hehe, nullnullnull: the REPL there is reacting to your SIGINT and dropping you down into the debugger
22:45:30
aeth
nullnullnull: You'll want to use GNU Emacs with SLIME. That gives you a separate buffer (in-Emacs frame) for the debugger instead of having to deal with command line input there. It also gives you readline-like control in the REPL (since readline defaults to Emacs-style keys) without having to do rlwrap (which is the in-terminal option... if you're using it in the terminal, you should setup rlwrap)
22:47:03
aeth
nullnullnull: Also, current SBCL is 16 releases ahead of 1.4.5 so you might want to use Debian's SBCL to compile the latest SBCL (it requires a CL compiler to compile) because there might be bugfixes and other improvements since then.
22:47:51
aeth
nullnullnull: If you're using another editor other than Emacs+SLIME, then the important thing is that you're using an editor with Swank integration, since Swank is the TCP protocol that's used to communicate between the editor/IDE and the implementation. Vim probably has the second best support, but vscode might have something.
22:49:28
aeth
It's possible that there might be some LSP (Language Server Protocol) layer on top of or instead of Swank, idk, I've never looked into that.
22:51:16
aeth
nullnullnull: Well, you have two different CLs, the development CL and the deployment CL. You usually develop CL interactively from the REPL with editor integration. Then, you can have some launch file that will call your main function when run with your implementation-specific launch command
22:52:22
aeth
You can build a standalone executable, which is heavyweight but means the user doesn't need CL installed. This basically bundles the whole implementation with the script. Or you can have a script file. With SBCL you can just run it with a #! but the problem is that you need to hardcode the path and it could be in /usr/bin or /bin or somewhere else.
22:53:07
aeth
For running a script with SBCL --script works, but for some reason I prefer "sbcl --non-interactive --load path/to/script.lisp" instead of --script. Slight difference in semantics, I guess.
22:54:06
aeth
That doesn't work in SBCL unless you make it a bilingual file that is both bash and CL, which actually can work since #| .. |# is a block comment in SBCL and # is a line comment in bash, so #| will be ignored, and then in bash everything after a line that contains "exit" will be ignored
22:55:32
aeth
The easiest thing to do for scripting without a hardcoded implementation path would be to have a shell script that contains one line with the line being something like this: sbcl --non-interactive --load path/to/script/entry/point.lisp
22:55:54
aeth
You would only run that file when running as a script, not in development, since that file will probably include something like a top-level (main) call
22:56:36
aeth
Well, you can do --eval but it's easier to put it in its own file imo if it's anything more complicated than a simple --eval "(main)"
22:57:59
aeth
That's because the script file will probably be doing a bunch of (ql:quickload :foo) which you normally wouldn't do.
22:59:06
aeth
then launch.lisp could be as simple as: (ql:quickload :your-script-system) (your-script-package:main)
22:59:43
aeth
Eval could technically work but it will probably bloat past a one-liner as things tend to do.
23:01:13
aeth
It might not run faster. launch.lisp after first run will be compiled and placed in the cache at ~/.cache/common-lisp/your-implementation-name/path/to/script/launch.fasl (if not SBCL, the extension won't be fasl)
23:01:41
aeth
I mean, for a one-liner it might still be faster to just eval it, but that's kind of a microoptimization
23:02:01
nullnullnull
so at first time will be normal but second run: the load will be faster because it's saved on cache right?
23:02:22
aeth
For a large enough file. There might be an upfront overhead that makes eval faster for simple enough commands.
23:03:54
nullnullnull
why im asking u this: because in javascript for example they used to convert code to onliner script to load page faster (it's like a production code)
23:06:01
aeth
With typical CL, after the first compilation you won't see the text again and will just load the FASL, unless the dependencies have changed or you delete the cache or you upgrade your implementation. Although, I'm actually not sure if launch.lisp would experience that because this might be done through ASDF. The vast majority of your program would be an ASDF system defined in an asdf:defsystem in a foo.asd file, though.
23:09:18
aeth
You'll probably have four files at a minimum if you're going for a script with this approach, which isn't the only approach. (The shell script that launches it from the shell, the launch.lisp that it calls, the your-project.asd that defines your project, and the script.lisp... but there would usually be at least one more, called package.lisp, where you do the defpackage... especially if there's more than one file that shares one package)
23:11:38
aeth
In development, you'd usually use the REPL directly and skip the first two steps, which is part of the reason why you'd want to have the separate files.
23:12:37
aeth
If you can't expect the target machine to have CL, you can build a binary which bundles the implementation with it, which would make the deployment process different. There are portability libraries that handle this use.
23:13:29
nullnullnull
yeah, I'm only worrying about the packages atm (need to install on every development machine)
3:06:06
torbo
Does slime have reader macro support? I notice that I'm able to use reader macros in sly but not slime. Is there something I need to configure or does slime just not support reader macros?
3:10:47
Oladon
torbo: it'd be helpful if you'd tell us what you're trying to do and what (exactly) is happening
3:12:36
torbo
If I try to run the code at the bottom of this page: https://gist.github.com/chaitanyagupta/9324402
3:13:26
torbo
By loading it directly into sbcl, and type {"a": 1} into the console, I get a hashtable object back.
3:17:30
torbo
Here's a direct link to the code in json-reader.lisp: https://gist.githubusercontent.com/chaitanyagupta/9324402/raw/54359d3f2d19b78c603cf011304a741410a873ae/json-reader.lisp
3:18:07
torbo
Nice. Maybe my configuration is broken somewhere. I'll have to investigate. Thank you for checking for me, I really appreciate it.
3:18:40
Bike
the slime repl just passes things to sbcl's read and eval. it should behave almost exactly the same as sbcl at a terminal, other than like formatting stuff.
3:24:37
torbo
Ah, yes, you're right, it does work. The reason it's broken is because I've loaded up another package before running that command and I called (in-package :other-package) first, and I think that in that package, I'm loading up other reader macros that may be affecting the readtable in some way.
3:26:55
torbo
I've been able to replicate the problem, and the expressions that cause the inconsistent state are the following:
3:32:26
loke
I was sure there was a way to export a symbol from one package into another package and a different name... I.e. so that (eq 'foo:a 'bar:b) ⇒ T
3:37:52
mfiano
Well you could use package-local nicknames, but it's non-conforming and only available on 5 implementations.
3:46:27
mfiano
Right, he's looking to map different symbol-names for a symbol internal to one package to another. READ would need to be modified for that behavior as to know which package's LUT to reference for the mapping.
4:03:47
loke
mfiano: The question originates from a larger question as to whether it's possible to create consistent aliases in Common Lisp. I.e. something where (fpp
4:04:17
LdBeth
But it might be more useful to let the compiler/eval handle that, if aliasing/renaming is desired
4:06:26
LdBeth
For example a macro involves the aliased function has been loaded before the aliasing definition
4:11:02
loke
LdBeth: If the same symbol could have different names, that would have solved that problem. Then symbols FOO and BAR would literally _be_ the same thing.
4:12:16
loke
I thought some variant of symbol aliasing was used as an argument why some people use keywords for loop commands?
4:13:16
loke
I'm OK with SYMBOL-NAME returning a name that is not consistent with its name in a package, and I thought that was possible. But apparently not.
6:07:34
afidegnum
i m trying to build a drop-n-down html builder a la dreamweaver with Js support, but i am confused with what GUI toolkit should i use, i read about McCLIM, Slip but i am a bit perplexed,
6:08:03
afidegnum
the GUI will have an internal browser engine to preview the page intead of opening an external browser,
6:09:40
loke
afidegnum: CLIM is quite opinionated in how you build your applications. If your design matches CLIM's idea of interaction (or if you're willing to adjust your ideas to match) then it's a good choice.
6:10:25
loke
You _can_ build anything of course. It's just that CLIM won't help you as much if you choose to go certain routes.
6:10:59
loke
I'm comitted to CLIM right now myself, as I help out with maintaining (and evolving) it.
6:11:49
afidegnum
Drag-DOwn feature of vectors which will generate DOM nodes which can be previewed in a customed web browser, so will be the Js
6:16:53
LdBeth
afidegnum: afaik qtwebengine is licensed under a BSD-3 clause style license which doesn’t prohibit either modify or redistribute
7:39:14
p_l
afidegnum: you might be also interested in running chrome or firefox in debugger-driven mode with external debugger (your application)
8:09:13
jackdaniel
fun stuff, one asdf function has 184 arguments (combineds, with default initargs included)
8:15:14
jackdaniel
I don't know, I'm working with ECL's argument stack now and it is one of diagnostic messages done with "printf"