Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: uri library #306

Open
matteoredaelli opened this issue Aug 25, 2023 · 5 comments
Open

feature request: uri library #306

matteoredaelli opened this issue Aug 25, 2023 · 5 comments

Comments

@matteoredaelli
Copy link

Hello

Most of the modern programming languages have a uri/url library for managing urls

Also swi prolog has it: an old one written in prolog and a new one written in c

https://www.swi-prolog.org/pldoc/man?section=url
https://www.swi-prolog.org/pldoc/man?section=uri

Could you add it to Tralla prolog, please?

Thanks in advance
Matteo

@matteoredaelli matteoredaelli changed the title feauture request: uri library feature request: uri library Aug 25, 2023
@infradig
Copy link
Contributor

infradig commented Aug 26, 2023 via email

@infradig
Copy link
Contributor

infradig commented Aug 26, 2023 via email

infradig added a commit that referenced this issue Aug 26, 2023
@infradig
Copy link
Contributor

Added...

$ tpl
?- parse_url('http://www.xyz.org:81/hello?msg=Hello+World%21&foo=bar#xyz',P).
   P = [search([msg='Hello World!',foo=bar]),protocol(http),host('www.xyz.org'),port(81),path('/hello'),fragment(xyz)].

?- parse_url(U,[search([msg='Hello World!',foo=bar]),protocol(http),host('www.xyz.org'),port(81),path('/hello'),fragment(xyz)]).
   U = 'http://www.xyz.org:81/hello?msg=Hello+World%21&foo=bar#xyz'.
?-

I'll see about the rest.

infradig added a commit that referenced this issue Aug 26, 2023
@triska
Copy link

triska commented Aug 27, 2023

Wouldn't strings be a lot more appropriate for such ephemeral data, like "Hello World!"? There is little chance that other parts of the program need this string (in the sense that it is unlikely to occur anywhere else), and strings can be reclaimed a lot more efficiently on backtracking.

@infradig
Copy link
Contributor

infradig commented Aug 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants