freenode/#lisp - IRC Chatlog
Search
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