lisp

Sending HTTP POST in Racket

被刻印的时光 ゝ 提交于 2019-12-09 18:31:58
问题 I am trying to send a string via http/post in Racket, this is what I tried so far after reading the Racket HTTP Client Documentation #lang racket (require net/http-client) (define myUrl "https://something.com") (http-conn-send! (http-conn-open myUrl #:ssl? #t) #:version "1.1" #:method "POST" #:data "Hello") But with this I receive the following error: tcp-connect: connection failed detail: host not found address: https://www.w3.org/ port number: 443 step: 1 system error: nodename nor servname

使用NewLisp设计Key-Value数据库系统

岁酱吖の 提交于 2019-12-09 16:16:28
Lisp是一个很好的语言,最强大的就是其S-表达式,可以说是Lisp能活到今天的唯一一个原因。其次就是函数为基本类型和后来的闭包。当然Lisp也有很大的缺点,即: 一般的设计师难以避免Lisp的缺点。 Lisp有很多方言,很多子系列,可以说百花齐放,也可以说是散沙一盘。这就是Lisp的优点之一,同时也是其缺点之一,但是这些缺点主要是用Lisp的人造成的,而之所以会这样,是因为Lisp太容易滥用了(其缺点正是因为其优点导致的)。 NewLisp是一个非常强大的Lisp实现,也可以称为一个方言,是一个非常简单而又能力十足的方言。你可以用来编写各种脚本、可以用来制作小工具,可以用来设计桌面应用,可以用来设计本地软件、甚至还能胜任大型软件(只要你想,就可以做到)。为什么呢,因为其不但有着十足的灵活性,而且还能极其容易的和其他语言合作,比如你用C语言写底层库,就能在NewLisp中轻易的使用。当然NewLisp有一个致命的缺点: 没有完善的错误信息,一旦出现错误,就如同C++模板一样让你神经失常。 关于这一点,需要NewLisp以后改善,或者是有一个IDE之类的工具提供支持。这是NewLisp不适合设计商业软件的致命原因,再加上本来Lisp就是没多少人用的语言,而且还这么多方言分支,所以目前应该是只适合个人开发了。 项目地址: https://git.oschina.net/nneolc

Implementing Closures in a Compiler

一笑奈何 提交于 2019-12-09 15:57:20
问题 I am attempting to design a basic compiler to pseudo-assembly code. However, I cannot figure out how to implement closures. It seems I would need to associate specific register values with each "subroutine". I've considered use of stacks, but once again it seems insufficient. It seems like nothing short of an associative array would work, but how could that, or something similar, be done in assembly? The example I have chosen to attempt to represent is the following, communicated as

how to answer yes or no automatically in emacs

自闭症网瘾萝莉.ら 提交于 2019-12-09 15:50:19
问题 I binded function semantic-symref to key C-c C-r like this: (global-set-key (kbd "C-c C-r") 'semantic-symref) everytime I pressed C-c C-r , it prompted: Find references for xxxxx? (y or n) How can I answer it automatically? I tryed using lambda function like this, but failed (global-set-key (kbd "C-c C-r") (lambda() (interactive) (semantic-symref "yes"))) 回答1: The answer by @huitseeker is quite neat and effective. After four years, with flet and defadvice being obsolete, I wrote the following

在NewLisp中实现匿名函数的递归

蓝咒 提交于 2019-12-09 15:35:25
匿名函数在很多语言中的表现形式大概如下: (lambda (n) (* (+ n 1) (- n 1))) 只有参数列表和函数体,而没有名字。在大部分情况下没问题,但是一旦需要用到递归的话,就有点麻烦了,因为不知道如何去递归的调用一个匿名函数。 在学术界中有一些解决这个问题的办法,其中一个就是Y组合子,但是那个太繁琐,而且难以通过宏自动将一个lambda变成可递归形式,没什么好处。 根据历史经验,目前比较好的办法,就是实现一个操作符,匿名函数通过这个操作符来调用自身: (lambda (n) ... (this (- n 1))) 或者是 (lambda (n) ... (lambda (- n 1))) 第一种是用this或其他东西来表示当前匿名函数本身,直接调用就可以递归。第二种是和有名函数一样,用和定义匿名函数一样的操作符来调用自身。 然而第二种不实际,因为这样会造成混乱,比如需要嵌套lambda时,而且其语义也不对。 所以此文主要围绕第一种方式:实现让this指向当前匿名函数,从而可以递归调用自身。 NewLisp是一个Lisp语言的实现,也可以说是一个方言,其与Common Lisp相比,少了很多东西,但远比Common Lisp容易使用。Lisp系列的语言有一个特点:没有语法。或者说极小语法,用Lisp编写程序,直接没有了语法阶段,从语义开始起步,所以非常接近编译器

Debugging what this LISP Virus is doing

隐身守侯 提交于 2019-12-09 15:07:39
问题 My firm has been hit by an AutoCAD virus that is deleting and replacing our acaddoc.lsp with the routine below. I'm an architect and not exactly sure what this is doing by the repetitive "find" and "deletes". Questions What is this replacing the files with (currently searching for acadapq ) ? Who writes a virus for AutoCAD?!?! Has anyone seen this before? the CAD forums aren't very helpful. (setq wold_cmd (getvar "cmdecho")) (setvar "cmdecho" 0) (setq bb 2) (setq dpath (getvar "dwgprefix"))

Install lisp on my linux machine

◇◆丶佛笑我妖孽 提交于 2019-12-09 14:36:39
问题 I use Vim as my editor. "Practical common Lisp" suggest installing Lispbox, I don't know how to use emacs, don't know how to run lisp code with that T.T after that i find lisp plugin for vim called limp.vim with a long and hard install instruction :(( Finally i installed "Clisp" and i can run lisp code with a simple command: clisp ~/test.lisp But how to compile it? Is lisp a compiled language? sorry, i just don't know anything, i'm newbie in lisp Can anybody tell me what exactly need to

F# Type Providers vs. Lisp macros

北慕城南 提交于 2019-12-09 14:21:42
问题 I've been reading about F# 3.0 type providers (e.g. here) and it seems that they are based on a kind of compile-time code generation. In that respect I was wondering how they compare against Lisp macros. It would seem that both F# 3.0 type providers and Lisp macros allow user code to execute at compile time and introduce new types available to the compiler. Can anyone shed some light on the issue and nuances involved? 回答1: There is some overlap between F# type providers and meta-programming

Where should a Quicklisp QUICKLOAD go in my source? Nowhere?

白昼怎懂夜的黑 提交于 2019-12-09 10:39:26
问题 Let's say I build an application on top of net.aserve and bordeaux-threads . My package declaration might look like this: (defpackage :my-package (:use :cl :net.aserve :bordeaux-threads) (:export …)) I use Quicklisp, so I run (ql:quickload "aserve") (ql:quickload "bordeaux-threads") in SLIME before compiling my package, and everything is fine. Of course, tomorrow I start up SLIME again and I have to remember to issue the QUICKLOAD s before I compile, otherwise I'm in for trouble. I could put

Why is the hyphen conventional in symbol names in LISP?

*爱你&永不变心* 提交于 2019-12-09 10:20:09
问题 What's the reason of this recommendation? Why not keeping consistent with other programming languages which use underscore instead? 回答1: I think that LISP uses the hyphen for two reasons: "history" and "because you can". History LISP is an old language, and in the early days typing an underscore could be challenging. For example, the first terminal I used for LISP was an ASR-33 teletype. On some hosts and teletype models, the key sequence for the underscore character would be interpreted as a