#Semantic Search engine – NLP lab
###17/05/2016 Task
Use the above blog to scrap the following information and show in terminal (ubuntu) or in a file in windows.
//passing functions as params and executing them when required | |
def if2[A](cond: Boolean, onTrue: () => A, onFalse: () => A): A ={ | |
if (cond) onTrue() else onFalse() | |
} | |
//=> using arrow syntax pass params as unevaluated but they will be | |
//evaluated once they are referenced no need to mention () to execute them | |
def if2[A](cond: Boolean, onTrue: => A, onFalse: => A): A ={ | |
if (cond) onTrue else onFalse | |
} |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
import elasticsearch as es | |
db = es.Elasticsearch(['y-monitoring-vm2.dnspam'], port= 9200) | |
db.delete_by_query(index= 'lake_garda_hadoop-test', doc_type='stock_accuracy', body={}) |
;Clojure is compiled language but has a eval function like lisp which allows to run compiler within execution | |
;Visit https://learnxinyminutes.com/docs/clojure/ for more gists | |
5 ; ⇒ 5 | |
"hi" ; ⇒ "hi" | |
[1 2 3] ; evaluates to the vector `[1 2 3]` | |
(+ 1 2) ; evaluates to the sum of 1 and 2 | |
(if true "yes" "no") ; evaluates to the string "yes" | |
(println "hello!") ; evaluates to nil (but also prints "hello!") |
def value(k, degree, coefficients): | |
ans = 0 | |
prev = 1 | |
for i in xrange(degree+1): | |
if i != 0: | |
prev = prev * k | |
ans += coefficients[i] * prev | |
return ans | |
degree = input() | |
coefficients = map(int,raw_input().split()) |
#Semantic Search engine – NLP lab
###17/05/2016 Task
Use the above blog to scrap the following information and show in terminal (ubuntu) or in a file in windows.