freenode/#lisp - IRC Chatlog
Search
8:07:33
engblom
I have been trying to find any documentation for slime-repl with all the shortcuts. In particular I am trying to find how to run something again that I run earlier. I know I can scroll past all output until the cursor is on the form I want to run and then press enter, but that is too much work. How to I get the history without having to scroll?
8:08:40
engblom
Would it be easy to remap that to something else? M-p will open dmenu (as I am using xmonad as window mangaer)
8:09:24
engblom
Preferable I would want up and down arrow in slime-repl for history and page-up and page-down for scrolling.
8:09:27
beach
M-p is used in many many Emacs situations, so it would probably be better to remap what xmodad uses.
8:10:52
beach
engblom: It is generally faster to use keys that are easily accessible without lifting your fingers from the home row on the keyboard.
8:13:22
beach
Maybe when I officially retire in a bit more than 9 months, I should also retire from #lisp.
8:14:19
engblom
Anyway, xmonad is heavily using alt-key already and as I need xmonad functions more often than emacs functions, I want to keep alt as reserved for xmonad. This means I need to change emacs to work with xmonad.
8:15:07
engblom
beach: I came from vim. But I got told that I better use emacs those times I write lisp.
8:15:44
beach
engblom: It was a sarcastic remark, related to the fact that a lot of things I suggest lately are criticized.
8:17:05
no-defun-allowed
Generally that is the window manager key (Windows even provides some shortcuts using it as a modifier) and no application will provide shortcuts using it.
8:17:15
engblom
no-defun-allowed: It is too uncomfortable to use window key as often as I have to use for window manager (as the thumb has to go under the hand). I still think I could use it for emacs as I more seldom need M- there.
8:17:49
Nilby
One trick is to use Control-Meta-<> for window manager things and if you need it in emacs do Escape Control-<>
8:33:16
xificurC
http://www.lispworks.com/documentation/HyperSpec/Body/f_rm_dup.htm states "The order of the elements remaining in the result is the same as the order in which they appear in sequence."
8:34:42
no-defun-allowed
Unless you do (remove-duplicates '(1 2 1 3) :from-end t) in which case you get (1 2 3)
8:34:54
moon-child
xificurC: the elements 2, 1, and 3 all appear in that order in the original sequence
8:37:28
beach
xificurC: "if any two match, then the one occurring earlier in sequence is discarded."
8:40:25
beach
xificurC: Here the first and the third elements match, so the first is discarded. If you want the second one to be discarded, then yes, use :FROM-END T. Maybe your example is confusing because you have a partial numeric order, which has nothing to do with what this function does.
8:49:15
jdz
It might also help to use different items, and tweak :test and/or :key parameters. Like (remove-duplicates '("one" "two" "ONE" "three") :test #'string-equal).
8:53:02
engblom
I also got a good solution for my meta-key problem: I wanted to still use the physical alt-key for window manager, so I swapped with xmodmap alt and windows, and then configured xmonad to use windows. Now the physical windows key is alt in emacs.
8:56:25
engblom
beach: As I am not using American keyboard, I can not get [ without using Alt Gr (=right alt).
8:59:08
engblom
Anyway, now things are working for me. Thank you for putting up with the frustrating of helping me with these maybe odd things.
9:19:56
White_Flame
it's been many years since we had an ACL license, and I don't remember .cl at all :)
9:22:29
moon-child
.lp, maybe. (l)ist (p)rocessing. But I agree .cl is optimal if you're strictly 8.3
10:28:38
pyc
Is there a way to create a local variable in the current scope? I know LET but LET requires me to open a new scope and if I need LET within LET, then the code becomes deeply nested. Is there a way to do something like (setq-local foo "value") such that it is defined in the current DEFUN but not defined in the global scope?
10:29:33
no-defun-allowed
You could write (let (x) ...) to leave X "uninitialized" and then set it later.
10:29:50
no-defun-allowed
By "uninitialized" I mean it will be bound to NIL, but the expectation of the reader is that it won't be used until it is set.
10:37:12
pyc
Okay, Understood finally from here: http://www.lispworks.com/documentation/HyperSpec/Body/s_let_l.htm When there is no init-form, the extra parentheses isn't required.
11:29:35
White_Flame
pyc: &aux in the lambda list will create variables for the DEFUN scope without LET
11:34:43
White_Flame
but any lexical variable is generally modelled equivalently, all can be rewritten as ((lambda (local1 local2...) ...) init1 init2...) in the current scope
11:44:20
phoe
there's a nasty edge case if variables are named after lambda list keywords but most of the time you don't need to care about it
11:57:24
White_Flame
just does more runtime parameter checking to support &optional, &key, etc if present
11:58:13
White_Flame
if you mean the example above, one would hope the compiler would inline literal lambda usage like that
12:00:40
White_Flame
check that there's 1 parameter, else error. put parameter into return value. return
12:01:44
White_Flame
and the fasl isn't a compiled snapshot, like a saved image is. It's fast-loading instructions to do the same that the toplevel stuff does
12:04:30
White_Flame
of course, for something that small you'll probably be looking mostly at the function epilogue, especially if the 1st parameter & return registers are the same
12:06:33
White_Flame
there might be some environmental differences that cause codegen change, like having everything available in a single compilation unit or not
12:10:26
White_Flame
and if you had macros in your fasl files, they'd still evaluate at load, and if they read global vars or config or anything, they'd generate different machine code based on what was there at time of .fasl load
12:16:04
nij
Hmm.. so how to compile is not in spec, and dependent to each implementations.. I guess I have to study the source of sbcl then.
12:23:37
nij
I see.. it seems like the magic is hidden in https://github.com/sbcl/sbcl/blob/d35ad6f9bee212499cb827fec3195bf2064c10a2/src/compiler/target-disassem.lisp#L2060
12:23:57
Nilby
Just read to code to a lisp compiler. You don't have to fully understand it to get an idea how it works.
12:26:43
White_Flame
I meant to run DISASSEMBLE and look at the output, not read DISASSEMBLE's source code ;)
12:27:27
White_Flame
there's also sb-disasm:disassemble-code-component which can display more componentry, like function prologues, that disassemble on its own might elide
12:30:37
Nilby
For example you can see sbcl defines compilation in terms of VOPs or virtual operations, which are like a macro template for generating platform specific code. Operations in lisp are defined to be a set of these virtual operations which have various properties, pre/post conditions, etc. Then these are evntualy refined down to platform instructions in lisp objects, which can be turned into bits and stored in memory and executed or
13:12:53
beach
Suppose we had a parsed and exploitable version of the dpANS. I mean, we don't but such a thing could be had if enough effort were put into it. If we did have such a thing, how should it be managed?
13:13:02
beach
I feel it would not be advantageous to have a multitude of clones and individual modifications to it. What would we use it for?
13:13:08
beach
I can see at least a better Common Lisp UltraSpec, i.e., a free version of the Common Lisp HyperSpec with better markup.
13:13:14
beach
I can also see a version of it in the form of an object graph as I have suggested many times for documentation representation.
13:13:15
beach
And I would like to use such a thing for WSCL, i.e., create a more specified specification that would then also keep (as footnotes maybe) the original wording of the standard, and explain the differences. Any suggestions?
13:17:26
jackdaniel
re managing: there should be a trusted authority to moderate it (i.e to remove spam or to resolve conflicts)
13:17:56
Nilby
I just want to be able to access pieces of it in development tools, and be able to control how it's presented. But I support all those other uses.
13:19:20
pyc
do you ever use the format control "~d"? I see "~a" suffice for most situation. Is it a good practice to use "~a" all the time and use other format controls only when we need to?
13:19:48
jackdaniel
re different versions of the same part of the document - either there are different versions linked in the same page (I'm not sure what to do with footnotes - they may not apply to the implementation-specific version)
13:20:41
jackdaniel
or there is one "base version", and implementation-specific things go after that under different sections
13:22:00
nij
I just fancy a better presentation will drag more people into #lisp. But I support all those other uses.
13:22:17
beach
I am paying attention to all suggestions, and I may ask questions about them, but I am not going to argue a particular idea myself at this point.
13:26:10
beach
nij: More people will use Lisp when it starts being taught in more undergraduate programs in computer science. I am now of the opinion that any such undergraduate program should teach Common Lisp, or something similar, in order to be considered as such. I don't know of a single person who thought about using Common Lisp and then decided against it because of the markup of the Common Lisp HyperSpec.
13:26:40
beach
xificurC: Sure. Did you try the suggestion with strings to see what it does? I think that was a clever idea.
13:26:43
nij
If I become a professor, I will volunteer teaching in CL. But before that I must have polish my skills xD
13:27:43
beach
xificurC: With that example, the duplicate elements are distinguishable, but they are still considered duplicates because of the comparison function.
13:28:00
xificurC
beach no but I understand what's going on now. I still find the wording I quoted utterly misleading though
13:55:35
beach
Would there be reasons to grant access selectively to a parsed dpANS? It would be "easy" to accomplish, since the result of the analysis would be automatically subject to copyright according to the Berne convention. If so, what kind of access would be granted/refused?
13:56:06
beach
It may require legal actions to enforce, of course, and funds for such actions may not be available.
14:00:15
_death
some levenshtein-based suggestions: chad-code, qatar (cadar), poland (logand), read-char-no-ghana, egypt (expt), canada (cadadr)
14:18:17
_death
I should've just substituted the state for the similar word in the name, but oh well ;)
14:21:08
jackdaniel
to bring bad puns to another level I'll just say that you sound as if you had a lisp
14:32:54
_death
dieggsy: adeht is code that runs on my server (adeht.org).. some years ago I wrote something to scrape some UN press releases and make some funny image based on them
14:36:31
_death
dieggsy: apparently I updated that image in 2020 for some irc joke.. https://adeht.org/img/ban.png
14:38:47
dieggsy
_death: ah - any pointers on that setup? I currently have a chicken scheme server but i've been thinking about moving to hunchentoot and/or putting it behind nginx as well
14:42:01
pjb
jdz: not at all, lisp is almost pure polish notation. We just add parentheses for two reasons: 1- allow for variable arity operators, 2- allow to process code without knowing a-priori the arity of the operators.
14:42:35
pjb
But if you restrict yourself to fixed arity operators, you can remove the parentheses: + 2 * 3 4 vs. (+ 2 (* 3 4))
14:43:20
_death
dieggsy: I set it up many years ago.. reverse proxy and detachtty.. I have https://zaries.wordpress.com/2010/11/09/lisp-web-server-from-scratch-using-hunchentoot-and-nginx/ in history, but it's very old.. there are newer blog posts on the web
14:47:01
dieggsy
pjb: i've sort of talked this to death but i used emacs calc a decent amount in college
14:48:49
jcowan
I once worked on an ISLISP implementation on top of CL, since kmp would not release his; the working name was Blésité, anglicized as Blesity. Gave up eventually.
14:53:45
jcowan
Question for all: does anyone have a sense of how much adjustable strings are used? My sense is that there is a cross-language tendency to treat strings as immutable, and even when mutable, as unadjustable.
15:09:46
aeth
jcowan: An example of an adjustable string, when reading Airship Scheme symbols: https://gitlab.com/mbabich/airship-scheme/-/blob/12dbbb3b0fe7ea7cf82e44cbaf736729cc005469/scheme-read.lisp#L851
15:11:30
aeth
jcowan: That file might be the only time I've done that, though, because it is very niche
15:12:11
jcowan
Thanks. I had forgotten that adjustable arrays work only when the max size is known in advance.
15:12:56
engblom
If I have something like ((:a 1)(:a 3)(:a 2)), how do I find the higest value of property :a from a plists? Is there something simpler than sorting the list and taking the first element (which I know how to do)?
15:14:02
aeth
dieggsy: Progress, yes, but ignore the actual dates unless you enjoy seeing things be pushed back months at a time (I just did that again). https://gitlab.com/mbabich/airship-scheme/-/milestones
15:17:01
beach
engblom: If you like, but then there is only one element in each, so no need to compute the max. The entire thing looks like an association list to me.
15:20:37
jdz
engblom: There's (loop for cell in '((:a 1)(:a 3)(:a 2)) maximize (second cell)), but that will get you the value, not the property list with the highest value.
15:21:54
_death
(alexandria:extremum '((:a 1) (:a 3) (:a 2)) #'> :key (lambda (plist) (getf plist :a)))
15:36:20
engblom
beach: It was a simplified example. The real plists are bigger and having other values
15:38:38
engblom
_death: I actually already use alexandria, so your solution might actually make most sense
17:37:59
sbcltester
as long as i can put a few workarounds that doesn't need patching the runtime :)
17:39:01
luis
Duuqnd: so, the nastiest bug so far is that if you call C++ code that uses exceptions internally, they'll trip on SBCL's exception handler
17:59:50
gigamonkey
is there anything about SBCL on Windows that is painful within language standard? (i.e. excluding FFI and threads and whatnot)
18:00:32
gigamonkey
(I'm imagining that if I do a 2nd edition PCL I'd recommend SBCL since it now runs on Unix, MacOS, and Windows but I've never actually tried it on Windows.)
18:03:00
luis
gigamonkey: I can't imagine what could go wrong there. (And I haven't seen it go wrong there in the past of 1.5 years of using it heavily on Windows.)
18:06:11
luis
We've patched SBCL with the hackiest CRLF support you can imagine. file-position returns wrong results. *sigh*
18:06:39
gigamonkey
I mean, CRLF is always the worst. But assuming, eg. READ-LINE properly consumes the CRLF and TERPRI and FRESH-LINE emit CRLFs, I think that's about the best you can hope for.
18:07:16
gigamonkey
FILE-POSITION also probably doesn't work well with multi-byte encodings of text, right?
18:08:36
luis
gigamonkey: but, hey, if you tell us that's the only thing stopping you from recommending it in PCL2, the priority for that issue might increase dramatically :D
18:10:14
gourdhen
this is a weird question... but could someone recommend an article or link about how and why they enjoy coding? I have been trying to code for years - but I am so friggin indecisive about which language to learn.
18:10:38
gigamonkey
luis: I'll let you know if I can work out the details with Apress. But if I do I'd definitely like to recommend some open source Lisp that runs well on Unix, MacOS, and Windows.
18:10:39
phoe
gourdhen: I think #lispcafe might be open to discussing this rather than just linking to articles
18:11:48
gigamonkey
gourdhen: unfortunately, if you read Coders at Work you may well come away with the conclusion that you should learn Haskell. At least that was my conclusion from having written it. ;-)
18:14:31
luis
phoe: so, IIRC, file-position = current file position - number of bytes in the Lisp buffer.
18:15:04
luis
phoe: if there's no ambiguity between Lisp char and number of encoded bytes, you should be fine
18:16:33
gigamonkey
I mean, every language has warts. But that was my takeaway, from reading between the lines of all the interviews. Some people (Simon Peyton Jones obviously) were big into Haskell. But others, like Peter L Deutch talked about things they wanted from their dream language that I was like, I think that's Haskell, dude. Which is not to say it's the perfect language or that I don't still love Common Lisp. But it's a language worth coming to
18:17:25
gigamonkey
luis: I guess I forgot that you can't use FILE-POSITION to seek to arbitrary positions in a stream, only to ones that have been previously returned by FILE-POSITION.
18:20:26
luis
gigamonkey: oh I didn't know about that either. The bug I was complaining about was with querying the current file position, not seeking
18:21:21
gigamonkey
I think FILE-POSITION could be conformantly implemented if it always just returned the byte offset.
18:24:07
gigamonkey
But don't you have to know where you are in the buffer to do anything else right?
18:39:29
heisig
Unfortunately, Sanely Bootstrappable Common Lisp was already taken. Although we hope to have a bootstrapping procedure that is even more sane.
18:59:37
pyc
Is this a good way to format code: https://pastebin.ubuntu.com/p/wtGDTm8yvH/ ? I have a coding guideline not to exceed 72 columns per line. That is why trying to figure if this is a good way to wrap a long line into multiple lines like this.
19:00:51
pyc
ChoHag: yes. but I want to learn about good coding style too from experienced programmers in this channel
19:02:06
loke[m]
However I'm curious why you want to limit yourself to such short lines. Because I was like that long ago, and limited myself to 80 just because I used two use hardware terminals when I started using Unix. Many years ago I realised there is no point anymore and stopped caring. It felt like a relief.
19:10:25
ChoHag
pyc: Personally I like to indent each new level by 8 spaces, mostly excepting let clauses.
19:18:23
nij
If I have some code in lisp using cffi, can I have it translated to C code that would do the same thing?
19:19:52
Bike
i guess you could probably translate it if it consisted entirely of cffi operators with no lisp functions or anything involved?
19:20:48
nij
I think so.. though I've been hit by my second dose and have been lying the whole dya.. dunno if my brain is clear.
19:21:27
nij
Bike but even if that's the case, there's still needed to be some one translating cffi ops to C?
19:22:43
nij
Also, curious about how cffi worked. Do they translate it into C? Or it build up some CLOS that mimick C?
19:23:37
Bike
cffi is a wrapper around the implementation ffi, which generally works via a compiler extension.
19:25:57
Bike
okay, so basically cffi doesn't do most of the work. it's a compatibility layer around the FFI exposed by your lisp implementation, like sbcl or ccl or whatever.
19:27:12
Bike
and how the implementation FFI works is that it defines some operators that the compiler knows to compile down into code with the correct semantics
19:27:41
Bike
for example on sbcl, sb-alien:with-alien will perform C like stack allocation. cffi's operators wrap around that.
19:28:47
Bike
C implementations define an ABI - application binary interface - so stuff that isn't C can interact with C code/programs.
19:29:05
Bike
well, the implementations don't really define the ABI so much as the operating system... whatever
19:40:59
pjb
nij: with ecl, you can insert C lines of code in lisp functions. Since ecl translates lisp to C, it can easily inject your own lines of C code in the generated code, before compiling it with gcc. This allows you to integrate very nicely with C.
19:42:03
pjb
nij: otherwise, CFFI does not translate to C, but use the implementation specific native FFIs, which are CL operators that directly do native code stuff.
19:43:53
pjb
nij: the ideal tool, would be to have a C parser that would produce the C sources in form of alisp S-expressions. So you could edit C code as if it was lisp code. You could even use the CL macro system to generate more C code. Then the inverse operation would translate the S-expressions into "maintainable" C code.
19:50:06
pjb
nij: for new code there would be no problem using such a technique. But when maintaining legacy C code, the big problem is that the cycle of parsing and regenerating the C code would most probably change a lot of superficial things (indentation and line splits, coding style (from the use of lisp macro, the generated code would be way more homogenous and systematic). Parsing legacy C code can also be problematic. Notably heavy
19:51:24
pjb
nij: nonetheless, it would be very cool to have such a set of tools, that would help use to manipulate foreign language code bases as easily as lisp code bases. To solve the Y2K problems, some good tooling for Cobol has been developped in Common Lisp, to detect and correct the Y2K problems. (But public code AFAIK).
20:00:45
edgar-rft
As soon as a new messiah get's born it's only a matter of time until we'll have the y2k problem again.