~technomancy

~technomancy/fennel

Last active 5 days ago
View more

Recent activity

Table macros 5 days ago

From Phil Hagelberg to ~technomancy/fennel

One common pain point with Fennel is that it's missing certain helper
functions you'd expect around tables, like map/filter/etc. This is done
because a key design goal of Fennel is to have no runtime overhead, so
introducing new functions is not possible.

However, this doesn't mean that we can't add them as macros; it would
just turn into a `let`+`each` form at compile-time.

We recently introduced `map` and `kvmap` to the compiler internals,
and it's helped clean up a fair bit of code. We could also expose it
in Fennel code itself, although it would have to me a macro which
would expand to an `each` call because of the restriction of having no
runtime.

[PATCH] Port the repl over to Fennel instead of Lua. 6 days ago

From Phil Hagelberg to ~technomancy/fennel

This ports over the repl function from Lua to Fennel in an effort to
start getting a little more self-hosty, incrementally. I had to expose
a few internal compiler bits to the Fennel code that aren't already
part of Fennel's API; see the `internals' table near the bottom, but
it wasn't too bad. We also change the makeScope function to default to
GLOBAL_SCOPE as the parent to avoid needing to expose more internals.

We got a line reduction from 156 lines to 125, which isn't quite as
much as I'd expected but isn't too bad.

---
 api.md     |  11 ++
 fennel.lua | 342 ++++++++++++++++++++++++++++---------------------------------
 2 files changed, 168 insertions(+), 185 deletions(-)
[message trimmed]

Re: [ANN] Fennel 0.3.2 released 6 days ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Awesome! Can't wait for it to be updated on luarocks.

Oops; thanks for the reminder. Just pushed it out to luarocks too.

-Phil

[ANN] Fennel 0.3.2 released 7 days ago

From Phil Hagelberg to ~technomancy/fennel

Hello everybody.

I'm happy to announce the release of Fennel 0.3.2.

This is a bugfix release to take care of a few things we found before we
start work on bigger changes in 0.4.0.

* Fix a bug where `include` could not be nested without repetition (#214)
* Fix a bug where globals checking would mistakenly flag locals (#213)
* Fix a bug that would cause incorrect filenames in error messages (#208)
* Fix a bug causing `else` to emit twice in some contexts (#212)
* Dissallow naming a local the same as global in some contexts

Since I somehow forgot to announce 0.3.1 on the mailing list, here's a

Re: Fennel -> Hammerspoon repl 26 days ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> I tried this way and it didn't work for me. I am clearly missing something here.
>
> - I have cloned jeejah repo and did ~luarocks make ./jeejah-0.3.0-1.rockspec~;

I haven't released the changes in luarocks yet; you'll have to manually
install the files in your codebase by copying them in. It should just be
bencode.lua, jeejah.lua, and jeejah/fenneleval.lua.

-Phil

Re: Fennel -> Hammerspoon repl 29 days ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Okay, I tried this:
>
> [...]
>
> Connected with Monroe, resumed coroutine, because debug is enabled it
> printed 'Connected' in the console. But I don't think it's getting
> into the middleware function at all. I tried typing in the REPL and
> then resumed coroutine multiple times, nothing is happening.

I pushed a change to Jeejah to move Fennel handling from being a
middleware to being a custom op, so it's easier to invoke when using
Jeejah as a library. (This also means you get access to locals-saving

Re: Fennel -> Hammerspoon repl 30 days ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Right now my struggle is - I need to be able to use JeeJah as a
> library. So I started with something like this:
>
> #+begin_src fennel
> (local co (require :coroutine))
> (local jeejah (require :jeejah))
> (global jco (jeejah.start 3444 {:debug true :fennel true}))
> #+end_src

> (hs.hotkey.bind [:cmd] :t nil (fn [] (co.resume jco)))

OK, so one problem here is that the Fennel support in Jeejah is

Re: lsp-server a month ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Has anyone thought about it? How difficult would it be to write one?
> This would make it so nicer to work with the language.

I think most lispers are looking for tooling that's a bit more
lisp-friendly and includes repl integration, so no one's bothered with
LSP yet.

However, Lua's LSP server would at least give you autocompletion and
jumping to definition, probably without needing any modification:

    https://github.com/Alloyed/lua-lsp

Re: Fennel -> Hammerspoon repl a month ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Phil, this is really helpful, thank you. Unfortunately I am still a
> bit confused. Let's say I figured out the correct parameters for
> ~fennel.repl~ function, I run it. How do I connect to it using
> inferior-lisp, i.e. ~M-x run-lisp~?

This depends on how your IPC works; you would have to run whatever
program could use IPC to provide input and get output over the mechanism
that you used in your fennel.repl call.

If you don't have anything existing that can do that using hammerspoon
IPC, then maybe that's not the best way to do it. If you embed a Jeejah
repl server you can connect with an nrepl client like Monroe:

Re: Fennel -> Hammerspoon repl a month ago

From Phil Hagelberg to ~technomancy/fennel

Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Now. It seems I can't quite do the other way around. I can't do
> ~fennel --repl~ and hope to be able to use Hammerspoon's modules to
> try things.

You should be able to do this if you figure out the right package.path
settings, but I don't know anything about Hammerspoon, so I can't say
much about this.

> So essentially I have to call ~fennel.repl~ function from Hammerspoon
> context, but what does that do? Does it try to connect to existing
> fennel REPL instance? Does it create a new one? How do I connect to
> that "specialized" REPL instance (that is capable to send messages to