沉和咖喱S表达

时间:2018-02-12 17:46:25

标签: currying shen

沉单能或变量的函数是什么? (+ 1 2 3)是否为(+ 1 (+ 2 3))的简写+?我很好奇沉在沉,以及它如何与S表达式一起工作。

修改 在我玩了REPL之后,我相信功能是单一的。我对模式匹配印象深刻,但如果用两个以上的操作数调用它,就无法理解如何编写一个行为为from bs4 import BeautifulSoup import requests import re # Url of the webpage to be scraped getUrl= 'https://ta.wikipedia.org/wiki/அலெக்சா இணையம்' url = getUrl content = requests.get(url).content # Patterns to be checked pattern1 = re.compile(r'not used in prior text') pattern2 = re.compile(r'குறிச்சொல்லுக்கு உரையேதும் வழங்கப்படவில்லை') pattern3 = re.compile(r'defined multiple times with different content') # Respective Error files error_file1 = open("not_used_in_prior_text.txt", "w", encoding="utf-8") error_file2 = open("குறிச்சொல்லுக்கு_உரையேதும்_வழங்கப்படவில்லை.txt", "w", encoding = "utf-8") error_file3 = open("defined_multiple_times_with_different_content.txt", "w", encoding = "utf-8") error_file4 = open("Anomalous_Errors.txt","w", encoding = "utf-8") soup = BeautifulSoup(content,'lxml') heading = soup.title refError = soup.findAll ('span', { 'class' : "error mw-ext-cite-error"}) # Check for error patterns and save it in respective files for error in refError: err_str = str(error) err_str=err_str.replace("<span", heading.text+"~ <span").replace(" - தமிழ் விக்கிப்பீடியா", "") if pattern1.search(err_str): error_file1.write(err_str) elif pattern2.search(err_str): error_file2.write(err_str) elif pattern3.search(err_str): error_file3.write(err_str) else: error_file4.write(err_str) print(err_str) # Close the files error_file1.close() error_file2.close() error_file3.close() error_file4.close() 的函数。

1 个答案:

答案 0 :(得分:1)

函数不是可变参数,但有些宏是。

(0-) (and true true true)
true

(1-) (macroexpand [and true true true])
[and true [and true true]]

(2-) (macroexpand [+ 1 2 3])
[+ 1 [+ 2 3]]

请参阅 defmacro 以创建新的:

http://www.shenlanguage.org/learn-shen/macros.html