Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 20 04:42

    gilch on plainly-tutorial

    (compare)

  • Sep 20 04:42

    gilch on master

    clarify escape sequences split off Unicode Normalization… clarify string reading with int… and 10 more (compare)

  • Sep 20 04:42
    gilch closed #108
  • Sep 20 04:31
    gilch opened #108
  • Sep 20 04:28

    gilch on plainly-tutorial

    move unicode normalization sect… (compare)

  • Sep 20 04:23

    gilch on plainly-tutorial

    clarify escape sequences split off Unicode Normalization… clarify string reading with int… and 8 more (compare)

  • Sep 19 00:37

    gilch on master

    add more functional library rec… clarify install instructions word as single and paired for c… and 9 more (compare)

  • Sep 19 00:37
    gilch closed #107
  • Sep 19 00:37
    gilch commented #107
  • Sep 19 00:36
    gilch opened #107
  • Sep 19 00:35

    gilch on fun-faqs

    activate readline for LisspREPL revise and add more to FAQ (compare)

  • Sep 18 03:42

    gilch on fun-faqs

    mention more bytes reader macros split ready from stable move sidebar back in real order… (compare)

  • Sep 18 00:21
    HoangTuan110 starred gilch/hissp
  • Sep 16 23:21

    gilch on fun-faqs

    make more quickstart clarificat… (compare)

  • Sep 15 09:47
    rujialiu starred gilch/hissp
  • Sep 13 22:28
    RIZY101 starred gilch/hissp
  • Sep 12 07:43

    gilch on fun-faqs

    add more functional library rec… clarify install instructions word as single and paired for c… and 2 more (compare)

  • Sep 10 23:28

    gilch on Quotez

    (compare)

  • Sep 10 23:28

    gilch on master

    Replace x-codes with Quotez Reword docs for Quotez Change short name for "HYPHEN-M… and 2 more (compare)

  • Sep 10 23:28
    gilch closed #106
gilch
@gilch
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.
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 ...)
gilch
@gilch
Other objects evaluate to themselves, but strings and tuples have special evaluation rules in Hissp. Tuples represent Hissp code and strings represent Python code (plus module literals).
You might have been trying to do this:
#> (list '(.#"a string" .#"another string"))
>>> list(
...   ('a string', 'another string'))
['a string', 'another string']
Mike Pelletier
@salixbipedis:matrix.org
[m]
Thanks. That is what I need to understand.
I'll look into why I need to use code injection there
gilch
@gilch
In Lissp, the "..." read syntax creates the Python code for a string.
So at the Hissp level, it becomes "('...')".
If you want to inject a string directly to the Hissp level, you use .#.
Mike Pelletier
@salixbipedis:matrix.org
[m]
Whereas .#"..." does not become a bare ellipsis, nor a string?
I get the voodoo now I just don't get how it works, but I can figure that out
gilch
@gilch
It might help to play around with readerless mode in Python.
salixbipedis
@salixbipedis:matrix.org
[m]
lissp renders to a tree of tuples containing tuples and strings so it does make sense that it chokes on the thing I made, I'm having trouble figuring out exactly how .# fixes it. I'll go play with readerless.
gilch
@gilch
#> ...
>>> ...
Ellipsis
#> .#"..."
>>> ...
Ellipsis
#> '.#"..."
>>> '...'
'...'
Mike Pelletier
@salixbipedis:matrix.org
[m]
aaahhh okay
so from another perspective I'm basically removing one level of quoting which is exactly what I want
----------------------------------------------------------------------
Ran 1 test in 0.002s

OK
Thanks! :-D
gilch
@gilch
#> '(list '("a string" "another string"))
>>> ('list', ('quote', ("('a string')", "('another string')")))
('list', ('quote', ("('a string')", "('another string')")))
#> '(list '(.#"a string" .#"another string"))
>>> ('list', ('quote', ('a string', 'another string')))
('list', ('quote', ('a string', 'another string')))
#> '"..."
>>> "('...')"
"('...')"
#> '.#"..."
>>> '...'
'...'
#> ''.#"..."
>>> ('quote', '...')
('quote', '...')