0

Currying/view functionality for "use"?

I'm pretty sure this doesn't exist, so it's probably a feature request. The idea is to be able to do something like this:

CODE
# Wikipedia
use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml'
with site = 'en.wikipedia.org'
as 'wmf.en.wikipedia.user';
use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml'
with site = 'de.wikipedia.org'
as 'wmf.de.wikipedia.user';
...

# Wiktionary
use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml'
with site = 'en.wiktionary.org'
as 'wmf.en.wiktionary.user';
use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml'
with site = 'de.wiktionary.org'
as 'wmf.de.wiktionary.user';
...

# Memory Alpha
use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml'
with site = 'memory-alpha.org', api_path = 'en'
as 'memoryalpha.en.user';


A data table definition that could support this (at least the "site" part, not "api_path") is here: http://github.com/md5/yql-tables/blob/mast...imedia.user.xml. It is hard-coded to "en.wikipedia.org", but you can pass "site" in every query to switch it. That's why I want this feature smile.gif

Also, not sure exactly how to get api_path to work since it could have embedded slashes and seems to cooperate poorly with URI templates.

-md

by
2 Replies
  • I moved the definition to here: http://github.com/md5/yql-tables/raw/maste...ikiapi.user.xml

    Also, I think a "with const" could be interesting for cases where you shouldn't be able to change the value from a "where" clause.

    This would also be cool for cases where you reuse a table definition with different curried values a bunch of times:

    CODE
    use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml' as mediawikiapi.user;

    use mediawikiapi.user with site = 'en.wikipedia.org' as wmf.en.wikipedia.user;
    use mediawikiapi.user with site = 'de.wikipedia.org' as wmf.de.wikipedia.user;
    ...
    0
  • QUOTE (Mike Dillon @ May 10 2009, 05:48 PM) <{POST_SNAPBACK}>
    I moved the definition to here: http://github.com/md5/yql-tables/raw/maste...ikiapi.user.xml

    Also, I think a "with const" could be interesting for cases where you shouldn't be able to change the value from a "where" clause.

    This would also be cool for cases where you reuse a table definition with different curried values a bunch of times:

    CODE
    use 'http://www.datatables.org/mediawikiapi/mediawikiapi.user.xml' as mediawikiapi.user;

    use mediawikiapi.user with site = 'en.wikipedia.org' as wmf.en.wikipedia.user;
    use mediawikiapi.user with site = 'de.wikipedia.org' as wmf.de.wikipedia.user;
    ...


    Thanks for the feature request. Its similar to something we've been thinking of adding to envs and I can definitely see its usefulness. We'll take a look...

    Jonathan
    0

Recent Posts

in YQL