Все вопросы: [lisp]

338 вопросов

7
голосов
2ответов
418 просмотров

Why are parenscript functions changed to all lowercase?

When using parenscript if I execute (parenscript:ps (slot-value ($ "#mytextarea") 'selectionStart)) It produces the javascript $('#mytextarea').selectionstart; Note that selectionStart is now selectionstart. It lost the uppercase S on the Start! How do I keep that uppercase S around?

5
голосов
12ответов
1099 просмотров

asm / C / Python / Perl / Lisp / Scheme Programmer looking for something new to learn

I need to have an at-home project now that I'm working on Python/Django at work. I'd like to learn something new, so I was thinking of checking out Java. What's the most well respected web framework for deploying Java web apps? The only reason I'm not checking out ruby on rails is because of how...

3
голосов
1ответов
985 просмотров

Lisp: How to write a Higher Order Function

I have this problem to work on: The sum higher order procedure can be generalised even further to capture the idea of combining terms with a fixed operator. The mathematical product operator is a specific example of this idea, with multiplication replacing the addition of the summation operator....

2
голосов
2ответов
3581 просмотров

Lisp Append Not Working Properly

Hi I am trying append a simple element to a lisp list. (append queue1 (pop stack1)) I thought the above code would append the first element of stack1 to queue1. Does queue1 need to be non nil? Thanks.

1
голосов
1ответов
145 просмотров

Lisp Recursion Not Calling Previous Functions

I'm trying to have a function compare the first argument of a passed in argument to a value, then if it is true, perform some function, then recursively call the same function. (defun function (expression) (cond ((equal (first expression) "+") (progn (print "addition") (fu...

1
голосов
2ответов
257 просмотров

Compound Conditional in Lisp

I'm new to lisp and I am simply trying to have two functions called at once if a conditional returns true. (cond ((equals (first expression) "+") (function1 parameter) (function2 parameter))) In the above code, I just want function1 and function2 to be called. Any thoughts?

3
голосов
3ответов
347 просмотров

Do languages with meta-linguistic abstraction perform better than those that just use reflection API for that?

Say, if I have a Lisp program, which uses (eval 'sym) and looks it up in its symbol-table does it actually perform better than something like aClass.getField("sym", anInstance) in "static" languages?

19
голосов
12ответов
5744 просмотров

CMS in functional programming language

Are there any CMS'es, written in functonal programming languages (lisp, haskell, f#/nemerle, scala, erlang, clojure, smalltalk) already?

3
голосов
1ответов
132 просмотров

Frameworks that support complex nested forms ala Rails' accepts_nested_attributes_for?

I'm working on a small side project for a friend and I need to build complex forms dynamically from a set of predefined types which in-turn are persisted via the underlying object model. So far I'm using Rails 2.3.4, accepts_nested_attributes_for, and a bit of Javascript. There's nothing wrong ...

22
голосов
3ответов
6715 просмотров

Emacs lisp "shell-command-on-region"

In GNU Emacs, I want to run a program, figlet, on the currently selected text. I then want to comment the region which is produced. I have figured out how to do it using the standard Emacs commands: set mark with C- at the start of the word move cursor to the end of the word C-u M-x shell-com...

4
голосов
4ответов
991 просмотров

binding local variables in python

I wonder if there is a good way to bind local variables in python. Most of my work involves cobbling together short data or text processing scripts with a series of expressions (when python permits), so defining object classes (to use as namespaces) and instantiating them seems a bit much. So w...

63
голосов
7ответов
27891 просмотров

What is ' (apostrophe) in Lisp / Scheme?

I am on day 1 hour 1 of teaching myself Scheme. Needless to say, I don't understand anything. So I'm reading The Little Schemer and using this thing: http://sisc-scheme.org/sisc-online.php as an interpreter. I need to use ' in for example (atom? 'turkey) to avoid an "undefined variabl...

130
голосов
6ответов
22866 просмотров

Why does Clojure have "keywords" in addition to "symbols"?

I have a passing knowledge of other Lisps (particularly Scheme) from way back. Recently I've been reading about Clojure. I see that it has both "symbols" and "keywords". Symbols I'm familiar with, but not with keywords. Do other Lisps have keywords? How are keywords different from symbols other ...

21
голосов
5ответов
4278 просмотров

Are there ruby equivalents to car, cdr, and cons?

Are there ruby equivalents to the lisp car, cdr, and cons functions? For those unfamiliar with lisp, here's what I want from ruby: [1,2,3].car => 1 [1,2,3].cdr => [2,3] [2,3].cons(1) => [1,2,3] (in lisp): (car '(1 2 3)) => 1 (cdr '(1 2 3)) => (2 3) (cons 1 '(2 3)) => (...

7
голосов
1ответов
1356 просмотров

Image Processing, extending JPanel and Simulating Classes in Clojure

there! I'm building an image-processing application in swing/clojure, and right now I need to develop an image panel in which I can click and compute data. Thanks to coobird, I now have a good idea on how to do it in Java, but I still don't get many issues on its integration with Clojure. Let's ...

7
голосов
1ответов
2504 просмотров

Convert a lisp string to stream

I have a file that looks like this: A B C D E 0 8 6 12 5 8 0 10 8 9 6 10 0 7 11 12 8 7 0 6 5 9 11 6 0 I don't know ahead of time how many rows and columns there will be. I would like to read the top line, which will let me know the number of rows to expect . I found lisp's (read <stream>...

15
голосов
5ответов
5172 просмотров

How to examine list of defined functions from Common Lisp REPL prompt

I'm evaluating/testing a browser based application presumably written in common lisp. Apart from the browser based interface, the software provides a 'Listener' window with a 'CL-User>' REPL prompt. I wish to examine the list of functions, symbols, and packages from the REPL prompt. So that ...

5
голосов
2ответов
2759 просмотров

Hex to decimal conversion in common lisp

Is there an easy helper function in common lisp to convert from hex to decimal?

12
голосов
5ответов
1627 просмотров

Where can I find a Lisp reader in C?

I have a Lisp reader written in Java that I'm thinking of translating into C. (Or perhaps C++.) It's a fairly complete and useful hack, so the main issue is doing the dynamic-storage allocation in a language without garbage collection. If someone has already thought this through I'd rather bor...

5
голосов
2ответов
634 просмотров

How can I send a file in a POST request?

I'm building a clojure API to my website that is basically a wrapper around the original web API. One of the features that I'm not being able to implement is file sending via POST requests, basically what I would do in shell with curl -F foo=bar [email protected] foobar.com. I'm using clojure-http-cl...

2
голосов
2ответов
264 просмотров

Get first and last atom of a list and append them

Say I have this list '((c d) (4 6) (m n) (z z)) How can I group the first and last element of each inner list and append it at the end so that my output would be something like this: (c 4 m z z n 6 d) Any help will be greatly appreciated!

4
голосов
4ответов
4826 просмотров

Parsing numbers from strings in lisp

Here's the brief problem: Input: a list of strings, each containing numbers (" 3.4 5.4 1.2 6.4" "7.8 5.6 4.3" "1.2 3.2 5.4") Output: a list of numbers (3.4 5.4 1.2 6.4 7.8 5.6 4.3 1.2 3.2 5.4) Here's my attempt at coding this: (defun parse-string-to-float (line &optional (start 0)) "P...

2
голосов
2ответов
111 просмотров

Destructively reverse every cons node in an s-expression

Any ideas how to go about this? I am trying to not create any new nodes.

5
голосов
5ответов
16967 просмотров

Get Last Element of each list

Let us say I have a list ((3 4 5) (d e f) (h i j) (5 5 5 5)) How can I get the last element of each list in such a way that the output would look like this (5 f j 5)?

2
голосов
1ответов
714 просмотров

Function Table in Scheme using Association List

I am attempting to build a rudimentary interpreter in Scheme, and I want to use an association list to map to arithmetic functions. This is what i have so far: ; A data type defining an abstract binary operation (define binoptable '(("+" . (+ x y))) ("-" . (- x y)) ("*" . (* x y)) ...

6
голосов
4ответов
6262 просмотров

In common-lisp, how do I modify part of a list parameter from within a function without changing the original list?

I'm trying to pass a list to a function in Lisp, and change the contents of that list within the function without affecting the original list. I've read that Lisp is pass-by-value, and it's true, but there is something else going on that I don't quite understand. For example, this code works as e...

18
голосов
4ответов
4742 просмотров

What is the exact definition of a Metacircular Interpreter?

Is it legal to call a C compiler written in C or a PHP interpreter written in PHP metacircular? Is this definition valid only for languages of a specific type, like Lisp? In short, what are the conditions that an interpreter should satisfy for being called Metacircular?

14
голосов
5ответов
3138 просмотров

Besides Logo and Emacs Lisp, what are other pure dynamically scoped languages?

What are some examples of a dynamically scoped language? And what are the reasons for choosing that design? Is it because it is easy to implement?

9
голосов
18ответов
1485 просмотров

What language could I use for fast execution of this database summarization task?

So I wrote a Python program to handle a little data processing task. Here's a very brief specification in a made-up language of the computation I want: parse "%s %lf %s" aa bb cc | group_by aa | quickselect --key=bb 0:5 | \ flatten | format "%s %lf %s" aa bb cc That is, for each line, par...

4
голосов
3ответов
266 просмотров

strtotime for Emacs Lisp

Is there any functionality in Emacs Lisp that behaves similar to PHP's strtotime function? (Actually AFAIK it implements relative items of the GNU date input formats.) In PHP I can write echo strtotime("+2 months"); //1258891352 echo strtotime("-3 months +2 weeks"); //1246952239 which return ...