scheme

How do I get the functions put and get in SICP, Scheme, Exercise 2.78 and on

萝らか妹 提交于 2019-12-02 23:24:12
I am trying to do exercise 2.78 in SICP, but the functions put and get are unknown. I have tried multiple languages, like pretty big, racket, r5rs, mit-scheme, mzscheme, etc. I even downloaded the SICP support (http://www.neilvandyke.org/sicp-plt/), to no avail. How can I get these functions to work? Yes, I found SICP a little annoying sometimes because of stuff like this. Functions that are assumed to exist but don't actually exist make it harder to try to the examples. I wrote my own (get) and (put) like so (this was in GNU guile): (define global-array '()) (define (make-entry k v) (list k v

How to find “not a procedure” error

最后都变了- 提交于 2019-12-02 23:23:03
问题 (define (comp f g) (lambda (x)(f (g x)))) (define (complement f) (cond ((equal? (comp f (lambda (g) g)) #t) #f) ((equal? (comp f (lambda (g) g)) #f) #t))) ((complement odd?)2) It keeps saying that ((complement odd?)2) is not a procedure. I'm not sure how to fix it. 回答1: When you run this code you'll see that ((complement odd?) 2) is red in the definitions and you get the following error: application: not a procedure; expected a procedure that can be applied to arguments given: #<void> So that

CentOS7上部署taiga项目管理软件

匿名 (未验证) 提交于 2019-12-02 23:03:14
作者 一、简介 Taiga 是一个免费开源,而且功能非常强大的项目管理平台,用于初创企业和敏捷开发团队。提供一个简单、漂亮的项目管理工具。Taiga 采用 Python Django 框架开发,前端基于 AngularJS 实现。 二、更新必要的组件及系统版本 安装必要的组件并更新系统 yum install -y gcc autoconf flex bison libjpeg-turbo-devel yum install -y freetype-devel zlib-devel zeromq-devel gdbm-devel ncurses-devel yum install -y automake libtool libffi-devel curl git tmux yum install -y libxml2-devel libxslt-devel yum install -y wget openssl-devel gcc-c++ 安装PostgreSQL 9.5 wget http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm rpm -ivh pgdg-centos95-9.5-2.noarch.rpm yum install -y postgresql95

How can I increment a value in scheme with closure?

被刻印的时光 ゝ 提交于 2019-12-02 22:57:09
问题 How can I increment a value in scheme with closure? I'm on lecture 3A in the sicp course. (define (sum VAL) // how do I increment VAL everytime i call it? (lambda(x) (* x x VAL))) (define a (sum 5)) (a 3) 回答1: Use set! for storing the incremented value. Try this: (define (sum VAL) (lambda (x) (set! VAL (add1 VAL)) (* x x VAL))) Because VAL was enclosed at the time the sum procedure was called, each time you call a it'll "remember" the previous value in VAL and it'll get incremented by one

Python-urllib库parse模块解析链接常用方法

匿名 (未验证) 提交于 2019-12-02 22:54:36
版权声明:本文为博主学习记录,转载请注明出处(https://blog.csdn.net/huishanyu/article/details/80702807) urlparse() # urllib.parse.urlparse(urlstring,scheme='',allow_fragments=True) # urlstring : 这个是必填项,即待解析的URL result = urlparse('http://www.baidu.com/index.html;user?id=5#comment') print(type(result),result) # scheme : 它是默认的协议,只有在URL中不包含scheme信息时生效 result = urlparse('www.baidu.com/index.html;user?id=5#comment',scheme='https') print(result) # allow_fragments : 即是否忽略fragment 设置成False就会忽略,它会被解析为path,parameters或者query的一部分,而fragment部分为空 result = urlparse('http://www.baidu.com/index.html;user?id=5#comment',allow_fragments

Python爬虫实列:新浪微博热门话题

匿名 (未验证) 提交于 2019-12-02 22:54:36
1.先找到数据所在的url 2.写代码获取数据,并保存 import requests import time import sys import os import xlwt, xlrd import xlutils.copy #传入要爬取的页数page,将获取的热门话题名称、类别、讨论数、阅读数存到二维列表中 def get_hot_topic(page): topic_list = [] session = requests.session() for i in range(page): print("\n*****正在获取第{}页*****".format(i + 1)) if i == 0: the_url = "https://m.weibo.cn/api/container/getIndex?containerid=100803" if i == 1: the_url = "https://m.weibo.cn/api/container/getIndex?containerid=100803&since_id=%7B%22page%22:2,%22next_since_id%22:6,%22recommend_since_id%22:[%22%22,%221.8060920078958E15%22,%221.8060920009434E15%22,0]%7D"

[OC] APP唤醒,URL Scheme,工程中的 URL Types 和 LSApplicationQueriesSchemes

风流意气都作罢 提交于 2019-12-02 22:17:52
1.网页唤醒APP: 假设我们有一个APP,名字叫做 “APP甲”,需要通过网页唤起 APP甲,我们首先需要在 APP甲的工程文件里配置参数 URL Types : 在 info.plist 里的 URL types 增加 APP甲 的URL scheme, 或者在工程的info里的 URL type 添加也是一样的: 至此,我们的 APP甲,已经设置了可以唤醒它的一个URL Scheme : jiaAPPURLScheme 然后网页可以通过把自己的跳转链接改为 URL scheme:// ,比如这个栗子🌰中,我们可以直接用safari 访问: jiaAPPURLScheme :// ,就可以唤醒我们的 APP甲。 2.APP唤醒APP: 现在我们有了两个APP,一个 APP甲,一个 APP乙。 现在我们的需求是 APP甲 要唤醒 APP乙。按照1中,我们给 APP甲 配置了 URL scheme : jiaAPPURLScheme 其实在乙中,我们直接使用以下代码,APP乙就可以唤醒APP甲了: NSURL* url = [NSURL URLWithString:@"jiaAPPURLScheme://"];//创建URL [[UIApplication sharedApplication] openURL:url]; 但是在iOS9开始,iOS新增了一个

What are the advantages of scheme macros?

核能气质少年 提交于 2019-12-02 22:11:53
Why would anyone prefer Scheme macros over Common Lisp macros (and I genuinely want to know too, I'm not trying to be a troll)? My experience as a Lisp newb is that Common Lisp style macros are much easier to learn than Scheme's macros. I have yet to see any advantages to Scheme's macros, but of course that doesn't mean they don't exist. I do know that Scheme macros are "hygenic", but I'm still not convinced this is worth the additional complexity. On the other hand though, there obviously are people that are convinced that this is necessary, otherwise there wouldn't be implementations of

Fixing Lisp Syntax

穿精又带淫゛_ 提交于 2019-12-02 20:48:41
Being a newbie to Lisp I'm wondering if the Lisp syntax could be "fixed"? Some people say the syntax in Lisp is one of its biggest strengths. I don't quite understand this. Isn't it possible to replace "obvious" parentheses with a combination of white spaces, new lines and indenting? Just like in Python? It looks to me like parentheses are the most used characters in Lisp code. I'm wondering if that's true - but if it is, isn't this a suggestion, that there is some redundancy in the syntax? Is there some simple answer to the question - why so many parentheses? For example: (defun factorial (x)

Is there a Haskell/ML-like compiler to C?

无人久伴 提交于 2019-12-02 20:37:48
People have written games for the iPhone in Scheme. Because (some) Scheme-compilers compile down to C, it was easy to mix with Objective-C and integrate with XCode. I am aware of patches for Haskell and OCaml compilers to enable ARM/iOS-backends. But those appear unofficial and experimental/unstable. I prefer a static haskell/ML-type type-system over Scheme's dynamic typing. Is there a stable ML/SML/Haskell compiler which generates C-code so that it can be used in a similar way as Scheme/Gambit-C? I can't help with ML, but have you looked at JHC ? JHC is a whole-program optimizing Haskell