lisp

Suitable functional language for scientific/statistical computing?

I use mostly R and C for statistics-related tasks. Recently I have been dealing with large datasets, typically 1e7-1e8 observations, and 100 features. They seem too big for R too handle, and the package I typically use are also more prone to crashing. I could develop tools directly in C or C++, but this would slow down the development cy...

Why should I use 'apply' in Clojure?

This is what Rich Hickey said in one of the blog posts but I don't understand the motivation in using apply. Please help. A big difference between Clojure and CL is that Clojure is a Lisp-1, so funcall is not needed, and apply is only used to apply a function to a runtime-defined collection of arguments. So, (apply f [i]) can be writ...

How might I format an alist in common lisp?

I'm beginning to write me some Common Lisp and am just getting the hang of consing things together and formatting them. Let's suppose I have an alist, like this: (defvar *map* '((0 . "zero") (1 . "one") (2 . "two"))) How do I format it like this? 0: zero 1: one 2: two I was thinking something like (format t "~{~{~a: ~a~}~%~}" *map...

Source code of well designed functional web apps?

What are examples of well designed functional (as opposed to object oriented) web apps that make their source code available? I am currently studying the Hacker News source but I'd like to see some other non-trivial examples, ideally in clojure. For MVC there are lots of Rails and PHP apps, frameworks, and tutorials to study - what is t...

How I Can do web programming with Lisp or Scheme?

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 #ke...

What is the best open source common lisp implementation that works with Eclipse?

I have started working my way through Practical Common Lisp and am looking for a Common LISP implementation that works on Eclipse. It would be nice if it had some kind of IDE integration besides the editor and the REPL (although I'm not sure what that would be). Also, I have Linux, Windows, and OS X, although my primary workstation is a ...

How to write an empty list using S, K and I combinators?

I know that: (cons [p] [q]) is ((s ((s i) (k [p]))) (k [q])) (car [lst]) is ([lst] k) (cdr [lst]) is ([lst] (k i)) I want to write a list like this (cons [a] (cons [b] (cons [c] [nil]))) , which is going to be something like this: ((s ((s i) (k [a]))) (k ((s ((s i) (k [b]))) (k ((s ((s i) (k [c]))) (k [nil])))))) But I don't kno...

(emulated) Macros in Haskell?

Hi. A person on Reddit has brought this code to my attention: main = do let ns = [print 1, print 2, print 3] sequence_ ns sequence_ $ reverse ns sequence_ $ tail ns ++ [head ns] head ns What's going on here is we have an array of operations that we can do stuff with, like reverse or get its tail or head. Awesome. What I w...

Do you have a mnemonic for remembering the meaning of car and cdr?

Most of my Lisp experience comes from Elisp. As such, I find myself writing Lisp only on occasion. By the time I come back to it, I often forget the difference between car and cdr and need to reference the docs to jog my memory. What kinds of clever mnemonics do you use to remember the difference between Lisp functions that have nam...

Eval not working on unexpanded macro quote

In common lisp I can do this: src-> (defmacro macro-hello () `"hello") (eval '(macro-hello)) no problem. In clojure: (defmacro macro-hello [] `"hello") (eval '(macro-hello)) gives me an error. Have I done something wrong? Clojure Error: Exception in thread "main" java.lang.Exception: Unable to resolve symbol: macro-hello i...

How to read input until EOF in Lisp

How do I read an input stream until EOF in Lisp? In C, you might do it like this: while ((c = getchar()) != EOF) { // Loop body... } The reason I am asking this is because I would like to be able to pipe data to my Lisp programs (I've just started learning) without having to specify the data size in advance. Here's an example f...

CLSQL symbol exports

Does anyone know about how the clsql-sys methods get exported to the clsql-sys/cl-user package? The methods are defined individually for each database type. For example, suppose I define a method in db-mysql/mysql-sql.lisp in package clsql-mysql: (defpackage #:clsql-mysql (:use #:common-lisp #:clsql-sys #:mysql #:clsql-uffi) (:export #...

What is the Definition of a Lisp Cons Cell?

What exactly is the definition of a Common Lisp Cons Cell? How is a Cons Cell different than a standard linked list item? After all, both the cons cell and the linked list item have a value and a pointer to the next cell or item... or is this understanding wrong? ...

What Lisp is better at parsing?

I'd like to implement a Lisp interpreter in a Lisp dialect mainly as a learning exercise. The one thing I'm thrown off by is just how many choices there are in this area. Primarily, I'm a bit more interested in learning about some of the Lisps that have been around a while (like Scheme or Common Lisp). I don't want to use Clojure to d...

Read macros: what do you use them for?

I'm trying to get a feel for the parts of Lisp that I haven't used very much up to now. Read macros have caught my attention at the moment. There isn't a huge amount of info about their use and it would help to see what people have done with them, both to get examples of how they work and also to see what sorts of problems can be approac...

Lisp void-variable error when evaluating function

I'm trying to learn Lisp (elisp, actually), and I tried writing the following function as an exercise (Project Euler #2): (defun sumfib (n fn1 fn2 sum) "Calculate Fibonacci numbers up to 4,000,000 and sum all the even ones" (if (< 4000000 (+ fn1 fn2)) sum (if (equal n 3) (sumfib 1 (+ fn1 fn2) fn1 (+ sum (+fn1 fn2))...

LISP Parser C++

Is there an existing LISP parser written in C++? I just want the parser, not a full interpreter, but an interpreter to go along with it would be a plus. ...

which clojure library interface design is best?

I want to provide multiple implementations of a message reader/writer. What is the best approach? Here is some pseudo-code of what I'm currently thinking: just have a set of functions that all implementations must provide and leave it up to the caller to hold onto the right streams (ns x-format) (read-message [stream] ...) (write-mes...

How to use Lispworks comm package for SSL access in Postmodern instead of cl+ssl

On XP, I'd like to use Postmodern in Lispworks to use the database on a server via SSL. It looks like CL+SSL has a problem with setting up a unilateral SSL connection. Lispworks works fine. Is there a way to get Postmodern to use the socket set up by Lispworks instead of one by CL+SSL? Or is there a version of CL+SSL which can make a un...

Unilateral SSL with CL+SSL package

In Lispworks on XP when I do: CL-USER 489 > (cl+ssl:make-ssl-client-stream (cl+ssl:stream-fd standard-output)) I get: Error: A failure in the SSL library occurred on handle #. (Return code: 1)SSL error queue: error:140C5042:SSL routines:SSL_UNDEFINED_FUNCTION:called a function you should not call Is this something I'm doing wrong? ...