lisp Questions
5
Solved
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)
He...
Readymade asked 29/9, 2009 at 23:34
2
Solved
According to Common Lisp HyperSpec (CLHS), mapcan uses nconc to combine its results into a list. CLHS also says that
(mapcon f x1 ... xn)
== (apply #'nconc (maplist f x1 ... xn))
So I've been con...
Barbosa asked 14/4, 2023 at 15:36
7
Solved
I often have my emacs split into about 4 windows so I can look at a bunch of buffers at the same time, however I'd like to be able to C-x 1 (make the window the same size as emacs) and then somehow...
13
I recently had the necessity of rewriting a javascript function in javascript, dynamically. The ease with which I did it, and how fun it was, astounded me.
Over here I've got some HTML:
<div i...
Bacteriostat asked 13/7, 2009 at 13:18
3
Solved
I saw the usage of & in Clojure function signature like this (http://clojure.github.io/core.async/#clojure.core.async/thread):
(thread & body)
And this:
(doseq seq-exprs & body)
D...
4
I want to read in the contents of a file into a list. Some of my attempts so far have been -
(defun get-file (filename)
(let ((x (open filename)))
(when x
(loop for line = (read-line x nil)
wh...
Swearword asked 28/9, 2010 at 14:38
8
Solved
How would I get the first n elements of a list?
CL-USER> (equal (some-function 2 '(1 20 300))
'(1 20))
T
I am absolutely certain this is elementary, but help a brother newb out.
Wardle asked 12/11, 2009 at 2:39
2
how we can read a pdf using lisp and separate the table of content. This can be done by other languages but in lisp this is bit difficult any can help me with a sample code?
http://www.rajive-hse...
Luane asked 18/11, 2010 at 11:48
2
Solved
Okay, I am new with scheme/racket/lisp. I am practicing creating my own functions, syntax, and recursion, so I want to make my own foldl and foldr functions that do exactly what the predefined vers...
11
I have a list of things (I'll call it L), an index(N) and a new thing(NEW). If I want to replace the thing in L at N with NEW, what is the best way to do this? Should I get the sublist up to N and ...
Relegate asked 4/10, 2008 at 20:8
15
Solved
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...
5
Solved
I've started learning Scheme, for fun mostly, and because I've never used a functional language before. I chose Scheme because I wanted to read SICP for a long time.
Anyway, I'm currently learning...
5
Solved
According to SICP section 1.2.6, exercise 1.22:
Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running...
6
Solved
Should I use
(apply + (filter prime? (range 1 20)))
or
(reduce + (filter prime? (range 1 20)))
Edit: This is the source for prime in clojure from optimizing toolkit.
(defn prime? [n]
(con...
4
Solved
I would like to know the best way to customize auto-formatting/auto-indenting in vim for Common Lisp.
Auto-formatting (I usually do this by typing '==' in command mode per line) works very well fo...
Papaya asked 15/12, 2011 at 1:8
1
Background: CCL aka OpenMCL is a very nice, venerable, lightweight but fairly fast Common Lisp compiler. It's an excellent match for the RPi because it runs on 32-bit models, and isn't too memory i...
Discussion asked 18/9, 2022 at 20:26
7
Solved
Can someone suggest articles that explain the concept of Homoiconicity, especially using Clojure. Why is it that Clojure is homoiconic but its hard to do that in other languages such as Java ?
4
Solved
I set an explicit file to customization created via the UI. It's named custom.el. Currently, I use the followed snippets to create this file if not exist.
(defconst custom-file (expand-file-name "...
5
Solved
Simple question.
Say I have a bunch of NIL's in my list q . Is there a simple way to remove the NILs and just keep the numbers?. eval doesn't seem to work here.
(NIL 1 NIL 2 NIL 3 NIL 4)
I need...
3
Solved
Okay, final question and I'll have finished my number guessing game in Common Lisp! :D Whenever the game starts (or a new game begins after the first game), the following function is called.
;;; P...
Bywaters asked 27/10, 2010 at 13:57
13
How can I remove nested parentheses recursively in Common LISP Such as
(unnest '(a b c (d e) ((f) g))) => (a b c d e f g)
(unnest '(a b)) => (a b)
(unnest '(() ((((a)))) ())) => (a)
...
Whorish asked 21/4, 2010 at 6:54
12
Solved
I am just now learning about function pointers and, as I was reading the K&R chapter on the subject, the first thing that hit me was, "Hey, this is kinda like a closure." I knew this ...
Kinzer asked 16/10, 2008 at 14:41
3
Solved
(completing-read
"Complete a foo: "
'(("foobar1" "~/foobar1/") ("barfoo" "/usr/barfoo/") ("foobaz" "/hello/")))
As shown above, I would like to prompt for "foobar1","barfoo", and "foobaz" but g...
Iscariot asked 14/2, 2016 at 10:29
4
Solved
Can anybody explain an example in Paul Graham's ANSI Common Lisp page 110?
The example try to explain the use &rest and lambda to create functional programming facilities. One of them is a func...
Corpulence asked 8/5, 2011 at 14:45
4
Solved
Emacs lisp is a dialect of LISP and especially Scheme. Most of scheme interpreters do have a optimization of Tail Recursion, but emacs lisp doens't. I searched the reason in `info elisp' for a whil...
© 2022 - 2024 — McMap. All rights reserved.