~technomancy

WA, USA

https://technomancy.us

tryin' to catch the last train out of Omelas

~technomancy/fennel

Last active an hour ago
View more

Recent activity

Re: [PATCH] ensure that __fennelview has higher priority than :prefer-colon? 16 hours ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Listopadov <andreyorst@gmail.com> writes:

> When __fennelview calls view function with last argument set to true
> the string is printed as colon string, when possible.  When the last
> argument is false, string is always printed in double quotes.  When
> the last argument is omitted, value of :prefer-colon? key is used.

Pushed and applied; thank you!

-Phil

Re: [PATCH] add nil-safe table lookup operator 2 days ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Listopadov <andreyorst@gmail.com> writes:

> This patch adds new ?. operator. This operator can be used to do
> nested table lookup in a nil-safe manner of -?> and -?>>
> operators. This means that if any of subsequent keys do not exist,
> this operator will short-circuit to nil value:

Thanks! Applied and pushed, with a little tidying up of the
implementation. This will come in handy.

-Phil

Re: [PATCH] fix match not handling false pattern correctly 2 days ago

From Phil Hagelberg to ~technomancy/fennel

Nice catch; thanks. Applied and pushed!

-Phil

Re: [PATCH v2] implement new prefix syntax for match macro 4 days ago

From Phil Hagelberg to ~technomancy/fennel

Thanks; applied and pushed!

Andrey Listopadov <andreyorst@gmail.com> writes:

> +(match data-expression
> +  pattern body
> +  (where pattern guard guards*) body
> +  (where (or pattern patterns*) guard guards*) body)"
> +  (let [conds-bodies (partition-2 (table.pack ...))

After I applied this I realized we can't use table.pack here because it
doesn't exist in older Lua versions. Luckily we can just use [...] and
instead of seq.n we can use the `length` operator, because ASTs are
guaranteed to not be sparse. When they look like they have nil in them,

Re: [PATCH] implement new prefix syntax for match macro 4 days ago

From Phil Hagelberg to ~technomancy/fennel

This looks great; thanks!

Andrey Listopadov <andreyorst@gmail.com> writes:

> I've added tests for the new syntax, and ensured that all old tests
> pass. I've also removed old syntax from the reference.md. It is still
> accessible and will continue to work, but I think we should encourage
> to use prefix notation by default.

It might be a good idea to keep a brief mention of the old style in just
in case people come across some old code and want to know why it works,
similar to how require-macros is mentioned but is advised against. (In
fact, the parallels to require-macros are strong because import-macros
also expands to code which uses the old deprecated form.)

Re: Prefix notation for match guards 6 days ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Orst <andreyorst@gmail.com> writes:

> So if I understood you correctly, you're OK with allowing `or` outside
> of `where` clause?  My initial implementation only allowed it inside
> `where` specifically to indicate that this `or` is not ordinary `or`,
> but a part of `where` syntax.

Oh interesting; I guess I overlooked this aspect of your proposal.

Honestly I don't feel strongly either way. Like... the advantage of your
original proposal is that it limits the surface area of what's
"special". You look for `where` and if it's not there then the entire
pattern is treated literally.

Re: nil-safe nested table access operator 9 days ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Orst <andreyorst@gmail.com> writes:
> Hi I wanted to suggest new operator for Fennel for nil-safe nested table access.

Thanks for submitting this. I think it's a helpful addition.

> I would like to propose ?. operator which will short-circuit if any of
> keys are not present.
>
>     >> (?. t [:a :nope :c])
>     nil
>
> This operator accepts keys in sequential table, because optional
> default value can be specified as third argument:
>

[PATCH] Make sym? take an optional second name check argument. 12 days ago

From Phil Hagelberg to ~technomancy/fennel

Since = does not work on symbols, expand the sym? function to also
check whether the name of the symbol matches a given string if one is
provided.
---
 reference.md            | 10 +++++++++-
 src/fennel/compiler.fnl |  7 +++----
 src/fennel/macros.fnl   |  4 ++--
 src/fennel/specials.fnl |  2 +-
 src/fennel/utils.fnl    |  8 +++++---
 5 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/reference.md b/reference.md
index ac96573..450b109 100644
--- a/reference.md
[message trimmed]

Re: Prefix notation for match guards 15 days ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Orst <andreyorst@gmail.com> writes:

> After recent discussion on IRC about ne match syntax proposals, I've
> experimented with infix notation, and here's my results so far:
>
>    (match2 [10 20 30]
>      [a 2 3]
>      "matches [non-nil 2 3]"
>      (where [a 2 3] (> a 20))
>      "matches [num>20 2 3]"
>      (where (or [_ 2 c] [1 _ c]) (> c 30))
>      "matches [anything 2 num>30] or [1 anything num>30]"
>      "executed when everything before failed")

[ANN] Fennel 0.8.1 released 25 days ago

From Phil Hagelberg to ~technomancy/fennel

Hello people.

I've just released Fennel 0.8.1. It mostly contains small bug fixes:

* Improve compiler sandboxing to copy standard tables and protect metatables
* Fix an issue where loading nested copies of Fennel would fail
* Fix a bug where sparse tables were displayed incorrectly in fennel view
* Ensure the compiler runs under strict mode
* Fix a bug where certain numbers would be emitted incorrectly

You can download the latest version here:

    https://fennel-lang.org/downloads/fennel-0.8.1
    https://fennel-lang.org/downloads/fennel-0.8.1.asc