freenode/#lisp - IRC Chatlog
Search
22:34:49
jasom
anyone have a good way to cause sbcl to unwind the stack on SIGINT with --disable-debugger?
22:38:54
phoe
":UNSPECIFIED - Do not erase the image from the display when displaying the next frame. This is the default value if disposal-method is not supplied."
22:39:23
phoe
http://cs.nyu.edu/courses/fall10/V22.0004-002/animatedGifs.pdf tells me that :UNSPECIFIED actually *erases* the previous image.
22:53:19
didi
How do you protect against infinite loops with `condition' and `restart'? e.g. I call function FN1, it signals condition CON1. I handle it and invoke restart RES1, that calls FN1 again, that signals CON1 again, and the cycle goes on. The reason for restart RES1 calling FN1 is because it tries to change the input of FN1 so FN1 can do its job. Is there a common idiom?
23:10:21
vtomole
(setq my-num 3). `(q,my-num) = (Q 3). Is it possible to get rid of the space between q and 3?
23:18:58
|3b|
space is just part of how it prints, the actual object is a list containing the symbol Q and number 3, no spaces
23:21:12
|3b|
by the type the ` form is evaluated, the READ is already done, so it is too late to do things that would depend on interpretation of space characters, like deciding which characters are part of a particular symbol
23:23:04
|3b|
so if you want a symbol that depends on runtime values, you need to create it (or find an existing one) manually, in which case INTERN as suggested (assuming you want a symbol accessible from code you write, or that you can generate again)
23:23:57
|3b|
if you don't need those properties, there are other options like make-symbol and gensym depending on what you are trying to do
23:26:13
pjb
or (gentemp "G") #| --> g0 |# you don't have to deal with the counter when you use gensym and gentemp.
23:39:55
|3b|
usually you don't want to create a new interned symbol though. gentemp won't return an existing symbol, for example any that you tried to use from already loaded code
23:40:48
|3b|
and at the point where you are generating code, usually it won't be READ, so doesn't matter if it is interned
23:43:08
|3b|
gensym also has predictable names, since you can access (or override) the counter, while gentemp might skip numbers to avoid existing symbols. not usually a feature that matters though :)
23:49:56
aeth
gentemp is deprecated. http://www.lispworks.com/documentation/HyperSpec/Body/f_gentem.htm
23:50:32
aeth
It'll never be removed because there'll never be another spec, but it's still worth noting that it's the older method to gensym
0:04:47
ralt
given that there's no replacement, and (remove-if (lambda (x) (not (foo x)) list) is more painful than (remove-if-not #'foo list)
0:05:37
aeth
All the -if-nots were deprecated. It might not have been clear at the time that remove-if-not is the more basic operation, equivalent to filter
0:06:06
aeth
By the spec, complement is apparently supposed to be used, but the implementors don't optimize it.
0:06:27
aeth
That is, remove-if-not will produce more efficient code than remove-if (complement in most if not all implementations
0:08:42
phoe
Are there any portable CL libraries for interfacing with any sort of English dictionary?
0:09:17
phoe
Like, anything that will evaluate (dictionary "virtue") to some kind of object that is a dictionary entry for word "virtue"?
0:09:54
aeth
ralt: filter is a basic functional higher order function. It exists, it's just awkwardly called remove-if-not in CL.
0:10:18
aeth
It's possible remove-if-not will be undepricated in the very unlikely event that there's a new standard.
0:11:10
aeth
The problem with not using -if-not functions are (1) everyone uses them while the complement style is very rare and (2) because of 1, the complement style is slower rather than producing identical code
0:12:18
ralt
I already know I'm not getting the best optimization when using higher order functions anyway, that's an acceptable compromise
0:12:53
aeth
When this discussion was last in here, it was brought up that SBCL could potentially optimize the remove-if (complement ...) style if it's "open coded", but I'm not sure if anyone has bothered to do so in the year or so since then
0:14:45
|3b|
shouldn't be too hard to do it with a compiler macro even (at implementation level, user code isn't supposed to do that)
0:29:52
fiddlerwoaroof
I'm not sure why you'd say that filter is more fundamental than remove-if-not: they're equivalent, afaict
0:33:45
fiddlerwoaroof
I yeah, that's what I meant to say: I don't see why remove-if-not/filter is any more fundamental than remove-if
0:35:16
stylewarning
The second you're generating a closure with weird argument passing (likely an APPLY)
0:35:52
fiddlerwoaroof
complement is pure, so the compiler can just transform it into an additional NOT in assembly
0:36:18
|3b|
only trivial if you see the complement, (defun foo (f) (remove-if f ...)) is harder to optimize even for compilers
0:36:23
stylewarning
No, it's that in the end optimizing (REMOVE-IF-NOT #'F) can be inlined and all that jazz
0:36:55
stylewarning
(REMOVE-IF (COMPLEMENT #'F)) will probably heap allocate a closure, have to re-pass arguments from the closure to F, etc
0:37:12
fiddlerwoaroof
|3b|: but then the compiler can just apply the optmization when it sees (foo (complement g))
0:37:33
|3b|
fiddlerwoaroof: probably easier to transform the remove-if (complement) to remove-if-not
0:38:23
|3b|
transforming complement to asm-level negation might be harder (especially on sbcl with extensible sequences)
0:39:19
fiddlerwoaroof
At the very least, COMPLEMENT is trivial to optimize because there is no reason to actually allocate a closure for it
0:39:49
stylewarning
If by trivial you mean you can write out a way to do it absent of any other framework, I agree
0:40:02
_death
personally when I think of FILTER, I think of something different from REMOVE-IF-NOT.. FILTER returns a list of the non-null values returned by the semipredicate
0:40:05
stylewarning
If by trivial you mean it's a trivial thing to add to a given lisp compiler, I disagree
0:41:36
|3b|
without a compiler macro or special form or similar, it has no way to know it has been removed
0:41:46
fiddlerwoaroof
|3b|: Can't you optimize away the closure if it doesn't introduce any new bindings?
0:42:41
stylewarning
You may be able to stack allocate the closure but idk of any compiler that would do that
0:43:38
|3b|
can't stack-allocate complement in general, so again would have to be a compiler-macro or similar to do so for functions where it is known to be valid
0:43:41
fiddlerwoaroof
marvin2: in python remove(None, list) removes all the falsey values from the list
0:44:39
marvin2
fiddlerwoaroof yes. and filter in python does exactly the same thing as remove-if-not in CL
0:45:29
stylewarning
The problem with _death's imo is the fact the final list will contain fn(x) in the result, not x
0:45:39
marvin2
not saying that there aren't languages where filter works right that, but python isn't one of them
0:45:58
_death
I don't know where I picked that up, but it was definitely not python :).. likely some old lisp dialect/discussion
0:48:46
_death
stylewarning: it's only a problem if you see filter as doing remove-if-not-like work..
0:51:50
stylewarning
Filter even in just the English meaning of the word usually means to sieve or sift, not transform
0:59:24
phoe
stylewarning: in the simplest form, just a string that contains the textual representation of a dictionary entry
0:59:59
phoe
in a less simple form, something that's already somewhat parsed - like, GCIDE contains things like
1:01:13
phoe
so this is split into two subprojects, 1) interfacing with the dictionary files, 2) parsing the entries from dumb strings into smarter Lisp objects
1:02:00
stylewarning
I'm just saying, in general, as a Lisp programmer, it would be nice if there were more data sets available to Lisp natively
1:02:24
fiddlerwoaroof
The nice thing is that it's fairly easy to write interfaces to things in lisp
1:02:47
stylewarning
fiddlerwoaroof: I thought that was true but I changed my opinion to "of mild difficulty"
1:02:53
phoe
So one can just use a combo of WITH-OPEN-FILE and FILE-POSITION to jump to the proper part in the file.
1:03:13
_death
aha... I picked it up from the first CL book I read.. ANSI Common Lisp: https://i.imgur.com/HfPmscR.png
1:03:24
fiddlerwoaroof
like, every once in a while I've wanted to wrap some rest api or something, and I've found it's fairly easy to wrap a huge amount of an api once you figure out the general shape of data access
1:03:37
White_Flame
vtomole: because macros happen at compile time, before any of those actual expanded bodies are ever runtime invoked
1:05:19
stylewarning
_death: its utility has been canceled out by its awful name. Should be (push x acc)
1:05:44
phoe
I'll write it first, and you can contribute later if you consider my way of doing it to be too much of a heresy.
1:06:20
phoe
as if a function for getting a dictionary entry is going to be called automatically multiple times per second
1:06:25
stylewarning
But if you're going to mmap it, just parse it out. Let me MAPCAR all words in the English language
1:06:56
fiddlerwoaroof
phoe: you might write something that transforms it into sexps and then write those out
1:07:01
phoe
but my use case is popping up a window with a dictionary entry for someone who wants to look up a word at most hundreds of times per day.
1:07:31
fiddlerwoaroof
I've done that a couple times for reference-style things, and it's pretty nice to just be able to read in all your structured data
1:07:32
stylewarning
phoe but writing a library has unintended consequences :D all of English at my lispy fingertips
1:07:59
phoe
stylewarning: "The consequences are undefined if a programmer decides to write a Lisp library."
1:10:01
phoe
minion: memo for beach: Do you have any code and/or libraries for accessing an English dictionary/thesaurus and spellchecking? I'm interested in portable Common Lisp code.
1:20:20
fiddlerwoaroof
the .dz format is interesting because it allows for "random" access to the compressed dictionary
3:00:22
aeth
"Lisp" can mean "the Lisp family of languages" or "the Lisp language". This channel uses the latter definition, so it's about Common Lisp. ##lisp uses the broader definition and #scheme is a channel for Schemes.
4:36:59
stylewarning
Are you folks familiar with the POWER architecture? Is it similar enough to PowerPC for the existing SBCL or CCL to work on it?
4:38:07
jasom
stylewarning: POWER and PowerPC are largely synonymous; that being said if you're running on a ISA revision/OS combination not encountered before, a small amount of porting work could be needed
4:44:54
jasom
I think Power 8 and 9 are designed to be run LE for driver compatibility though; not sure if sbcl or ccl support LE power
6:12:14
beach
minion: memo for phoe: I started such a thing: https://github.com/robert-strandh/Spell
6:13:59
beach
parjanya: phoe was looking for Common Lisp code for an English dictionary for things like spell checking.
6:16:25
beach
I forget. It was some time ago. It is supposed to return some standard instances that give all possible interpretations of some word in English.
6:18:38
beach
I do need a spell checker though. I am getting increasingly dyslexic. So before I can abandon Emacs in favor or Climacs, or beirc, or ..., I need one.
6:19:14
parjanya
beach: btw, I’ve seen a "Lispy lists" mentioned on YT, is it a book, a file, what is it?
6:19:52
parjanya
beach: so far I could only imagine writing it in python : / my Lisp idioms are coming very hard to me
6:24:59
parjanya
beach: anyhow, this is what I saw mentioning "lispy lists": https://www.youtube.com/watch?v=iferkSFzkF8
7:32:57
whoman
of how complicated it would be to "translate" elisp into CL, i was thinking about this myself as i have some elisp code around
7:35:18
beach
I don't think it would be very hard. The tough part is to implement all the infrastructure that it takes to execute the resulting code.
7:35:55
beach
You could very well end up having to write a complete implementation of Emacs in Common Lisp in order for taht to work.
7:51:04
flip214
minion: memo for whoman: see https://github.com/adolenc/cl-neovim/issues/1 for some talking about "neomacs", which aims to get such a compat layer.
9:37:37
dxtr
oleo: That's literally exactly what I wanted but I couldn't quite find the correct stuff to poke at
9:38:51
oleo
i either use rlwrap sbcl for getting completion and history (you have to create the completion and history files too ofc)
9:41:28
beach
dxtr: If you don't get the CL-USER> prompt, there is something wrong with your SLIME installation.
9:42:48
beach
dxtr: Do you see any error messages, or any other messages that indicate that something is wrong?
9:43:55
beach
By default, you should get a buffer named *slime-repl ...* and it should have that prompt.
9:47:04
oleo
dxtr: i'm not using emacs at all by the way, i start right into mcclim and use it's editor climacs too