~andreyorst

Moscow

https://andreyorst.gitlab.io/

I love Lisp and text editors!

Recent activity

[PATCH fennel v3] allow require-as-include to work with non-literal include paths 23 hours ago

From Andrey Listopadov to ~technomancy/fennel

This change allows library writers to create libraries with nested
modules, which can be required relatively to the root of the library,
making it possible to then build a self contained application, with
all library modules included into the source, regardless of how
library directory is named or the path to the library.
---
 changelog.md             |   2 +
 reference.md             |  20 ++++--
 src/fennel/specials.fnl  |  49 ++++++++-----
 test/misc.fnl            |  25 ++++++-
 test/mod/foo3.fnl        |   5 ++
 test/mod/foo4.fnl        |   5 ++
 test/mod/foo5.fnl        |   5 ++
 test/mod/foo6.fnl        |   5 ++
[message trimmed]

[PATCH v2] allow require-as-include to work with non-literal include paths a day ago

From Andrey Listopadov to ~technomancy/fennel

This change allows library writers to create libraries with nested
modules, which can be required relatively to the root of the library,
making it possible to then build a self contained application, with
all library modules included into the source, regardless of how
library directory is named.
---
 src/fennel/specials.fnl  | 33 ++++++++++++++++++++++-----------
 test/misc.fnl            | 25 +++++++++++++++++++++++--
 test/mod/foo3.fnl        |  5 +++++
 test/mod/foo4.fnl        |  5 +++++
 test/mod/foo5.fnl        |  5 +++++
 test/mod/foo6.fnl        |  5 +++++
 test/mod/nested/mod1.fnl |  1 +
 test/mod/nested/mod2.fnl |  4 ++++
[message trimmed]

[PATCH] allow require-as-include to work with non-literal include paths 2 days ago

From Andrey Listopadov to ~technomancy/fennel

This change allows library writers to create libraries with nested
modules, which can be required relatively to the root of the library,
making it possible to then build a self contained application, with
all library modules included into the source, regardless of how
library directory is named.
---
 src/fennel/specials.fnl  | 35 ++++++++++++++++++++++++-----------
 test/misc.fnl            | 25 +++++++++++++++++++++++--
 test/mod/foo3.fnl        |  5 +++++
 test/mod/foo4.fnl        |  5 +++++
 test/mod/foo5.fnl        |  5 +++++
 test/mod/foo6.fnl        |  5 +++++
 test/mod/nested/mod1.fnl |  1 +
 test/mod/nested/mod2.fnl |  4 ++++
[message trimmed]

[PATCH] use fennelview in comment special to keep tables in comments 2 days ago

From Andrey Listopadov to ~technomancy/fennel

---
 src/fennel/specials.fnl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fennel/specials.fnl b/src/fennel/specials.fnl
index 8d74bd9..171b302 100644
--- a/src/fennel/specials.fnl
+++ b/src/fennel/specials.fnl
@@ -720,7 +720,7 @@ Method name doesn't have to be known at compile-time; if it is, use
(fn SPECIALS.comment [ast _ parent]
  (let [els []]
    (for [i 2 (length ast)]
      (table.insert els (pick-values 1 (: (tostring (. ast i)) :gsub "\n" " "))))
      (table.insert els (pick-values 1 (view (. ast i) {:one-line? true}))))
[message trimmed]

[PATCH v2] add ,apropos ,apropos-doc and ,apropos-show-docs repl commands 12 days ago

From Andrey Listopadov to ~technomancy/fennel

This patch adds three new commands: ,apropos ,apropos-doc and
,apropos-show-docs.  All commands accept a Lua pattern as an input.

,apropos will print all function names matching this pattern,
e.g. ,apropos table%. will list all functions from the table module

,aprops-doc works similarly, but instead of searching for the pattern
in function name, it searches the pattern in all documentations
available. E.g. ,apropos-doc "arity check" will list lambda and λ

,apropos-show-docs works similarly to ,apropos but displays all docs
matching a pattern in the function name.
---
 changelog.md        |  1 +
[message trimmed]

Re: [PATCH] add ,apropos and ,apropos-doc repl commands 12 days ago

From Andrey Listopadov to ~technomancy/fennel

> Oh, I think maybe I miscommunicated this--my intent was that apropos-doc
> would search the docstrings and print the names of the matches, not that
> it would run doc on the results from apropos. Sorry for the confusion
> with that.

Ohh, haha

I've once asked on IRC something like "should it spit all docs that
mathc the pattern" and you was like "yeah", so I've assumed this is
what you want :D

Yeah, no problem I'll add docstring search - with the given foundation
it's not that hard to do, just might take some time

[PATCH] add ,apropos and ,apropos-doc repl commands 13 days ago

From Andrey Listopadov to ~technomancy/fennel

This patch adds two new commands: ,apropos and ,apropos-doc
Both commands accept a Lua pattern as an input.

,apropos table%. will print all function names matching this pattern,
e.g. all functions from the table module

,aprops-doc works similarly, but instead of printing all names, prints
all docs for functions that match the pattern.
---
 changelog.md        |  1 +
 src/fennel/repl.fnl | 56 +++++++++++++++++++++++++++++++++++++++++++++
 test/repl.fnl       | 21 ++++++++++++++++-
 3 files changed, 77 insertions(+), 1 deletion(-)
[message trimmed]

Re: linked lists 21 days ago

From Andrey Listopadov to ~technomancy/fennel

> What would an idiomatic Fennel way of doing what I am used to
> doing with lists? This is a more philosophical question. I look
> at Fennel as a Lispy layer over Lua where lists are replaced
> by tables. Is that "the Fennel way"?

Yes, tables and iterators are idiomatic in Fennel. But nothing stops
you from using lists if you want their characteristics, since lists
are useful in some situations. The Penlight [1] library has the List
class, but it is more like a Python list, rather Scheme list, but this
shows that you can extend the language with data types you need for a
particular case, so while idiomatic way is iterators, sometimes
non-idiomatic ways are required for efficiency :)

> > (fn cons [head tail]

Re: linked lists 22 days ago

From Andrey Listopadov to ~technomancy/fennel

> What is the corresponding idiom in Fennel?

As for more idiomatic approach - Lua uses iterators for everything
related to tables.
There are `pairs` and `ipairs` functions which, when given a table
return iterators, that can be used in `each` special or `collect` and
`icollect` macros.

(each [key value (pairs {:a 1 :b 2})]
  (print key value))

This will walk the asoociative table `{:a 1 :b 2}` in an arbitrary
order, and print each key and its corresponding value.  The order is
arbitrary, because of how keys are hashed.

Re: linked lists 22 days ago

From Andrey Listopadov to ~technomancy/fennel

> Have you considered linked lists? If yes, what did you conclude?
>
>     list = {next = list, value = v}
>
> As a schemer, building things with cons and walking through lists with
> car and cdr is comfortable and familiar. What is the corresponding
> idiom in Fennel?

Fennel runs on Lua runtime, so we usually use Lua tables for all our
data structures.
And we also build custom data tructures based on Lua tables when we need!

You can have `first` and `rest` working on sequential tables like this: