libera/#commonlisp - IRC Chatlog
Search
8:34:33
Guest69
Sorry to crosspost from #ecl if that is not good boy behaviour, but I'm having troubles doing basic stuff like getting function info via describe/inspect or requiring uiop; any kind soul to help a noob?
8:37:52
pjb
Guest69: uiop is part of asdf. You should install quicklisp anyways. Have a look at http://cliki.net/Getting+Started
8:38:49
pjb
No. Install quicklisp, it makes its own installation of asdf. Avoid cl- packages from linux distributions.
8:40:09
jackdaniel
a known issue. it does not fail, it is just that for some core functions the necessary information is not recorded
8:40:26
jackdaniel
essentially ecl holds metainformation about functions in a separate file accessed with interface provided by ecl-help module
8:41:08
jackdaniel
if you define a function in the repl, then the prototype will be available, but unless you save that data, when you load the fasl in the fresh image this information will be gone
9:22:55
hayley
Because they chose to write it like that. But only the text format is similar to Lisp, and it's different enough that trying to read it with a CL reader is not pleasant.
9:23:42
hayley
e.g. https://github.com/no-defun-allowed/wasm2ps/blob/master/Code/reader.lisp And I recall...memory instructions(?) have an annoying "align=X" syntax that I haven't touched, because wasm2ps doesn't handle memory instructions.
9:25:02
hayley
If I recall correctly, they could benefit from learning that we have #- instead of #_, and don't put our close-parens on their own lines (though I know Z3 also messes up the latter, as smt-lib is also S-expression based).
9:25:38
Nilby
assembly code is already in prefix, e.g. "oper arg arg ...", but is delimited by source lines. turning it into s-exps is trivial and makes so you can group it not by line.
9:26:43
rendar
i made a small language with prefix `oper arg arg` where you can specify some arg "out of band data" with [], e.g. `oper arg[opts] arg[opts2]`
9:49:59
hayley
It won't, because approximately no web developer touches the text serialisation of WebAssembly.
9:51:15
hayley
(Contrived counter-point: it contributes to the mystification of Lisp, because people will think it's something their favourite compiler spits out. As some have pointed to intermediate representations in GCC and said "Look, Lisp is in your C compiler!" for little reason, after seeing ().)
9:51:41
hayley
No source-level debugging? It would be like debugging a C program by starting at the generated assembly.
9:53:13
Nilby
well hopefully at the very least it will make life easier for us, when we can just cl:read wasm and use macros on it
9:58:16
hayley
Apologies for my cynicism still. Someone once said that Lisp implementations had good compilers because they saw their favourite compiler (for some other language) use S-expressions, and I had to describe how that is not how anything works. So I am too convinced that showing Lisp exists as a (serialised format of an) "intermediate representation" is worth much.
10:00:57
hayley
Then you haven't encountered a (; ... ;) block comment; wasm2wat would produce a lot of those in my experience.
10:00:58
beach
hayley: I am sure you were trying to say something profound, but I just can't parse it.
10:02:56
beach
How did their discovery of the use of S-expressions force them to describe how "anything works"?
10:03:24
Nilby
hayley: i understand your scepticism, but at least i think it's nice to be able to: (write expr) | wat2wasm > foo.wasm and maybe get something you can run
10:03:26
hayley
Once I read a comment on a forum, which was an "answer" to the question "Why are Common Lisp implementations quite fast, despite implementing an interactive and dynamically-typed language?" The "answer" was something like "If you look into the implementation of a C compiler, you will find S-expressions there, and Lisp programs are similar to that."
10:03:58
hayley
You know, I had better just dig up the original text, I'm sure I can find it somewhere.
10:05:53
beach
hayley: And how did this observation make you (too) convinced that it is worth much to show that Lisp is used as an intermediate representation?
10:08:55
hayley
The claim, I think, is based on the (correct) observation that one of the internal representations of GCC can be printed as S-expressions. But that observation has little to do with why GCC and Lisp compilers produce good code.
10:11:29
hayley
I found the comment now, and they got the claim wrong; as they claimed LLVM uses some intermediate representation similar to S-expressions, which is definitely not the case. On the other hand, Andrew Appel said that a SSA IR is like functional programming.
10:12:36
Nilby
llvm's target description language "td" really looks like it would be better as s-exps too
10:15:22
hayley
Nilby: Anyways. What would you achieve by emitting WebAssembly code that way? Specifically, I guess, what could one achieve, where having a S-expression printer would save a substantial amount of time?
10:16:07
hayley
The wasm2ps code generator is quite bad, and just uses FORMAT to produce PostScript code, but it works.
10:16:46
Nilby
hayley: it just seem easier. like one could make a small macro set, and have a decent DSL
10:18:58
hayley
I'm still not sure what you'd use it for. And, according to Shriram Krishnamurthi, the most interesting (or "expressive") features in programming languages cannot be implemented using macros alone.
10:22:04
Nilby
i used to write a bunch of Dylan, which is very close to infix CL, so i know well the pain points in losing s-exps
10:22:44
hayley
For example, it is not possible to give Common Lisp async/await syntax, as it would require some sort of continuations (or transforming the whole program to continuation-passing style), which you cannot do with "local" macros.
10:23:34
jackdaniel
I think that we all agree that macros are not a "silver bullet", but they come handy for /some/ tasks
10:23:45
hayley
Honestly syntax doesn't bother me, unless it is too complicated. I usually write my notes in a pseudo-ML language.
10:23:56
random-nick
hayley: doesn't async/await only require transforming all the async functions into CPS?
10:24:35
hayley
jackdaniel: Sure. I was wondering what Nilby would do by adding macros to the WebAssembly text format still, since there is a lot one could conceivably want to add.
10:25:55
hayley
random-nick: Right. But the boundary between async and sync functions is quite painful, and some Common Lisp features like dynamic variables and condition handlers really don't work with CPS transformations.
10:26:21
Nilby
i guess i'm thinking of something like just spitting out little pieces of code in web app, instead of using parenscript
10:29:38
hayley
Okay. I'd say Parenscript works quite well because it is targeting another high level language (JavaScript), and so a fairly simple translation method works fine. Depending on what you want to compile to WebAssembly, a similar translator could be quite complicated, and might need a more complex IR.
11:01:38
Colleen
lisp123: Guest74 said 21 hours, 46 minutes ago: I think I'm going to make a github with all the Moby files as I had to dig them out of archive.org. They're also at project gutenberg but they rather stupidly present the readme's as the text so you have to dig and get the links to an ftp site.
11:04:08
lisp123
Guest74: based on your later comments, not sure how useful this resource this...I rather a smaller base, but more quality
11:13:42
Nilby
lisp123: what do you want to use continuations for? also "On Lisp" shows one way to do them
11:21:09
lisp123
Nilby: Yes, I've implemented the On Lisp continuations, quite good but some slight deficiencies
11:21:39
lisp123
Continuations are quite useful when writing Artificial Intelligence programs (where Lisp excels)
11:35:43
Guest74
lisp123: https://github.com/JMC-design/Moby depends on what your needs are. Either way, I've got parsers for most of the stuff there, so you can take an easier look at the data.
11:41:56
Guest74
So Norvig wrote this https://norvig.com/spell-correct.html , and someone copied it quite literally into CL. I'm not sure what constitutes a good spell checker, but this is a spell checker.
11:45:06
Guest74
I couldn't test with the data he did, but I ran the same tests as Aspell http://aspell.net/test/cur/ and the cl version came up around 45%.
11:46:25
Guest74
at the same time, it got almost everything right given as examples in journal articles for 'difficult' cases.
11:49:00
Guest74
So if someone is interested in spell checking this might be a good place to start. I'd think less brute forcing might be nice, testing for hand shift on the keyboard, only checking a keys neighbours instead of every character, and for those who want to through context in, there's a really good data set of word frequencies and 4-5 n-grams by
12:03:47
beach
And, yes, if I accidentally hit a neighbor key, then my word will look like the one pjb just showed.
12:06:53
beach
I guess when a virtual keyboard is used, like on a phone or a tablet, then adjacent keys are easier to hit.
12:13:21
Guest74
there's also when you're too excited and you forget that your hands work at different speeds so you get all or most of one hands letters.
12:14:15
Guest74
beach: and I think I good spell checker would take that into account, allow you to turn on or off certain types of checking.
12:14:18
beach
Indeed. I seem incapable of typing "the" for instance. It always comes out as "teh", so in fact I have an Emacs abbrev to fix it.
12:17:38
lisp123
Guest74: I would just have a standard dictionary, but if you repeat certain words it remembers that that might be acronym or some other term it doesn't know
12:17:55
Guest74
For single shifts or omissions I think there might be some merit to exploiting the trie structure as you'll naturally hit a dead end as you traverse and that would seem a likely spot for the error.
12:18:17
lisp123
But the way we are headed, its less about spell checking and more about input completion - microsoft produts now suggest responses based on context
12:19:11
Guest74
I really would like acronyms to be separate, so if you see something all caps, check there.
12:21:32
lisp123
I've been working on editors, and one thing I'm doing is to try to expose options for the user to choose between alternate sets of inference (in this case for spell checking) rules
12:22:58
Guest74
As for more curated dictionaries, I plan on parsing I think websters 1911 because things like 9 a clock are cool, and then the project Gutenberg dictionary. to start.
12:26:17
Guest74
beach: yes, i'm looking up if there's some existing classification system for spoken dialects to label pronounciations with a source including time and region.
12:28:50
Guest74
my personal use case is I'd like to collect pronounciations to be used in speech generation. And having an easy way to say you want a texas drawl from the 1800s would be nice.
12:32:59
Guest74
dbotton: do you have a link? though unless there's some automated way to encode that in a suitable phonetic alphabet...
12:34:37
Guest74
mfiano: See, that's the stuff I'm interested in. Not spellchecking. Besides, it seems way simpler.
12:42:01
Nilby
if i just would have collected all the spell checker suggestions and the one i chose, i could have trained a thing by now
12:48:57
Nilby
yes. but it would probably only work right for me. and why wait a lifetime for spellchecker
12:50:37
Guest74
I'm a strong believer in being able to run a desktop without an internet connection.
12:51:45
pjb
Guest74: also, with the developpment of centralized AI backed systems, it'll be more and more difficult.
13:06:59
pjb
Or just use free software, and patch it and compile it yourself to work as you want on the targets you want.
13:08:16
Guest74
Anyways, I think you could do a decent job of spell checking with a core of frequencies of ~10k most popular words with trigrams. that could be augmented with domain specific thesauri
13:10:27
Guest74
And even the trigrams aren't absolutely necessary. Word frequency helps you to decide which is the most likely spelling. I'm pretty sure most people who write things can pick the proper spelling of the word they want from a list of candidates.
13:12:29
jackdaniel
deploy software and each time someone corrects themself add the pair to the dictionary ,)
13:21:29
Guest74
What someone should really do is just implement Aspell's algorithm in CL and then have access to tons of languages. Me all just move ahead with filtering candidates based on pos and pronounciation for english.
14:30:49
Guest69
Hello, does anyone know how to declare one of the bindings as ignorable in the classic once-only macro? I'm having trouble with it: https://pastebin.com/2NsqwHK9
14:31:57
Bike
i think you just don't quote it? quoting it obviously won't work, that'll just be discarded
14:32:40
jackdaniel
the short answer is: you can't, you need to define your own once-only* macro, because that's the macro that estabilishes the block context
14:33:05
Guest69
That's what I was fearing without wanting to delve in what is still dark magic to me (once-only content)
14:34:53
Guest69
Hmmm? Aren't they lower-level, i.e. used by once-only to evaluate stuff once and put it in a gensym?
14:35:29
jackdaniel
I wouldn't call them exactly lower level, they address another potential issue with macros, that is the variable capture
14:37:39
jackdaniel
also, re your original question, you may estabilish a local declaration context with the operator locally
14:41:44
jackdaniel
you may also get silly and do (once-only (a) `(let ((,a ,a)) (declare (ignorable ,a)) 2))
14:55:47
Guest69
Related question: does everyone fumble with horrible quasiquote contraptions in macros when you want optional list splicing (to construct function argument lists, mostly)?
15:07:26
beach
Guest69: That's pretty normal, but you should have an explicit `else' branch for your IF with '().
15:08:20
jackdaniel
sure, there is sometimes a need to do that, I'm usually doing ,@(and foo (list :foo foo))
15:08:53
beach
Because the convention is for IF to be used for value, and then an explicit else branch is, well, more explicit.
15:08:58
jackdaniel
no, ,@nil is well defined, beach talks about style; usually one-arm if is replaced with WHEN or UNLESS
15:09:30
beach
Yes, that, but then WHEN and UNLESS are used in a context when the value is not needed.
15:10:24
jackdaniel
IF with superficial NIL adds plenty of clutter, AND sounds like a better alternative
15:10:46
jackdaniel
Guest69: there is a style guide written by Pitman and Norvig that has numerous useful advices
15:10:55
Guest69
Let's say that Tcl's {*} spoiled me when it comes to constructing arg lists in place
15:14:31
jackdaniel
that said people often use implicit return values and that often makes code more readable (at least to me)
15:14:50
jackdaniel
the conclusion in this poem https://people.cs.uchicago.edu/~wiseman/humor/large-programs.html strongly resonates with me ,)
15:22:05
Nilby
quasi-quoting was quasi-hard for me until a got quasi-good at it, but i still get quasi-confused by quasi-overusing it ,@,`,',@,