Programming thread

I use emacs, but pretty much solely as a text editor with syntax highlighting.

The thing is, emacs lisp is fucking horrible and I don't know how anyone ever writes anything in it.

If there was an emacs-like editor with a good lisp, like a scheme or something, that'd be baller as fuck. Except you'd lose all the years of extensions and other crap people have written in emacs lisp. So you'd have an even smaller audience of people willing to contribute.
i'm pretty sure there are many people secretly waiting for that, but nobody is brave enough (definitely not me) to make emacs 2 because it's a huge undertaking. one day some extremely autistic godlike programmer will say "fuck it" and successfully duplicate the critical mass of emacs needed for people to want to switch to it over emacs (this probably includes an org-mode equivalent, an email client, the git stuff, ide things, debuggers, tramp, info (of fucking course), a couple of the games, and last but not least a semi-decent text editor)

the new emacs probably doesn't have to be exactly like the old emacs because newfags would like a few of the keyboard shortcuts to be replaced with cuaslop. change-resistant emacs purists will probably end up writing binding sets. also elisp isn't the only thing fucked up about emacs either, it makes many, many assumptions and architectural choices that make it not work so well in current year plus ten

if andreas kling can make a web browser with css3 and js, anything is possible
There is this fennel language which is basically lua lisp. It compiles to lua and has full interop with it.
Some use it to configure neovim.

IDK how close it is to "emacs-like editor with a good lisp" though.
i've taken a cursory look at fennel and it looks like one of those cases where some crusty troon with a brain as necrotic as their crotch decided to make a "new lisp" for the "21st century" and then made one of those abominations nobody in their right mind wants to look at. i should look at it further so i can properly go into detail how absolutely braindead it is
took a more-than-cursory look and it seems to be more of a thin layer of lispy syntax over lua than a lisp. might as well just use regular lua, its default pascal-esque syntax is not terrible
 
Last edited:
found this:
WHATTHEFUCK.png
:cryblood:
I... AUGH WHAT IN THE NAME OF JESUS CHRIST IS THIS INSANITY
apparently having cond just isn't heckin' valid so they made this fucking bullshit. w h y ?

personally i'd use fennel if i was forced to but why would i use a lua syntax twisted by macros and compilers into a fake lisp
 
found some more:
  1. those square brackets are syntactically significant (and they have curly brackets too)
  2. a lot of common higher-order functions are replaced by some iteration macros
  3. no keywords (:something is syntactic sugar for "something")
  4. doesn't have a lot of the macro features scheme does
and other things like renaming a bunch of shit, fn is a combined form for lambas and lexically-bound function definitions, but there's also lambda that has arity checking and weird syntax for optional arguments
the n-legged if is definitely the funniest thing i saw though
 
Last edited:
Speaking of syntax abominations, I actually enjoy the attempts to bring LISP-like syntax to more popular languages, and have tried using Hy and Fennel before. The former was a truly awful experience because Python's basic list type is actually an array and the language doesn't really have a ubiquitous and universal linked list type (deques I guess? I think I ended up having issues connecting those to Numpy types). Here I was thinking that I'd have the convenience of the Python ecosystem for doing some real-world work for once, but I had to do retarded shit like
Python:
(defmacro car [lst] `(get ~lst 0))
(defmacro cdr [lst] `(cut ~lst 1 None))

