gocurcon: Google Currency Converter Scrapper

Featuring the Dragonfly web framework

gocurcon: Google Currency Converter Scrapper

Postby conan » Thu Jun 13, 2013 11:17 pm

Hi all,

I wanted to share a tiny script which allows me to query google/finance/converter from the CLI.

It's not much of a scrapper really, but I couldn't come up with a better word to describe it. It does scrap! Really! :P

Check it here:
https://github.com/conan-lugmen/newlisp-webscraps

I have two questions regarding my code:

1. Why unify requires uppercase tokens to be able to create symbols with bind? Or maybe my question is this one: Am I correctly using bind/unify? Is that the intended use?

2. I put a check to consider a get-url not giving back a proper answer. However on some runs I've noticed I get nil results like if my check was passed by. What am I doing wrong there?
conan
 
Posts: 52
Joined: Sat Oct 22, 2011 12:14 pm

Re: gocurcon: Google Currency Converter Scrapper

Postby Lutz » Fri Jun 14, 2013 6:18 pm

Using uppercase letters for variables in unification, is a convention introduced from logic programming with the Prolog language.

See also here: http://en.wikipedia.org/wiki/Unification_(computer_science)#Examples_of_syntactic_unification_of_first-order_terms

You are using bind with unify correctly, although instead of:

Code: Select all
(bind (unify '(From To Ammount) myArgs))

you could also use:
Code: Select all
(map set '(From To Ammount) myArgs))

and in the last case your variables don't need to be in uppercase.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: gocurcon: Google Currency Converter Scrapper

Postby hilti » Fri Jun 21, 2013 11:45 am

Thanks for this useful and small scraper.

Best wishes
Marc
--()o Dragonfly web framework for newLISP
http://dragonfly.apptruck.de
hilti
 
Posts: 139
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany


Return to So, what can you actually DO with newLISP?

Who is online

Users browsing this forum: No registered users and 2 guests