HackerTrans
TopNewTrendsCommentsPastAskShowJobs

saikyun

no profile record

comments

saikyun
·5 years ago·discuss
Aha, thanks for the info. Then I believe Janet could fill a similar role. What little profiling I've seen puts them in a similar category: https://github.com/MikeBeller/janet-benchmarksgame/blob/mast...

Though I imagine it's hard to say without actually trying it.
saikyun
·5 years ago·discuss
Last time I checked, Carp doesn't have a REPL that can interact with a running process. In Janet you can do things like change functions during runtime.
saikyun
·5 years ago·discuss
I think this is LuaJIT, or? Iiuc Janet is comparable to non-JITed Lua. But I actually have no clue.
saikyun
·5 years ago·discuss
You can access any element in your array in O(1). I think it is faster to loop through as well, but I'm not so sure about that.

The drawback is that appending / removing elements at the beginning of the array is O(n).

When it comes to interacting with the collections I mostly use the loop / seq macros, which I believe are pretty similar to Common Lisp. Ofc you also have map / filter / reduce.
saikyun
·5 years ago·discuss
This is what I was referring to, sorry for being unclear. :)
saikyun
·5 years ago·discuss
Thank you! That is exactly what I'm going for. :) My friend said "so you're just making basic?", haha.

I didn't get to experience C64 / Amiga era, but after having listened to 100s of interviews with swedish game developers it seems that the automatic (or even required) access to a coding environment sparked a lot of creativity and imagination. :) I hope Freja can capture at least a part of that.
saikyun
·5 years ago·discuss
It's easy to treat any C struct as an abstract object in Janet, then have functions that do specific things (e.g. write to the file, read from it, etc). You have to write some manual code, but it's generally not too bad.
saikyun
·5 years ago·discuss
This is solid advice. :)
saikyun
·5 years ago·discuss
I know I had some trouble with raylib's dependencies on Linux. If you get stuck, feel free to at me at the janet gitter.
saikyun
·5 years ago·discuss
> I have never been successful getting any of the UI or drawing libraries to work.

Have you tried jaylib (built on top of raylib)? I have gotten that to work well on macos, linux and windows. :)

> The main http server circlet is MIT licensed, but it is built on top of Mongoose, which is GPL/paid commercial. Something to be aware of if you want to distribute binaries made with this library.

While I haven't used it outside of development, chidi is MIT licensed. :) https://git.sr.ht/~pepe/chidi
saikyun
·5 years ago·discuss
Oh, that's really cool. :) Thanks for mentioning it.
saikyun
·5 years ago·discuss
Thank you. :)

If you do try it out, I'd be happy for any feedback on Freja! :)

I should mention that Windows support is currently a bit behind, so if you're on Windows I could fix that then comment here again when it's done. :)
saikyun
·5 years ago·discuss
I'm making an editor, Freja, which is like a tiny Emacs with graphical support. Makes it fun to create gui apps and games. :)

Ultima Underworld inspired game I'm making for a game jam: https://youtu.be/1fWsV83P-S8

Demo of pixel editor: https://www.youtube.com/watch?v=KOBi805nxNc

Freja: https://github.com/Saikyun/freja

---

My experience has overall been very nice. I come from Clojure, and comparing to that:

- so nice and small! Clojure is great but has a lot of baggage from JVM, for good and bad

- very easy to get started interoping with C. You need to manually wrap libraries, but I think it's pretty easy. As a benefit, you are able to throw exceptions from C that can be catched from Janet. The C support is what sells me on Janet over Clojure

- repl:ing works well, but you can get tripped up by early binding and lack of namespaces. There are ways around it, but when coming from Clojure it was a bit hard to wrap my head around

- many libraries that you'd want are already wrapped, like http-servers and postgresql connections. But ofc this is an area that is thinner than older languages. It's decently easy to wrap C-libs though

- easy to understand data structures if you've used JS / Lua -- "everything is a hashmap" (but there are also arrays and strings)
saikyun
·5 years ago·discuss
Though you can share memory manually, i.e. in C but access it from Janet.
saikyun
·5 years ago·discuss
Ah, that's cool. I haven't heard of similar integrations with python, but I imagine it's possible to set up. :) Hope you're having fun with it!

If you get a chance to watch the videos it might give you some extra ideas on how to enhance your vscode + ipython experience, or maybe you can find issues with what I'm doing and tell me how to do it better. :D
saikyun
·5 years ago·discuss
I'm happy you asked! :) I think these terms are very vague, and I haven't found a good way to be more clear. For me a "real repl" includes:

1. Decent support from the language to do REPLy things

E.g. being able to change a function during runtime. Imagine an animation which is defined by perhaps: `(defn anim [time v] (* time v))`. Now you want to try something else, without having to recreate all state, so you just do `(defn anim [time v] (* time v v))` and hit Ctrl+L ("load file"). Oh, it seems I need to reset the animation, so I add some code to reset just the part of the state needed. Now I'm able to hit Ctrl+L and it'll run the new animation each time. The ability to do this ad-hoc anywhere in my code is so flow-inducing it's crazy. And I do this for games, web servers and browser GUIs. It's surprisingly general!

2. Editor support

The Ctrl+L I mentioned above is something I do in my editor to send code from my editor to the repl server. I haven't tried Ipython, but I'm guessing it might work similarly to node, where the client and server are kind of stuck together. With a "real repl", you generally use your editor as the client. Here's a video I've made that shows how this can look: https://youtu.be/Enumt6qxAgc?t=667

I know it's often possible to disconnect these (I've tried connecting my editor to the chrome debugger -- that's pretty cool!), but it doesn't seem to be in common use, which leads to...

3. Libraries supporting being run from REPLs

One not-so-uncommon problem is that e.g. a web server or game loop might block the REPL. This one is probably the hardest one to fix for existing languages and their libraries. There are often ways around this, like running on multiple threads, but that can lead to new problems. Even in clojure, I've had problems due to java libraries blocking (e.g. game lib LWJGL). It doesn't help that on macos all GUI related calls must be done on the main thread (so running LWJGL on one thread and repl on other breaks things). So far with janet I've managed to solve these issues easily thanks to the event loop (which iiuc works similar to js event loop).

---

I think the main thing to realize is that this way of developing leads to new possibilities of exploring software development. Suddenly you're able to experiment quicker, in a way that sometimes leads to typing speed being a bottleneck! :D It feels really cool, and I want to share this feeling of flow with as many as possible.
saikyun
·5 years ago·discuss
I've used it to make Freja, a text editor making coding GUIs and games fun for me again. Demo: https://youtu.be/KOBi805nxNc

When comparing to non-lisps 1. It has a real REPL, so you can do live coding (this is what makes me choose it over many languages at the same "level", js, lua, python, java). Honestly, this feature alone makes or breaks languages for me. 2. It is easy to interact with C (I found this hard in js, haven't tried the other)

Comparing to lisps (I've only properly tried guile & clojure) 1. Easy to build on windows / macos / linux (compared to guile which I didn't manage to build on windows) 2. Compared to clojure, just closer to the machine overall, in my case specifically OpenGL libs. I love Clojure but have had a hard time making client side apps with it. Done a bunch of CLJS stuff (e.g. card game https://animal-capital.surge.sh/), but many little things get annoying (e.g. can't open my editor from a browser error, can't `eval` etc. Doesn't quite have the live coding feel).