(defmacro cons [a b]
  `(match (. ~b __class__ __name__)
     "Expression" (hy.models.Expression (+ [ ~a ] (list ~b)))
     "list"       (+ [ ~a ] ~b)
     _            (hy.models.Expression [ ~a ~b ])))
to get list destructuring. I think this is a good example of what makes "a lisp," list operations are truly indispensable. The method chaining dot syntax and Clojure-like transducers were very nice though, points for that. (side note: there is now a sizeable Hy file embedded in one of the university Python projects I worked on; good luck to any sucker who has to touch that shit in the future extremely-low-quality-trollface.jpg)

By contrast, I was left with a positive impression of Fennel. It also doesn't really have linked lists by default (and I guess isn't a true LISP in the above sense), but it compensates exceptionally well by having very smooth dictionary destructuring, kind of like a bizarro world "DICP." I wrote a little game for TIC-80 and also a bunch of code for Minecraft factory management using ComputerCraft with it, it was fun. I just wish it was more Scheme-like rather than CL-inspired, and IIRC there is another "LISP for Lua" project that does that but it's smaller and I haven't tried it yet.

Edit:
those square brackets are syntactically significant (and they have curly brackets too)
Well yes, the curly brackets are the Lua dictionary/table syntax

Edit 2:
The other LuaLisp I was thinking of is Urn, and it's done by some of the people involved in recent ComputerCraft forks. Actually looks pretty neat now that I look at it though much less "Scheme inspired" than I imagined; pattern matching, easy documentation and assertions- my God, it even has a loop macro!
:ghost:
 
Last edited:
I had to do retarded shit like ... to get list destructuring
this looks like perl on crack
also is it really lisp if it does not come with a fully-fledged incarnation of the holy cons cell by default
By contrast, I was left with a positive impression of Fennel. It also doesn't really have linked lists by default (and I guess isn't a true LISP in the above sense), but it compensates exceptionally well by having very smooth dictionary destructuring, kind of like a bizarro world "DICP." I wrote a little game for TIC-80 and also a bunch of code for Minecraft factory management using ComputerCraft with it, it was fun. I just wish it was more Scheme-like rather than CL-inspired, and IIRC there is another "LISP for Lua" project that does that but it's smaller and I haven't tried it yet.
to be fair fennel seems moderately sensibly designed for what it's trying to do: make a very thin lisp layer on top of lua, which is already lisp except they took out all the lists and replaced them with hash tables
it just has lots of that common lisp stink to it and it's also mostly lispy but not 100% lispy: so close, yet so far
 
  1. those square brackets are syntactically significant (and they have curly brackets too)
  2. a lot of common higher-order functions are replaced by some iteration macros
  3. no keywords (:something is syntactic sugar for "something")
  4. doesn't have a lot of the macro features scheme does
Maybe it's because I'm new and looking with an open mind, but these don't seem that bad. I actually like the semantic parens. That one is a choice, but the other complaints are just limitations of transparently running on the Lua VM. Higher order functions aren't in Lua, and it's easy to write your own. Lua has no keywords, so strings are reasonable for Lua interop. Macro features I don't know enough to say one way or the other.

Lua can already be degraded to Lisp-like without much work, you just move the operator outside of the form.

(+ 2 (* 5 5) in Lisp can be expressed in Lua as add{2, times{5, 5}}.

(Edit: Actually upon reflection, you can also just do x = {add, {times, 2, 2}} and then execute it later).

One thing I am struggling with is macros. To me they just look like partial function or function generators with some special syntax and comptime execution.
 
Last edited:
Higher order functions aren't in Lua
they are, look at this hof that i declare and then pass a 1-line anonymous function to
Code:
> function x(x)
    x(4)
end
> x(function(o) print(o) end)
4
they also have full-fledged lexical closure and tail call optimization
Lua has no keywords, so strings are reasonable for Lua interop.
i guess you're right on that, but why even have a read syntax for keywords when you have strings?
Lua can already be degraded to Lisp-like without much work, you just move the operator outside of the form.

(+ 2 (* 5 5) in Lisp can be expressed in Lua as add{2, times{5, 5}}.

(Edit: Actually upon reflection, you can also just do x = {add, {times, 2, 2}} and then execute it later).
this is an illusion made by careful metatable hacking. you have no cons cells, you have no lists, this is a sick abomination twisted by syntactical tricks and implicit bullshit into a crude imitation of nature's perfection

basically i feel like fennel is sensibly designed as a way to pretend you're using lisp while writing lua but it is not very strong as a real lisp
it is also undeniable that they have change things for no reason retard disease (LOOK at the screenshot, SEE the absolutely fucked-up if form)
 
Last edited:
Props to Guile-Emacs people, I hope it goes places. Guile is a good option for a Scheme standard
from what i've heard it has some mild adoption barriers that have stalled it for fucking years, but maybe eventually in 2052 our gnu/hurd machines will run on guile-based emacs
 
are there any kiwis into graphics programming?
I have good experience with OpenGL ES / WebGL / WebGPU / Metal. Let’s chat!
> Embedded Systems (phones) and web standards
Ew.

Anyone have any strong thoughts on Graphics API abstraction layers? Things like BGFX, Sokol, or SDL3's GPU Api?
 
is there a lisp for gpus?
idk but if there isn't there should be
existing lisps might be hard to port mostly unaltered to gpus since they commonly assume the presence of things like gc
but you could probably make some abomination lisp syntax for glsl with lispy macros
 
  • Thunk-Provoking
Reactions: Marvin
I had an idea for a language/program that would allow you to edit videos via scripting. I wrote up a demo for what it would be like

Code:
//assign memory values to the videos
//local is one of many static always-ready objects, like log in JS
Video trailer = local.fetch(/Videos/Clips/"tank_game_3.mp4");

//Visual objects are only able to be modified via video methods
Visual explode_vfx_1 = local.fetch(/Videos/VFX/"greenscreen_explosion.gif");

//Audio objects are only able to be modified via audio methods
Audio explode_sfx_1 = local.fetch(/Music/SFX/"boom_sfx.ogg");

//Modify the objects via methods (doing editing of the clips with scripts)
//Modified clips are stored in your project folder under res/modified
//The final clip(s) produced at the end of the program are stored under res/final
//Unless you want to recursively edit clips, use the filepath to the original

//opens the object to editing
explode_vfx_1.open;
//remove the green background from the gif
explode_vfx_1.cull_color("#04F404");
//what if the gif is too high contrast?
explode_vfx_1.add_saturation(-0.02f);
//okay, now we're done
explode_vfx_1.close;

//lets define a function!
//this will distort the image randomly
//function's return type depends on what it returns when it's done
//writing this farther down than it should so you could get the basics first
//Editable represents any Video/Audio

fn rand_distort(int seed, bool use_wfc, Editable to_edit) {
    //more static objects
    perlin.set_seed(seed);
    //wave function collapse
    if use_wfc {
        wfc.set_seed(seed);
    }
    //methods used returns what it edited after processing
    to_edit = perlin.distort(to_edit);
    if use_wfc && to_edit is_of Visual {
        to_edit = wfc.iterate(to_edit);
    }

    return to_edit
}

//just one more edit on the explode gif...
//still need to open to edit, even with functions!
explode_vfx_1.open;
explode_vfx_1 = rand_distort(rand.gen_seed(),false,explode_vfx_1);
explode_vfx_1.close;

/*
insert the explode visual effect at pixels x:300, y:600 from top left, 100 seconds
into the video, overlapping the video rather than overriding it.
The visual lasts as long as it would in a video player unless specified otherwise
*/
trailer.open;

trailer.overlap_visual(300,600,explode_vfx_1,100);
//insert the appropriate sound effect, and override the existing audio
trailer.override_audio(explode_sfx_1,100)

int trailer_len = trailer.length();

//MORE EXPLOSIONS!!!
for (int i = 130; i < trailer_len - 30; i+=30) {
    trailer.overlap_visual(300,600 + i/3,explode_vfx_1,i);
}

trailer.close;

//don't forget to close the program!
//another static object, outputs exit code in terminal
system.exit(0);

Thoughts?
 
  • Like
Reactions: y a t s
I had an idea for a language/program that would allow you to edit videos via scripting.
FFMPEG's filter_complex should be able to do everything that script does in principle. By "in principle", I mean that I don't think there's anything like your Perlin distorter currently in the built-in filters, but it could be implemented.

Some equivalent filter names:

cull_color is colorkey
add_saturation is eq=saturation=0.98
overlap_visual is overlay
For audio mixing, use adelay and amix

https://ffmpeg.org/ffmpeg-filters.html -- full list of what FFMPEG offers here.
 
Thoughts?
i don't really see anything that really necessitates its own programming language, and the language seems to concern itself with things that are probably too low-level for script writers to need to bother dealing with (opening and closing files, oop system)
also it seems like it isn't very friendly to automatic optimizations like gpu processing or parallel operation on unrelated streams
this might make a neat library though

the guy above is right, though: this doesn't really do anything that ffmpeg can't do in principle
 
Back