libera/commonlisp - IRC Chatlog
Search
14:12:17
dirtcastle
I'm planning to read On lisp right after ansi common lisp. Will I be fine? I heard on lisp focuses so much on functional programming and macros. I'm interested. So I wanna read only these 2 books.
14:13:54
beach
dirtcastle: That should be fine. But you should know that macros are not used very much in Common Lisp programming. Of course when you need them, it is good to know how to write them. Also, macro functions is one domain where functional programming is appropriate.
14:14:22
beach
dirtcastle: The other thing is that Paul Graham uses a style that is not what most Common Lisp programmers use.
14:20:54
Josh_2
But more advanced macro writing macros come along sometimes but they are pretty rare in my experience
14:22:52
mfiano
Macros are strictly for syntactic abstractions and deferring evaluation in various ways.
14:24:21
Josh_2
The macros in a book like Let Over Lambda are pretty insane, can't say I've ever used one in practice though
14:24:49
Josh_2
Also the author seems to be a Perl user, so perhaps he just likes making his life difficulty :joy:
14:26:10
mfiano
The only CL book author I know that doesn't use a crazy language now is phow, who is still with us, I hope.
14:29:34
nij-
Some talks on getting rid of monads popped out to me recently (on StrangeLoop?). Seems that some of them want to get rid of monads..
14:30:56
mfiano
I haven't heard from them since I emailed them a few years ago. I don't know if they are particularly active in computer programming these days.
14:34:39
mfiano
His profile says: "Professor (math and CS), formerly freelance coder (mainly Common Lisp)". so I guess that answers the active part.
14:35:51
jackdaniel
I think that formerly applies to "freelance coder", not "Common Lisp"; I think that I saw recently a tangram clim implementation of his (in lw clim)
14:49:46
dirtcastle
I read through all the messages. thanks peeps. atm I'm just curious abt macros and functional programming and just generally trying to understand why lisp way of doing things is better. I plan to learn object oriented programming too and I heard it is taught in On lisp book. so I think I'll learn all important paradigms by reading ansi common lisp and on lisp I hope. correct me if I have wrong assumptions.
14:50:30
jackdaniel
dirtcastle: it is a good choice, especially if you are interested in functional programming and macros
14:52:01
_death
dirtcastle: if you're reading ACL, may be interested in https://courses.cs.northwestern.edu/325/readings/graham/graham-notes.html
14:54:46
minion
dirtcastle: please see pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
14:55:39
dirtcastle
I heard pcl is for ppl who already know some programming language and want to learn common lisp quickly.
14:56:41
dirtcastle
I'm pretty much a noob to programming. I can do loops and condition statements. but yet to have a clear understanding of functions, scope etc
14:57:35
mfiano
So I don't buy that argument. If I can do it, anyone can. No programming experience needed. Just some practice, and lots of questions.
15:01:08
dirtcastle
ok. When I first wanted to learn common lisp I picked pcl and went through cd database part. My problem was I was learning so much very quickly. It felt like a info dump. like they are using so many new words without going in detail and claim they will go in detail later. I was worried if they keep this up I'll be just learning abt new stuff over and over without understanding anything properly and end up understanding nothing.
15:01:23
mfiano
Infact, I would argue that it would be easier learning Common Lisp if you exclude some mishaps of history with "programming experience"
15:02:15
morganw
As a beginner, I thought "Common Lisp: A Gentle Introduction to Symbolic Computation" was pretty good for getting started. I read PCL second but found that more a model for how to build something.
15:02:34
mfiano
That means you are going too quickly, not pausing to absorb the material and clarify with questions on IRC, and tinker with the snippets provided on your own.
15:03:00
mfiano
It's not a race to read the book. No book is going to teach you how to program. It will guide you on a nice learning path though.
15:09:02
dirtcastle
I discovered emacs. and then I discovered nyxt browser. I wonder why every app isn't written in Lisp :P
15:10:07
dirtcastle
I tried to use selenium and python for web scripting. but it just doesn't feel right when compared to running a function in emacs.
15:12:37
beach
dirtcastle: I could explain to you why not every application is written in Lisp, but I have done that before, so I won't bore #commonlisp participants with it again.
15:14:02
pve
beach: is it written down somewhere? Like on the interwebs, because I would like to read it..
19:27:22
jackdaniel
declarations are convenient lies that the programmer tells the compiler; the latter may conformingly a) head the advice, b) ignore the advice, c) head the advice carefully, d) try to verify the advice
19:27:53
pjb
dbotton: do you have a paste service that doesn't need javascript, such as http://termbin.com ?
19:27:54
jackdaniel
e) heed the advice and segfault (also conforming \o/ if the declaration is incorrect)
19:28:45
pjb
dbotton: your code is not conforming, since it likes to the compiler. Therefore anything happens. You're lucky if you get an error or any result ressembling 3.
19:29:20
aeth
I wouldn't expect an ftype DECLARE for a global function to work (on the other hand, a global DECLAIM right above the relevant DEFUN probably should)
19:29:53
pjb
aeth: since the compiler can inline any file-local function call, declare will have an effect.
19:31:21
aeth
of course, none of it has to do anything, but DECLAIM FTYPE is common enough to come up
19:35:46
Bike
some of the semantics relating to type declarations changed during the standardization process.
19:36:38
dbotton
according to the piece it said that such a declare should turn in to (the)s on the calls
19:37:50
Bike
of course, it's nice for an error to be signaled, but implementations don't have to do so
19:38:09
kakuhen
i.e. (the fixnum 1.0d0) and the likes are UB. You cant rely on your compiler signalling an error
19:39:09
kakuhen
that's why you should always prefer check-type over a declare if you really need strict type checking across impls
19:39:40
kakuhen
that or increase safety levels; I know CCL does type checks on (safety 3) but not (safety 2)
19:40:14
Bike
some types are impossible or impractical to check. leaving the consequences undefined lets you declare those types anyway for optimization.
19:41:08
Bike
for example, if you declare an array's element type, that specifies the type of the elements - not just the upgraded element type, like usual. so to check it an implementation would need to iterate over the array, which would probably offset any efficiency gain from it knowing the array is full of whatever.
19:41:40
pjb
non-conforming code is like programming in C. (the fixnum 1.0d0) CAN be equivalent to *(int*)(char*)(double x=1.0d0,&x) (note, not (int)1.0d0 !).
19:44:10
pjb
All kinds of silly stuff can occur is you write a wrong declaration. It's really very dangerous.
19:44:45
Josh_2
Bike: the combination is ideal though, high safety for testing, higher speed less safety in your live version :thinking:
19:44:51
Nilby
Type decls are useful, just not in the "programmer: you can't do this" way, but rather in the "compiler: maybe you can do this?" way. For the former we have things check-type and assert.
19:45:29
pjb
Josh_2: not really. In production code, you want to ensure that no error pass thru. So you definitely want to keep the highest safety, and highest error detection for production.
19:46:18
pjb
Josh_2: otherwise, it would be like using seat belt when testing your prototype cars, and removing them in production, because you've tested your car doesn't crash when driven correctly during the tests.
19:46:50
Josh_2
I disagree, on of the purposes of your testing version is to make sure that your typed code only receives the types expected
19:47:03
pjb
Any type declaration must be validated by a global analysis of the program to prove that you will never assign other than the specified type!
19:47:04
_death
dbotton: when you encounter "is an error" it means you shouldn't do it.. it's different from "signals an error", which means the implementation should do that
19:47:39
pjb
I prefer to let the compiler insert good old type infered code, or run-time type checking as needed.
19:48:40
Josh_2
but if I knew I had a core part that was performance critical I would certainly make use of type declarations
19:49:59
Josh_2
Once I did a code test a friend of mine was given for a job interview using CL. Without the proper types the time taken to perform the data analysis was stupid.
20:58:48
Josh_2
(list* :key1 key1 :key2 key2 keys) is much nicer than (append (list :key1 key :key2 key2) keys)
21:11:50
Josh_2
One of the biggest projects I have made has been in constant use for almost 2 years now
21:13:57
Josh_2
Most of the functionality was hacked into the program while it was running :sunglasses: so i've never taken the time to start from completely fresh so I could document how to get it running
21:17:58
Josh_2
Its a shame really, I've hacked so much functionality into this bot that I dont use at all anymore :shrug:
21:36:08
dbotton
I always use doc strings, write when I can, notes etc. even if I can't understand myself sometimes most of the time I and others can :)
22:19:59
_death
although "is an error" is not mentioned there, it generally means the code is nonconforming
22:45:57
phoe
and yeah the language in TCLCS is so casual and boring that I am getting comments it's not terse enough for some people
22:46:15
phoe
so if someone likes a bit of story with their knowledge my book should be fine, for basics of macro writing too
1:29:45
shunter
Toplevel proclaims establishes declarations in the global environment. It's unspecified whether toplevel declaims have any effect after the file it lives in is compiled.