Similar to the import keyword in Python or require in node.js, the ACCORDING keyword provides a way of building atop other people’s code.
The ACCORDING TO syntax is how you trip on someone else’s LSD trip.
ACCORDING TO <handle>/<name>
Where the handle is the handle of the profile who defined the module with a particular name. The way this’d look for importing the module named apples written by yev would be:
ACCORDING TO yev/apples
-- Remaining code...
When you’d like to import a module that’s not hosted on LSD but defined in a .sql
file in the top-level of a GitHub repository, you can provide the URL to it instead of the <handle>/<name>
format.
ACCORDING TO https://github.com/lsd-so/hacker_news_example
Note: This is not currently available on the hosted instance of LSD.
This is the source code for yev/hacker_news:
PORTAL <| OPEN |
hn <| https://news.ycombinator.com/ |
container <| span.titleline |
post <| a |
post_link <| post@href |
front_page_of_hn <|> <|
FROM hn
|> GROUP BY container
|> SELECT post, post_link |
To use the code defined above, simply state you’re using LSD ACCORDING TO it:
ACCORDING TO yev/hacker_news
front_page_of_hn