freenode/#lisp - IRC Chatlog
Search
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.
23:20:29
Cthulhux
can i have a defstruct with predefined "types"? i want to have a number of items which have several "flags", each going from 0 to 5.
23:23:01
aeth
In fact, afaik, that's the main reason why one would want to use defstruct over defclass because most CLs (CCL doesn't, but SBCL does) ignore :type in CLOS
23:23:31
aeth
If they're all the same type, you can even make them inherit from an array. axion does this, so axion probably knows the syntax for that.
23:25:48
axion
In that case, it is no longer a structure-class type, and has all the properties of an array (or list) in addition to the struct accessors
23:26:59
Bike
defstruct with :type is just a way to define a bunch of accessor afunctions conveniently, and dthey're simple enough that they ought to be inlined
23:28:17
aeth
jasom: Does the work with multiple values? Because if it doesn't, that's one disadvantage.
23:29:04
jasom
e.g. lets say we can define a type (list foo) that is (cons foo (list foo)) (which you can't do now). We can eliminate that type and change all calls of (car X) to be (the foo (car X))
0:03:39
PuercoPop
jasom: I swapped [] with () a long time ago, so that won't do :'(. But it seems a sensible choice. I only used vim for ~2 years before switching to Emacs. Giving Evil a try because of lispy-mode
0:20:38
jasom
<< and >> adjust the parentheses to match the indentation, as does TAB/backtab at the start of the line in insert mode
0:34:41
PuercoPop
jasom: Thanks for the tips. I have M-x indent buffer which is kind of inefficient, so when possible I do C-M-a C-SPC <TAB>
0:59:23
Bike
i mean, so it will only fire if the value of *cqm-graphics-event* is the symbol *CQM-GRAPHICS-CREATE-WINDOW*.
2:50:51
fiddlerwoaroof
jasom: I've been using vim for a while now (10 years +/-) anyways, I recently switched to a custom emacs config based on evil-mode and it's surprisingly good
2:51:20
fiddlerwoaroof
Also, I've been playing around with using utilities to bind the shift keys to ( and )
2:51:58
fiddlerwoaroof
Basically, when you hit and release shift quickly without another key, it inserts a parenthesis but if the shift is part of a chord, no parenthesis is inserted
2:52:25
fiddlerwoaroof
The jury is still out on this setup, but it makes life a tiny bit easier... and it's more intuitive to use the left side of the keyboard for ( and the right side for )
4:45:31
axion
if ningle is too much, it is built on clack. if ningle is not enough, caveman2 is built on it (all by same author)
4:59:26
sukaeto
by default it pulls in a lot of dependencies, but they're all pretty useful (sxql, datafly, djula)
5:01:07
sukaeto
further ningle/caveman2/anything based on clack are pretty easy to manage in production
5:02:31
sukaeto
I use docker to spin up a bunch of fcgi workers and set up nginx to round robin to them
6:34:57
drmeister
Hey lispers - I set up a demo of Cando running in a jupyter notebook over the web.
6:35:15
drmeister
I wonder if a kind soul could connect into it with their browser and tell me if it works for them.
6:35:37
drmeister
It's a Common Lisp implementation with Chemistry code that builds molecules and displays them in your browser.
6:39:46
drmeister
It should open up a notebook and if you click an "In" box and then hit Shift-Enter - it will build some molecules and let you view them.
6:41:37
drmeister
I'm just looking for confirmation that it works from somewhere other than my laptop
6:45:33
drmeister
I don't want to leave this thing running - it's running in a Docker container on an AWS instance - but it can evaluate arbitrary code and it costs me a few pennies an hour to run the thing.