~technomancy

~technomancy/fennel

Last active 3 days ago
View more

Recent activity

Re: Fennel -> Hammerspoon repl a month ago

From Phil Hagelberg to ~technomancy/fennel

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

> Hi, I just rewrote my entire Hammerspoon configuration using Fennel
> and I can't be happier. Fennel is awesome. Now I want even more out of
> it. I'm thinking if it would be possible to have a Fennel REPL that
> compiles and evals by sending forms to Hammerspoon's IPC. I doubt that
> anyone has ever tried that before, any hints how I can build something
> like this would be appreciated. Thanks!

Sure; you can start a repl that has the read/write functions overridden
to use another function other than io.read and io.write; for instance,
something that communicates over IPC. Here is an example of how the repl
on fennel-lang.org does it; in that case the repl runs in a coroutine
which gets resumed when the enter button is pressed in the input

Re: kebab -> camelCase 2 months ago

From Phil Hagelberg to ~technomancy/fennel

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

> So I'm wondering if there is a way to refer to third party Lua
> functions using kebab/lisp syntax and somehow force Fennel to correct
> them into using camelCase.
>
> Is something like that possible?

Sure--there's two ways you could do this. First, you could have a
code-rewriting macro which checks for any references to a specified
global such as `hs` and performs a rewrite on any direct field
references to make them camelCased. This would have no runtime
overhead, but it would miss non-direct references such as `(. hs
:console :clearConsole)` or any iterator use.

Conference videos 3 months ago

From Phil Hagelberg to ~technomancy/fennel

Hey everybody!

I'm heading home from a successful FennelConf 2019. Thanks to all the
speakers who put a lot of work into the excellent talks, to Justin Smith
for hosting us at our venue, and to Ken Restivo for helping set up an
A/V streaming and recording arrangement. We were able to stream the
talks as the conference happened, and three of the four talks were
recorded.

You can watch the videos at https://conf.fennel-lang.org.

Looking forward to seeing you all next year!

-Phil

Re: Optimizations in Lua code generation 4 months ago

From Phil Hagelberg to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> I loaded the new version into EXO_encounter-667, which is my largest
> Fennel codebase. It removed all but 3 unnecessary IIFEs (at least, those
> 3 seemed unnecessary to me; maybe they in fact are needed.)

Here are the IIFEs I saw; turns out there's 3:

    (let [layer (: map :addCustomLayer "player" 8)]
      (set layer.sprites [(unpack state.rovers)])
      (tset layer.sprites 0 state.probe)
      (set layer.draw (partial draw.player world state)))

    ;; local function _0_(...)

Re: Optimizations in Lua code generation 4 months ago

From Phil Hagelberg to ~technomancy/fennel

Calvin Rose <calsrose@gmail.com> writes:

> This is a heads up on some changes I have been working on for Fennel
> having to do with code generation. Some discussion on IRC has been about
> how the Fennel compiler (0.2.1) was generating anonymous functions that
> are immediately called (IIFE, or Imediately Invoked Function Expression)
> in many cases, even when not strictly necessary.

Nice work! I only find the need to look at the compiled output
increasingly rarely, but "too many IIFEs" was basically my only
complaint about the readability when I did need to.

I loaded the new version into EXO_encounter-667, which is my largest
Fennel codebase. It removed all but 3 unnecessary IIFEs (at least, those

Fennel 0.2.1 4 months ago

From Phil Hagelberg to ~technomancy/fennel

Hey folks.

Yesterday Calvin just pushed out version 0.2.1 of Fennel, which fixed a
few bugs we found right after the 0.2.0 release:

* Add not= as an alias for ~=
* Fix a bug with in-scope? which caused pattern matching outer unification to fail
* Fix a bug with variadic ~= comparisons
* Improve error reporting for mismatched delimiters

Happy hacking!

-Phil

Re: Named lets in Fennel 5 months ago

From Phil Hagelberg to ~technomancy/fennel

Justin Smith <noisesmith@gmail.com> writes:

> On Fri, Jan 18, 2019 at 1:32 PM Jason Valencia <jasval@airmail.cc> wrote:
>>
>> Scheme has a concept of "named lets", essentially a let you can call
>> from within itself, which is useful for recursion.
>>
>> R5RS [1]:
>> > (let <variable> <bindings> <body>)
>
> so is this effectively (fn x [] ...) except x is only visible inside
> the fn, and not to the surrounding environment?

Yeah, I would say we already have this construct more or less. Is there

Re: Plans for 0.2.0 5 months ago

From Phil Hagelberg to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> Any other ideas for what we might want to include in the next release?
> Or questions about the above?

A friend of mine is a debian developer who's considering packaging
Fennel in the upcoming Debian Buster release, which has a freeze in a
week or two.

If we could cut a release of Fennel 0.2.0 it would make it easier for
her to do this. Is there anything else that should be considered for the
release?

Calvin: I was assuming you'd want to do the release, but I can handle it

Re: behavior of -> etc. 5 months ago

From Phil Hagelberg to ~technomancy/fennel

Calvin Rose <calsrose@gmail.com> writes:

> In general, I think (-> x f g print) looks nicer than (-> x (f) (g)
> (print)).

Cool; I have no objection to this. I just wanted to make sure we merged
it for the right reasons rather than just doing what Clojure does.

-Phil

[PATCH] Allow inline macros. 5 months ago

From Phil Hagelberg to ~technomancy/fennel

This splits up `require-macros' into two parts:

* The bit that loads the macro modules has been split into a helper
  `loadMacros' function which is only concerned with that one job.

* Once we have a table of name/macro-function then we pass that to
  `doMacro', which takes each of the macro functions, turns them into
  specials, and inserts them into the specials for the given scope.

* doMacro can also be used on its own thru the new `macros' special
  which simply takes a table that gets evaluated in compiler scope.

For instance, from the test suite:
[message trimmed]