Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 01 20:58
    gilch edited #173
  • Sep 26 02:41
    gilch opened #175
  • Sep 26 02:25
    gilch commented #174
  • Sep 26 02:24

    gilch on smarter-readers

    Stricter check in aliases Shou… Don't require \# in fully-quali… Factor out "_macro_" in reader.… and 1 more (compare)

  • Sep 25 20:15
    gilch commented #174
  • Sep 25 03:21
    gilch edited #174
  • Sep 25 03:21
    gilch edited #174
  • Sep 25 03:21
    gilch edited #174
  • Sep 25 03:20
    gilch opened #174
  • Sep 24 20:46
    gilch edited #173
  • Sep 24 20:45
    gilch opened #173
  • Sep 22 04:28
    gilch opened #172
  • Sep 21 03:18

    gilch on eliminate-attrgetter-

    (compare)

  • Sep 21 03:18

    gilch on master

    Eliminate attrgetter- @# overlo… Merge pull request #171 from gi… (compare)

  • Sep 21 03:18
    gilch closed #171
  • Sep 21 03:18
    codecov[bot] commented #171
  • Sep 21 03:16
    codecov[bot] commented #171
  • Sep 21 03:16
    gilch synchronize #171
  • Sep 21 03:16

    gilch on eliminate-attrgetter-

    Eliminate attrgetter- @# overlo… (compare)

  • Sep 21 03:11
    codecov[bot] commented #171
Kyle I S Harrington
@kephale
I'm having issues with:
#> (matplotlib..pyplot.subplots)
>>> __import__('matplotlib').pyplot.subplots()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: module 'matplotlib' has no attribute 'pyplot'
On the python side it seems to need:
__import__('matplotlib.pyplot')
__import__('matplotlib').pyplot.subplots()
gilch
@gilch
@kephale Did you try (matplotlib.pyplot..subplots)?
gilch
@gilch
Or (.subplots matplotlib.pyplot.)?
Packages don't always import all their submodules for you in Python, so they're not always available as attributes if you don't import them directly. But module identifiers work on submodules, and you can qualify identifiers with submodules as well.
Kyle I S Harrington
@kephale
@gilch AH oi I should have realized thats how the macros work
(matplotlib.pyplot..subplots) works perfectly
gilch
@gilch
That last one was a breaking change. Hissp is the same, but Lissp strings are a bit different now. If you've written a significant amount of code, you'll probably run into it. I've updated the docs accordingly.
Kyle I S Harrington
@kephale
Ah cool, works well and no problems for me so far
gilch
@gilch
I've also got the first lesson done in the macro tutorial.
I've got maybe six more macro lessons planned: attach, regex literals, automatic once-only gensyms, destructuring bind, destructuring lambda, and yield, if I can figure out how to implement that with code-walking and lambdas.
The macro tutorial probably still needs some copy editing. It's a bit rough.
Kyle I S Harrington
@kephale
I look forward to going through it at the next chance!
gilch
@gilch
Let me know how it goes.
Kyle I S Harrington
@kephale
I'm taking notes for some minor issues, but I am left wondering about multi-arity functions in hissp
Kyle I S Harrington
@kephale
great tutorial
Kyle I S Harrington
@kephale
any chance for the pypi release soon? it would be great to be able to use hissp as a dependency without installing from git
gilch
@gilch
You mean arity overloads like in Clojure?
I've been pushing commits daily, so I'm wondering when a good stopping point for the PyPI release is.
Enough has changed that I want to do it soon, but I at least want the docs to match the code when that happens.
The sphinx theme I'm using is still having issues rendering some things.
The module index page is broken.
I figured out how to doctest the quickstart, and it's uncovered some issues so far. I should have that done in a day or two.
gilch
@gilch
Assuming no more surprises pop up.
Kyle I S Harrington
@kephale
yeah like the clojure airity overloads, but it was more of a passing thought than a pressing need
Kyle I S Harrington
@kephale
the issue is just that the current pypi version isn't usable for code that works with the latest master
i'm certainly fine working on a couple of machines, but its harder to play around with ideas to scale up (not that I'm quite ready for that yet, but could be in a week or so)
gilch
@gilch
Python doesn't have arity overloads built in, but you could implement a dispatcher with a starargs and a cond on its length.
If it's a pattern you use a lot, it wouldn't be too difficult to implement it in terms of that using a macro.
Kyle I S Harrington
@kephale
one thing that i'm getting hung up on is going from tuples to s-expressions
I wanted something like an apply:
(defmacro apply (f : :* args)
    `(operator..add '(,f) ,@args))
and i've tried some variations on that, but the closest result gives me a tuple
gilch
@gilch
Python 2 had an apply, but it was deprecated in 2.3 after they added star unpacking, and was removed in Python 3.
def apply(callable, args=(), kwargs={}):
    return callable(*args, **kwargs)
That's a function, not a macro.
I'm not exactly sure what you're trying to do with that template. Maybe you could clarify with an example input and output?
Kyle I S Harrington
@kephale
(apply + '(1 2))
that is a pattern I use a lot (not just for math, but that is the easy example)
gilch
@gilch
So you want a macro to transform (apply + '(1 2)) into (+ 1 2)?
Kyle I S Harrington
@kephale
yeah
and evaluate it
i believe that will give coverage of all cases of map-reduce
gilch
@gilch
(defmacro apply (f xs)
  `(,f ,@(cadr xs)))
apply is normally a function as I demonstrated in the Python def above.
Macros get all of their arguments quoted. Because they run at compile time, their arguments haven't been evaluated yet.
So passing '(1 2) means it's quoted twice.
Kyle I S Harrington
@kephale
hmm ok
ah yeah that cadr fix does it
ok i'll do some comparisons with a python implementation as well
gilch
@gilch
So you have (quote '(1 2)) and only want the '(1 2).