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 expected:
(defun test ()
(setf origina...
Hello. 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))
("/" . (/ x y)))
)
The problem is...
Hi guys! help please..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). Thanks in advance!
...
Any ideas how to go about this? I am trying to not create any new nodes.
...
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))
"Parses a list of floats out of a given string"
...
Hi guys help please...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..Thanks in advance!
...
Hello, there.
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-client, and initially tried ...
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 borrow their code than figure it out myself. ...
Is there an easy helper function in common lisp to convert from hex to decimal?
...
I'm a newbie to lisp. 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 I could co-relate the ...
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>) function which, in a loop, can parse each of t...
Hello, 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 take a look at how coobird suggeste...
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)) => (1 2 3)
...
I have a passing knowledge of other Lisps (particularly Scheme) from way back when. My knowledge is pretty rusty (and was pretty basic to begin with). Recently I've been reading about Clojure. I see that it has both "symbols" and "keywords". Symbols I'm familiar with, but not keywords.
Do other Lisps have keywords? How are keywords diff...
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 ' for, for example
(atom? 'turkey)
to avoid an "undefined variable" error. The ', according to the book, is a...
Hi, 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 what I had in mind was something like i...
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 with this, I've just about got it modified...
Are there any CMS'es, written in functonal programming languages (lisp, haskell, f#/nemerle, scala, erlang, clojure, smalltalk) already?
...
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?
...
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?
...