Last active a month ago

#152 Reduce unnecessary gensym locals 24 days ago

Comment by ~xerool on ~technomancy/fennel

I've made a patch for case/match which gets rid of a lot of these bindings. That brings us down to 286 total unnecessary bindings.


The next 277 of them are caused by destructure. Then, 8 of them are from -?> (mostly because -?> is used in fennelview) The last one is because someone wrote (match true ...). I don't mind if we leave the gensym around for that one.

#133 Non-unifying pattern matching (matchless) a month ago

Comment by ~xerool on ~technomancy/fennel

Quick summary: It is called case in the implementation, not matchless. Also, you can pin! Instead of ^, the syntax for a "pin" pattern is (where (= var))

#1 Publish on Luarocks 2 months ago

Comment by ~xerool on ~xerool/fennel-ls

That is a good idea! I will look into it.

#144 Macro wont output/expand expressions in seq without preceeding expression 3 months ago

Comment by ~xerool on ~technomancy/fennel

This is surely bug when the table produces side effects.

(fn foo []
  [(print :hello)]

(foo) ;; no print

#142 antifennel: bad code generation 3 months ago

Ticket created by ~xerool on ~technomancy/fennel

In antifennel

    local x = 4

compiles to:

(let [x 4])

which is unable to compile back into lua. I think when antifennel wants generate an empty let block, it instead put nil into the body so that the output can compile.

#133 Non-unifying pattern matching (matchless) 4 months ago

on ~technomancy/fennel

Sorry for the lack of communication on this one! Unfortunately I think we may have some conflict here since ~xerool has been working on this in his branch here: https://git.sr.ht/~xerool/fennel/commit/32d8f6f21ca0479fe57886a6bdbba7120b96bc83

#132 More general match patterns 6 months ago

Ticket created by ~xerool on ~technomancy/fennel

I propose that there be less restrictions on (where) and (or) guards in patterns.

Right now, the match macro's patterns support the following at the top level of the pattern only:

  • (where pat guard1 guard2 ...)
  • (where (or pat1 pat2 ...) guard1 guard2 ...)
  • (pat ? guard1 guard2 ...) (legacy)

I propose this could be more general. What I would like to see different:

  • (where) and (where (or)) can appear anywhere in a pattern
  • new (or pat1 pat2) form without the where, that can be placed anywhere except for inside a (where).

The new form's restriction is there to prevent the problem of combinatorial explosion, where a failing guard would need to backtrack instead of continuing on to the next pattern.

Here are some examples to help explain:

(match ["a" 5]
  ;; new (or) rule
  [(or "a" "b" "c") (or 1 2 3)]
  ;; (where) inside a pattern
  [(where x (= (type x) :string))
   (where y (= (type y) :number))]
  ;; mix and match
  [(where x (= (string.lower x) x))
   (or 1 3 (where n (= (% n 2) 0)))]

(match [[3 5] [1 5] [3 4]]
  ;; Not allowed, matching this pattern requires complex backtracking
  (where [(or [x _] [_ x]) (or [y _] [_ y]) (or [z _] [_ z])]
         (= (+ x y z) 10))

The legacy ? forms would remain the same.

#54 Don't nag the user after restart if they dismissed the IRCv3 banner 6 months ago

Comment by ~xerool on ~emersion/goguma

#100 Copy text from messages 6 months ago

Ticket created by ~xerool on ~emersion/goguma

Currently, it isn't possible to select a message and copy it to the clipboard on Android. I would enjoy if messages were selectable so that copying is possible.

#126 fennel.parser should take in a plugin list 7 months ago

Ticket created by ~xerool on ~technomancy/fennel

Fennel, when used as a library, provides a number of functions in order to call various parts of the compiler. Most of these functions accept, inside an options table, an optional list of plugins that can affect the way the compiler works. Although plugins have the :parse-error hook that affects the way parsing works, the function fennel.parser does not accept a list of plugins. This means the only way to pass an argument to affect the parser is via a function like fennel.compileString which parses and compiles in the same call (I haven't actually verified if this option works), or by calling the compiler via command line and passing a plugin filename as an argument.

Ideally, fennel.parser would be able to simply use the :plugins key from its options table.