freenode/lisp - IRC Chatlog
Search
14:44:36
jackdaniel
alandipert: alexandria is public domain library with no dependencies, you may just copy `switch' from it
14:58:02
fiddlerwoaroof
I guess that wouldn't make sense, though, because you have to ql drakma anyways...
14:59:59
shka_
but at the same time SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
15:17:29
jasom
I got a super-linear speedup by parallelizing my program (by converting to work-queues I was able to batch up doing some work that I had been doing incrementally before, which turned out to be a big win performance-wise)
15:19:35
drmeister
Clasp is hanging while trying to connect to the Slime port 50965 - did that change? I thought it was port 4005?
15:48:19
alandipert
for the string case thing, made my own macro. i'm a CL noob so thanks in advance for style/function feedback: https://gist.github.com/99e96112110b24d0861852ffe4bf4c7d
15:54:30
alandipert
Bike by use cond, do you mean map over the clauses and transform to cond clauses? if so, +1
16:31:06
jasom
alandipert: I usually just use COND with STRING= without a macro. Also, if there are a very large number of strings, you may get a performance boost by interning the string into an otherwise unsed package and then just using case
16:35:02
aeth
jasom: lparallel appears to be written correctly, too, just based on a quick glance of common mistakes that CL library authors make.
16:36:44
jasom
aeth: my only wishlist I have is that it's blocking-calls would let other tasks be scheduled on the worker threads. Of course implementing that would be challenging.
16:39:48
jasom
e.g. right now (submit-task c 'force p) (submit-task c 'force p) (submit-task c 'fulfil p 1) will succeed with 3 or more worker threads and deadlock with 2 or fewer.
16:41:48
jasom
a half-assed implementation of that is possible; you could run another task to completion if you are blocked and there are more tasks pending, but arbitrary scheduling can't be done that way.
18:48:50
White_Flame
whoman: I think Racket uses a singular top-of-file indicator for which language the file will use. I'm not sure if it also supports mid-file changes of language, or any form of nesting language changes inside expressions
19:06:25
jasom
right, which is part of what racket languages provide; they provide a custom parser and then a custom AST transformer IIRC
19:06:38
malice
While I'm not sure if you can scan until EOF, you could establish a syntax like #lang something (body) #endlang
19:07:51
jasom
no need for that, load binds *readtable* before loading the file, so you can just make a new readtable and when it reaches EOF the readtable will be reset
19:08:27
malice
But the ending could help you with more than one language per file, if you needed that.
19:09:04
malice
This year's ELS guys from germany had some fun with readtables and made some C(or C++)'s subset parser. They dispatched on space, which was quite funny hack
19:11:30
jasom
which could easily happen if it has multiline strings and there's example code in the multiline string
19:22:21
aeth
If you're doing it through a reader macro, you will be able to tell the difference, because you need to write a char-stream reader
19:23:34
aeth
You should be able to do something basically identical to Racket in CL, using reader macros, no additions required.
19:24:25
aeth
Essentially every language will be a subset of CL in different syntax with perhaps some things written in CL added in. So things that you cannot easily or performantly write in CL will be the real issue.
19:24:59
White_Flame
jasom: that's why above, I was thinking that the toggles between languages wouldn't be textual. Like you hit Ctrl-something to switch language states, and it stores metadata around parts of the source code.
19:25:00
aeth
So I'm sure something like a literal Python implementation would be pretty hard to do (and it wouldn't even be fast when done), but something that looks like Python should be pretty easy, and almost as performant as CL
19:25:21
aeth
White_Flame: But if it toggles between languages in a textual way, you can just program SLIME to hide that.
20:09:59
jasom
malice: right which goes back to what I said about #endlang needing to be an invalid token in all custom languages (otherwise it would be accepted in the parse)
20:12:08
jasom
but really I see no problem with EOF to indicate the end of the language. Toggling between multiple languages in a single file seems needlessly complex, absent small DSLs that are readtable-compatible with lisp.
21:08:40
aeth
jasom: embedded non-string languages in CL should terminate on ) where the ) is not matching an internal (
21:09:28
aeth
jasom: e.g. #4f(+++++++++[>++++++++<-]>.<+++[>++++++++<-]>+++++.+++++++..+++.>++++[>++++++++<-]>. <<<+++[>--------<-]>.<+++[>++++++++<-]>.+++.------.--------.>>+.<++++++++++.)
21:10:35
aeth
If Brainfuck didn't use []s and instead used ()s, that still wouldn't be an issue because only a top-level (from the perspective of brainfuck) #\) would end it (and a preceding #\( would make it not top-level).
21:11:50
aeth
When you require top level parentheses, you get rid of a lot of issues. For single-language files, no need to even have #langfoo, just go by the extension, e.g. .bf for Brainfuck.
21:13:00
aeth
But if you must have a #lang foo because you don't want extension explosion, you can just use EOF because it'd be effectively treated like a monolingual file with its own extension in that case. In the case where mixing and matching is good, use parentheses.
21:13:45
aeth
REPL use will be an issue this way, though. Perhaps each language gets its own REPL, that is handled seemlessly through a plugin in Emacs/etc.
21:16:11
aeth
So essentailly there would be four ways to embed a language: a string, a reader macro that begins with #\( and ends with a top-level (from the perspective of the language) #\), its own file with its own extension (no header necessary), and a .lisp file with a #lang header that is otherwise identical to the previous
21:17:32
aeth
This can already be done quite trivially (this is most of the work of cl-brainfuck, except for the 4th method), but the tricky part is REPL, especially if you wanted to do something like use SLIME with the embedded languages.
21:18:27
aeth
e.g. it is probably easier to add Geiser support to cl-scheme than actually try to get some method of mutlilingual toggling in SLIME, and Scheme is very syntactically close to CL (but not close enough to share the same reader)
21:19:35
aeth
(Any hard interoperability challenge is probably easier than actually writing some of the more difficult to write declarative languages, though.)
21:23:03
aeth
Put more briefly, if you want to mix a Python-like language into CL, you'd do something like put it within #lfoo(import foobar ...)
21:23:26
aeth
I suggest using #l for language to prevent running out of characters for dispatch functions.
21:24:29
aeth
So I could rewrite cl-brainfuck to be #4lbrainfuck(+.) instead of #4f(+.) and the actual meaning of the optional number prefix would depend on the language (in Brainfuck, it's the size of the tape so you don't waste too much memory)
21:25:14
aeth
And with some sort of convention, emacs could be modified to recognize that convention, and provide embedded syntax highlighting (org-mode probably already has this functionality)
21:34:09
jasom
aeth: that's what I meant by embedded DSLs that are readtable-compatible with lisp. LOOP is an example.
21:36:29
White_Flame
I would actually like to replace read tables with a more declarative BNF-ish approach
21:55:14
jasom
the readtable only has 1 character of lookahead, so implementing a full BNF is complicated
22:26:08
aeth
So how many people would be interested in some sort of general sublanguage framework for CL?
22:33:54
White_Flame
I"m interested in one for my big back burner pipe dream declarative post-CL lisp
23:00:47
aeth
White_Flame: I think that's one of the possible futures of CL. A target language, sort of like JavaScript, but far more capable at that job (and also far less available unless there's a WASM CL)
23:01:17
aeth
There are some extensions that are needed at the language level, but most components are already there, just needing libraries.
23:01:25
White_Flame
there's nothing in there about being a 'target language', but a primary language
23:05:51
aeth
I would love to see a logic language, a query language, a static language, a pure functional language, a modern CAS, etc., written in and running in CL. (Except for a GPU Lisp, which would just be written in CL, and running on the GPU, obviously.)
23:07:13
aeth
There needs to be a good interoperability with the host CL and the languages, and probably also some standard framework uniting them.
23:08:35
jasom
aeth: I'm interested because I'd like to explore something like typed-racket but with CL. Also I find treating the entire file as a different language is less error-prone that mix-and-matching readtables
23:09:18
jasom
Also, it will help keep Fare in the lisp community; the language features of racket are tempting him away IIRC.
23:09:50
sjl
jasom: shen can call out to the CL host... is there any support for going the other way?
23:10:25
aeth
jasom: I would definitely like to use something like typed racket in CL. I often use typed CL anyway, with declare, etc..
23:10:47
aeth
jasom: That would, afaik, probably require modification to the host CLs, though, by adding to the standard.
23:15:38
jasom
aeth: I know how to do some of what typed racket without any modification to the host CL; types can be erased at macroexpand time without losing any of the functionality I believe.
23:17:45
aeth
A well-designed typed CL embedded within CL with major compiler support would be a good choice for parts of a program that need performance.