brandonwillard / adderall Goto Github PK
View Code? Open in Web Editor NEWHy on Adderall - a miniKanren implementation in Hy
Hy on Adderall - a miniKanren implementation in Hy
Do i need a magic keyboard to use this?
The name adderall
was a good idea way back when, but the name does have a bit of a stigma, and sends bad vibes. For this reason, @brandonwillard and I came to the conclusion that renaming the library to loghyc
would be in order.
We'll keep a compatibility layer of sorts for a short while, so old imports will still work, but eventually, those will be removed, and the old name will fade away into the deep pits of git history.
After a fresh install of adderall I get the following error at the REPL after importing everything from adderall.dsl
as per the example in the README
=> (import [adderall.dsl [*]])
Traceback (most recent call last):
File "stdin-13d9f4ed2fba76e7292f4eef6fccb574c1d68064", line 1, in <module>
(import [adderall.dsl [*]])
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.7/site-packages/adderall/internal.hy", line 26, in defmacro_alias
(.append ret
hy.errors.HyMacroExpansionError:
File "/usr/local/lib/python3.7/site-packages/adderall/dsl.hy", line 96
(defmacro-alias [run1 run¹] [vars &rest args]
"Return a single result from `run` (i.e. `n` set to `1`).
See `run`."
`(first (run 1 ~vars ~@args)))
^
expanding macro defmacro-alias
AttributeError: 'HyExpression' object has no attribute 'append'
I'm running hy 0.17.0+140.ge6d6a02 and Python 3.7.6 on macOS Mojave 10.14.4.
It would be nice to have a cheatsheet that lists all goals and brief description of them. Currently I'm reading the source / Reasoned Schemer when trying to figure out how to do things.
In miniKanren, you can write:
(conde
[(emptyo q) #s]
(else (somethingo q)))
It would be nice if that syntax would be supported by Adderall too. One way to do that is to define an else function within the context of the macro, that returns [#s (somethingo q)], but that may have unwanted implications, like leaking through to goals.
Another option is to replace the else from within the macro at compile time, but that's a bit harder. Lets evaluate that, and if it is feasible, implement it.
We should add the constraint programming functionality from "A Framework for Extending microKanren with Constraints".
There is a problem with conde
: it is eager, and its arguments get evaluated before the function itself is called, which leads to infinite recursion when we're working with other functions that call themselvs inside a conde
, such as listo
.
The proper fix here is turning conde
into a macro.
We only use interleave
from toolz. We should simply use our own implementation of the function, to reduce our dependencies (and toolz is not packaged for Debian, which was the trigger for this issue...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.