scheme

Python Macros: Use Cases?

痴心易碎 提交于 2019-12-02 15:55:39
If Python had a macro facility similar to Lisp/Scheme (something like MetaPython ), how would you use it? If you are a Lisp/Scheme programmer, what sorts of things do you use macros for (other than things that have a clear syntactic parallel in Python such as a while loop)? Some examples of lisp macros: ITERATE which is a funny and extensible loop facility CL-YACC / FUCC that are parser generators that generate parsers at compile time CL-WHO which allows specifying html documents with static and dynamic parts Parenscript which is a javascript code generator Various simple code-wrappers, e.g.,

What is the best Scheme or LISP implementation for OS X?

拟墨画扇 提交于 2019-12-02 15:42:23
I am looking for a version of Scheme or even LISP that I can use to recover some lost Lisp development skills. Some web capabilities would be nice but not essential. I've looked at Plt and MIT scheme and, while both look pretty good, the Plt seems to be more feature rich. I've also looked at Lisp implementations but all of the seem quite expensive. I favor free/inexpensive implementations as this is truly likely to just be occasional hobby programming. What recommendations would you have? Kyle Cronin I'd go with Racket. It may not be as fast as SBCL, but it does have excellent libraries and

Custom map function - how does it work?

旧巷老猫 提交于 2019-12-02 15:37:49
问题 I apologize for the unclear topic title. I have this function in Scheme which is a custom implementation of the map function. It works fine, but I got lost trying to understand it. (define (my-map proc . ls) (letrec ((iter (lambda (proc ls0) (if (null? ls0) '() (cons (proc (car ls0)) (iter proc (cdr ls0)))))) (map-rec (lambda (proc ls0) (if (memq '() ls0) '() (cons (apply proc (iter car ls0)) (map-rec proc (iter cdr ls0))))))) (map-rec proc ls))) The problem lays in cons (proc (car ls0)) . If

“application: not a procedure” while computing binomial

天大地大妈咪最大 提交于 2019-12-02 15:03:33
问题 I am defining a function binomial(n k) (aka Pascal's triangle) but am getting an error: application: not a procedure; expected a procedure that can be applied to arguments given: 1 arguments...: 2 I don't understand the error because I thought this defined my function: (define (binomial n k) (cond ((or (= n 0) (= n k)) 1) (else (+ (binomial(n) (- k 1))(binomial(- n 1) (- k 1)))))) 回答1: In Scheme (and Lisps in general), parentheses are placed before a procedure application and after the final

What is the best Scheme interpreter or compiler? [closed]

只愿长相守 提交于 2019-12-02 14:22:26
Hey everyone, I want to start using Scheme and I have two questions. First, would you recommend using an interpreter or a compiler for Scheme and why? Second, which interpreter or compiler for Scheme would you recommend and why? Thanks! Michael Aaron Safyan For a beginner, I would highly recommend DrRacket (formerly Dr. Scheme), since it gives you a really nice environment to work in, supports many dialects of Scheme, and gives very good failure and debugging information. I believe most implementations of Scheme are interpreters, although it is possible that there is a compiler out there. If

What are the actual differences between Scheme and Common Lisp? (Or any other two dialects of Lisp)

巧了我就是萌 提交于 2019-12-02 14:11:35
Note: I am not asking which to learn, which is better, or anything like that. I picked up the free version of SICP because I felt it would be nice to read (I've heard good stuff about it, and I'm interested in that sort of side of programming). I know Scheme is a dialect of Lisp and I wondered: what is the actual difference is between Scheme and, say, Common Lisp? There seems to be a lot about 'CL has a larger stdlib...Scheme is not good for real-world programming..' but no actual thing saying 'this is because CL is this/has this'. This is a bit of a tricky question, since the differences are

Can I use Common Lisp for SICP or is Scheme the only option?

有些话、适合烂在心里 提交于 2019-12-02 14:06:36
Also, even if I can use Common Lisp, should I? Is Scheme better? You have several answers here, but none is really comprehensive (and I'm not talking about having enough details or being long enough). First of all, the bottom line: you should not use Common Lisp if you want to have a good experience with SICP. If you don't know much Common Lisp, then just take it as that. (Obviously you can disregard this advice as anything else, some people only learn the hard way.) If you already know Common Lisp, then you might pull it off, but at considerable effort, and at a considerable damage to your

What's a good beginning text on functional programming? [closed]

只谈情不闲聊 提交于 2019-12-02 13:54:25
I like to study languages outside my comfort zone, but I've had a hard time finding a place to start for functional languages. I heard a lot of good things about Structure and Interpretations of Computer Programs , but when I tried to read through it a couple of years ago it just seemed to whiz over my head. I do way better with books than web sites, but when I visit the local book store the books on LISP look kind of scary. So what's a good starting point? My goal is to be able to use a functional programming language to solve simple problems in 6 months or so, and the ability to move to more

How can I do web programming with Lisp or Scheme?

独自空忆成欢 提交于 2019-12-02 13:53:11
I usually write web apps in PHP, Ruby or Perl. I am starting the study of Scheme and I want to try some web project with this language. But I can't find what is the best environment for this. I am looking for the following features: A simple way of get the request parameters (something like: get-get #key, get-post #key, get-cookie #key). Mysql access. HTML Form generators, processing, validators, etc. Helpers for filter user input data (something like htmlentities, escape variables for put in queries, etc). FLOSS. And GNU/Linux friendly. So, thanks in advance to all replies. Racket has

Scheme - find most deeply values nested lists

梦想与她 提交于 2019-12-02 13:26:35
问题 I asked several days ago about finding the most deeply nested lists. I implemented the idea that was given, and it works. But there is another problem: I also need to build a list from the nested list. meaning: If I change (8) and (10 11 12) , to leaf1 and leaf2, I need to return: '(ans (leaf1 (8)) (leaf2 (10 11 12)) . /ans is a quote In other words: my function will get (1 (2 3) (4 (5) (7 (8) (10 11 12)))))) => the most nested lists are (8) and (10 11 12) => my function will return '(ans