Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 24 20:14

    gilch on quicker-quickstart

    (compare)

  • Oct 24 20:14

    gilch on master

    Reorder quickstart for easier … Refactor _parse for length Remove duplicated examples and 11 more (compare)

  • Oct 24 20:14
    gilch closed #133
  • Oct 24 20:11
    codecov[bot] commented #133
  • Oct 24 20:10
    codecov[bot] commented #133
  • Oct 24 20:09
    gilch synchronize #133
  • Oct 24 20:09

    gilch on quicker-quickstart

    Remove redundant test glob (compare)

  • Oct 24 07:12
    codecov[bot] commented #133
  • Oct 24 07:12
    gilch synchronize #133
  • Oct 24 07:12

    gilch on quicker-quickstart

    Rewrite Compiling and Running F… (compare)

  • Oct 24 05:58
    gilch commented #133
  • Oct 24 02:33
    codecov[bot] commented #133
  • Oct 24 02:32
    codecov[bot] commented #133
  • Oct 24 02:32
    gilch synchronize #133
  • Oct 24 02:32

    gilch on quicker-quickstart

    Remove redundant splice/wrap (compare)

  • Oct 24 02:10
    codecov[bot] commented #133
  • Oct 24 02:09
    codecov[bot] commented #133
  • Oct 24 02:09
    gilch synchronize #133
  • Oct 24 02:09

    gilch on quicker-quickstart

    Join line for style (compare)

  • Oct 24 02:07
    codecov[bot] commented #133
salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
pytest would probably work on the compiled python, and unittest almost certainly would
salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
Mike Pelletier: also you can do (define % mod) to paper over the ickiness. but this is why i (personally) like f-strings anyway, or .format if you want to save a "template" to reuse later.
that said, i dont think hissp has f-strings?
salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
hm, im reading the docs and i feel like i still have no idea how args and *kwargs work
ah, the : comes before :* args
salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
(define fmt (lambda (template : :* args :** kwargs) (.format template : :* args :** kwargs))) is this the right unpacking/packing syntax?
gilch
@gilch
@salixbipedis:matrix.org I've been using the standard library for unit tests, and it's working fine. You can see the tests in the git repository. Some of them are written in Lissp: https://github.com/gilch/hissp/blob/master/tests/test_basic.lissp
1 reply
Pytest does some AST metaprogramming to rewrite assert statements. Hissp doesn't have those (since it has no statements to speak of), so that part wouldn't work, but I expect the rest of it would.
Hissp doesn't have operators, so there's no need to overload them. The %s string formatting was borderline deprecated anyway, so I usually use (.format ...)in Lissp, like I would in Python.
gilch
@gilch
There's nothing stopping you from giving multiple aliases to operators either, so you can continue to use mod on numbers, but you can also (define format mod) (or whatever) and then use (format ...) on strings.
But at that point, why not just use (.format ...)?
While the f-strings technically don't exist in Hissp, they do in Python. You can inject f-strings with .#"..." like any other Python expression. E.g. .#"f'foo{bar}'".
I don't particularly want to encourage the overuse of injections, but the option is there.
gilch
@gilch
If I needed something like an f-string in Clojure, I'd probably just use (str ...) most of the time.
user=> (def person "Bob")
#'user/person
user=> (str "Hello, " person "! It's nice to meet you!")
"Hello, Bob! It's nice to meet you!"
gilch
@gilch
I had a similar analog in the entuple group (some of which you can see in the quickstart).
I think it was something like
def enstr(*args):
    return "".join(map(str, args))
You should be able to use that in about the same way as Clojure's str.
Another problem with injecting f-strings, besides the usual problem of macros becoming unable to read the subexpressions, is that the subexpressions for f-strings have to be written in Python, so you can't use your macros.
gilch
@gilch
In the same way that Lissp creates a bytestring with the b# reader macro, you could theoretically create an f# reader macro in the same way, but this way the subexpressions could be written in Lissp. You'd use a regex to extract them, and then rewrite it to a normal (.format ...) call.
gilch
@gilch
@elementio:salt-rock-lamp.ems.host that's the right syntax, although that particular example could be simplified to (define fmt str.format), assuming you're always using a str type for the template argument. Unbound methods are first-class in Python.
salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
first-class, but not equivalent :) it breaks if you try to use partial (and probably some other stuff that I can't think of them right now)
gilch
@gilch
>>> fmt = str.format
>>> from functools import partial
>>> partial(fmt, "Welcome, {}!")
functools.partial(<method 'format' of 'str' objects>, 'Welcome, {}!')
>>> _('Bob')
'Welcome, Bob!'
partial(), at least, worked that time. But there is one case I can think of where they're not equivalent.
Mike Pelletier
@salixbipedis:matrix.org
[m]
exactly what I wanted
Mike Pelletier
@salixbipedis:matrix.org
[m]
Incidentally, I found Hissp after getting sucked into a Reddit post about Pixie and then finding Pixie was languishing unmaintained. The first thing I tried typing into the REPL was (import sys) so thanks for that.
gilch
@gilch
I was wondering when someone would find the Easter egg.
It's like Python's import this.
Mike Pelletier
@salixbipedis:matrix.org
[m]
Oh wow, that takes me back
I've been offline for ten years, is Tim Peters still a thing?
gilch
@gilch
Did the Reddit post actually mention Hissp, or did you go looking for other Lisps on your own?
@mgrasko had mentioned earlier that "there is really no exposure" (for Hissp) so I'm always interested in how people are finding it.
Mike Pelletier
@salixbipedis:matrix.org
[m]
Well, I was aware of Hy but my ideas about it were quite dated. I was surprised to see how it had developed. The Hy docs reference Hissp, so I decided I would try to get my head around the differences by implementing a simple app in each.
Mike Pelletier
@salixbipedis:matrix.org
[m]
...I went digging for something to satisfy my raging clue for a proper Python Lisp experience. Sucks that Pixie's JIT tech is bit rotting away!
I read that
gilch
@gilch
Although even that might be getting dated, since Hy has been changing again lately.
Mike Pelletier
@salixbipedis:matrix.org
[m]
But Hy itself has moved on so far from where I knew it that the comparisons are not super useful, I'm starting out from zero
Ha ha
I was surprised to see they have 1.0 alpha! Congrats, Hy!
I haven't started digging into that half yet
Mike Pelletier
@salixbipedis:matrix.org
[m]
Oops, formatting sorry

I don't understand this output:

#> (list '("a string" "another string"))
>>> list(
...   ("('a string')", "('another string')"))
["('a string')", "('another string')"]

I'm expecting a result like this one:

#> (let (l (list)) (.append l "a string") (.append l "another string") l)
>>> # let
... (lambda l=list():(
...   l.append(
...     ('a string')),
...   l.append(
...     ('another string')),
...   l)[-1])()
['a string', 'another string']
#>

Is it me or Hissp that is crazy?

salt rock lamp
@elementio:salt-rock-lamp.ems.host
[m]
i dont understand hissp single-quote either
i would have expected the same
alternatively one might expect ['"a string"', '"another string"']
Mike Pelletier
@salixbipedis:matrix.org
[m]
I'll go read the quoting docs again
Mike Pelletier
@salixbipedis:matrix.org
[m]
Naively what I thought was happening was that "a string" was rendering to ('a string') which then got quoted a second time by the quote special form, transforming it into "('a string')" which doesn't seem intentional?
Hmm, I guess I see this behaviour in lissp_quickstart.rst so I suppose it's intentional. I think I'm meant to use the [] reader macro or (enlist ...)