freenode/#lisp - IRC Chatlog
Search
19:43:52
pjb
|3b|: unicode has a lot of good characters. But I agree that golf tasks naturally reduce good character in the most mild mannered and educated peopleā¦
23:18:50
Mark35
How would one pretty print json in lisp? It appears possible with https://common-lisp.net/project/cl-json/cl-json.html but I'm not sure how to go about it.
23:39:38
Odin-
XP is pretty configurable. Shouldn't be much of a problem convincing it to print Lisp structures as JSON.
0:12:10
HiRE
I read the handling of types section in the SBCL manual but it just left me more confused :(
0:13:07
no-defun-allowed
You can think of the type (MEMBER items ...) as meaning the provided value has to be one of the provided items.
0:15:35
no-defun-allowed
Providing :IF-EXISTS NIL to OPEN will just have it return NIL if the file exists already, which I don't think is used too much as signalling a condition is more appropriate.
0:17:49
HiRE
Is it more idiomatic to put each closing paren on a new line, or all packed in at the end?
0:21:06
torvis
c:/Users/eric/portacle/all/quicklisp/dists/quicklisp/software/iolib-v0.8.3/iolib.asd:
0:25:53
_death
which could be a file containing (error "Unsupported platform, patches welcome") or something
0:59:08
Xach
physpi: practical common lisp and paradigms of ai programming are good books (and free to read)
1:04:40
Xach
physpi: yes, you don't have to do anything special to get sbcl's help on that topic. it can issue more warnings if you make more promises via type declarations.
1:08:17
HiRE
so with keyword arguments - once you specify &key everything after that is treated as a keyword?
1:08:20
Xach
i only use allegro for quicklisp testing so i'm not sure what it might offer in that regard
1:10:24
Xach
for example (defun foo (&key ((:hey you) *guys*)) ...) looks for the keyword :HEY in calls, binds it to the value YOU in the body of the function, and if it's not passed, uses the value from *GUYS*
1:14:15
_death
you could also have you-suppliedp there, which introduces another variable whose value is true if the argument was supplied and false otherwise
1:15:41
HiRE
however I am confused - if the keyword variable isnt supplied that branch of the and statement is NIL right? So wouldn't that invalidate all other branches?
1:16:00
HiRE
I mean obviously (select (where :artist "Joe's band")) works fine - just trying to reason out the way the and is breaking down
1:17:44
_death
if, say, TITLE is not supplied, its default value is NIL, so the alternative branch of the IF is evaluated, in this case the form T, which evaluates to T, which is not NIL therefore true
1:17:56
HiRE
the `t` is in the false half of the if statement, so if it isn't supplied it just defaults true
1:23:13
HiRE
usually I'll learn a language by doing practice problems but since lisp is so different I figured learning from first principles was the best idea
1:24:02
gabc
I use it now as a reference when I want something clear for details (like &key and &optional or `loop')
1:26:45
aeth
HiRE: Imo tThe main distinction besides the syntax that makes it different is that nearly everything is an expression that returns a useful value
1:27:25
HiRE
aeth: yeah its a really nice idea. The result is very clean. At least as far as I've seen from chapter 3 the code is remarkably clean.
1:30:45
gabc
Just keep in mind that the cleanliness is not actually true and that you need to know when it isn't as to avoid pitfalls
1:39:41
Odin-
The Lisp 1.5 manual makes for some ... interesting reading when your chief exposure to Lisp is modern CL code.
2:02:32
Xach
clothespin: I think you can do that by doing (setf (sb-ext:bytes-consed-between-gcs) <some very large number>)
2:10:41
HiRE
clothespin: you could also look at the programming language benchmark game. They use SBCL and iirc they run it without a gc