lisp

Android without Java

随声附和 提交于 2019-12-02 16:39:55
After doing the whole "enterprise" programming for a while, I'm seriously disillusioned by the language itself and always feel quite hampered if I have to go back to it. The project size of your average Android app isn't too intimidating and the libraries are actually quite nice regarding their coding style, but if I could avoid Java, I'd certainly do. So that's the question: Can I avoid it? While there are lots of JVM language that would be an option on desktops and servers, the Dalvik VM and the devices themselves pose some limits. This seems to be a bit better in 2.2 with the JIT, but

How does one implement a “stackless” interpreted language?

不想你离开。 提交于 2019-12-02 16:22:45
I am making my own Lisp-like interpreted language, and I want to do tail call optimization. I want to free my interpreter from the C stack so I can manage my own jumps from function to function and my own stack magic to achieve TCO. (I really don't mean stackless per se, just the fact that calls don't add frames to the C stack. I would like to use a stack of my own that does not grow with tail calls). Like Stackless Python, and unlike Ruby or... standard Python I guess. But, as my language is a Lisp derivative, all evaluation of s-expressions is currently done recursively (because it's the

transforming trees in lisp

我的梦境 提交于 2019-12-02 16:06:03
问题 I'm trying to modify a representation of a tree from : (A 2 B 0 C 2 D 0 E 0) in (A (B) (C (D) (E))). My code is like: (defun transform(l) (cond ( (null l) NIL) ( (and (not (numberp (car l))) (= (cadr l) 0) (null (cddr l))) (cons (car l) '(NIL NIL) )) ( (and (not (numberp (car l))) (= (cadr l) 0)) (cons (cons (car l) '(NIL NIL) ) (list (transform (cddr l))))) ( (not (numberp (car l))) (cons (car l) (list (transform (cddr l))))) ( T (transform (cdr l))) )) (defun subarbst(l nr) (cond ( (= nr 0)

Setting up a working Common Lisp environment for the aspiring Lisp newbie

眉间皱痕 提交于 2019-12-02 15:58:31
I've been a UNIX sysadmin for a long time, and aside from automating tasks with shell scripting, some light PHP work, and a few simple C programs, I've never done much in the way of programming. I recently decided to stretch my mind a bit and learn Common Lisp. I'm half-way through Touretzky's "Gentle Intro" and, having just reached the chapter on I/O, I'm wanting to get beyond typing stuff into the REPL as I walk through the book and the exercises. The problem is that I can't find a decent howto/tutorial on getting a decent, working environment. I've installed emacs (which in itself is a

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

“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

Flattening a tree structure in Lisp

北战南征 提交于 2019-12-02 14:51:07
问题 I was struggling with flattening a tree structure. I was doing it recursively by comparing each atomic symbol to the rest in the tree but, a friend of mine suggested the following code which I think looks cleaner. I just don't understand the line: ((atom tree)(list tree)) I understand what each of them do individually, I also know that the loop below takes a list or it causes an error, which I suspect has a lot to due with the reason we're turning the symbol into a list if atom returns true.

Best Common Lisp IDE [closed]

元气小坏坏 提交于 2019-12-02 14:36:29
I've used Slime within Emacs as my primary development environment for Common Lisp (or Aquamacs on OS X), but are there other compelling choices out there? I've heard about Lispworks, but is that [or something else] worth looking at? Or does anyone have tips to getting the most out of Emacs (e.g., hooking it up to the hyperspec for easy reference)? Update: Section 7 of Pascal Costanza's Highly Opinionated Guide to Lisp give one perspective. But to me, SLIME really seems to be where it's at . More resources: Video of Marco Baringer showing SLIME Videos of Sven Van Caekenberghe showing the

What is your opinion on Clojure? [closed]

▼魔方 西西 提交于 2019-12-02 14:17:00
What do you guys think about Clojure? I'm thinking of learning it next, currently using Erlang and in general happy with it except the records fiasco... Is Clojure as powerful as LISP? Consider learning it. If for no other reason then because you can actually use it in a real project. You : Can I use this small Java library called Clojure? Boss: Why do you need it? You : For some concurrency improvements. Boss: Ok. What you're refering to by Lisp-1 vs Lisp-2 is the question of whether functions and variables share the same name space. In Lisp-1 Lisps, like Scheme and Clojure, they do. In Lisp