Questions tagged [land-of-lisp]

Land of Lisp is an educational comic that teaches readers how to program in Common Lisp.

30 questions
3
votes
1 answer

Can you program without REPL on Lisp?

So I just got Land of Lisp and started to do the first program. I have a couple questions. Is there a way to just write some code and run it through a compiler, or interpreter, and not use the REPL thing? I don't like it much. I can't seem to go…
2
votes
1 answer

Breaking a function into multiple lines

Here are some source code for an example from the amazing book "Land of Lisp" : (defun random-node () (1+ (random *node-num*))) (defun edge-pair (a b) (unless (eql a b) (list (cons a b) (cons b a)))) (defun make-edge-list () (apply…
Chiron
  • 20,081
  • 17
  • 81
  • 133
2
votes
1 answer

Wumpus game's make-city-edges function causes heap overflow

Going through the Land of Lisp book, I managed to get to the Grand Theft Wumpus game, that has me define a make-city-edges function. When I try to run it however, SBCL hangs for a while before giving me a very nasty error saying Heap exhausted…
Electric Coffee
  • 11,733
  • 9
  • 70
  • 131
2
votes
4 answers

Understanding data mode in Lisp, why are these expressions not the same?

Currently I am reading "Land of Lisp". In one of the recent code samples the author gave: > (eq 'fooo 'FoOo) T to prove that the symbols are case-insensitive. A few pages later data mode is formally introduced. However I fail to really understand…
0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
2
votes
1 answer

Printing to screen while in loop

I have this: (loop for i below x do (update-world) if (zerop (mod i 1000)) do (princ #\.)) It is working, except that all the princ invokations arrive at once, at the end. The idea here is that they are a…
johnbakers
  • 24,158
  • 24
  • 130
  • 258
2
votes
1 answer

Land of Lisp function uedges->dot error or can't understand

http://landoflisp.com/graph-util.lisp (defun uedges->dot (edges);draw undirected graphs (maplist (lambda (lst) (mapc (lambda (edge) (unless (assoc (car edge) (cdr lst)) (fresh-line) …
1
vote
1 answer

Question about lisp Lambda functions from an example in Land of Lisp

I'm not quite understanding lambda functions. Here is an example function from the book Land of Lisp: (defun edges->dot (edges) (mapc (lambda (node) (mapc (lambda (edge) (fresh-line) (princ (dot-name…
MikeJerome
  • 660
  • 6
  • 20
1
vote
1 answer

Getting ERR_INVALID_HTTP_RESPONSE using web server code in Land of Lisp with clisp on OS X

I'm reading Land of Lisp (it's 10 years old, but so is clisp, so it seems up to date enough). I'm on Chapter 13, where you write a web server. It just opens the client socket as standard-output, then uses princ and format t to write out to the…
1
vote
1 answer

land of lisp src webserver.lisp

while I was learning in "land of lisp" chapter 12 and 13 about "socket". I use lispbox, so I need install a socket.At last, I found usocket available. this is a sample about how to use usocket, to bulid a webserver. (defun serve (request-handler) …
1
vote
5 answers

tweak-text: Lisp nesting exceeds `max-lisp-eval-depth

The program should reformat the string like below. Example: (game-print '(THIS IS A SENTENCE。 WHAT ABOUT THIS? PROBABLY.)) This is a sentence. What about ths? Probably. But something is wrong( Lisp nesting exceeds `max-lisp-eval-depth) and i don't…
louxiu
  • 2,830
  • 3
  • 28
  • 42
0
votes
1 answer

What is syntax expression?

I read in the book "Land of Lisp", the author mentions syntax expression. Does that mean the ability to express syntax as a form of data? Is this the same as S-expression (symbolic expression)?
Amumu
  • 17,924
  • 31
  • 84
  • 131
0
votes
2 answers

LISP: Reversing a List in LISP using RPLACA/RPLACD/NCONC

So I'm trying to make a function takes in a list and reverses in place it but I'm not sure how I would use the RPLACA/RPLACD/NONC. Basically does the same thing as reverse but it uses the cons nodes of the original list and does not allocate any…
John
  • 1
  • 1
0
votes
1 answer

Extracting nodes form dotted list (edges) in CLISP

I'm a "Nil" or () in Lisp World. I wanted to get a list of all nodes in edge list and I wrote a code to solve this problem. But I met some unexpected problem. (Codes from 'Land of Lisp' - chapter 8) ;; Creating edge list (defun random-node () …
Larynx
  • 398
  • 1
  • 12
0
votes
2 answers

Cadr of a list involving assoc function

I have looked around on the net and cant find an answer to my query. I would really appreciate if someone could provide a good answer without down rating this post. In Lisp car, cdr are used on data mode like '(whatever here) which makes sense to…
-1
votes
2 answers

confusion with Lisp "if" and 'cons' command

I am reading Land of Lisp by Conrad Barski and I am a bit confused on the use of the 'if' command (to name a few).. So, I understand that writing if '() means that the list is empty and condition is false and if '(1) means the list is non empty and…
1
2