freenode/#lisp - IRC Chatlog
Search
9:27:33
codesine
What’s a good book or single point of entry for Common Lisp programming especially from a math background
9:29:26
minion
codesine: please look at 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).
9:29:43
beach
codesine: Common Lisp is not considered a particularly function language in that sense.
9:30:07
beach
codesine: So you are going to have a hard time finding a book that does functional programming only in Common Lisp.
9:32:13
beach
"functional programming only" as opposed to "both functional, imperative, and object-oriented programming"
9:33:21
beach
codesine: I should have said: Common Lisp is not considered a particularly functionAL language in that sense.
9:34:37
beach
codesine: Well, since this channel is dedicated to Common Lisp, the opinions here are biased.
9:35:47
beach
codesine: Functional programming is one of the paradigms that Common Lisp supports, but I think it will be hard to find a book that uses Common Lisp and that is all or even mostly about functional programming.
9:38:39
beach
codesine: One important use of functional programming in Common Lisp is in macro expanders, because you typically don't want macro expanders to have side effects. Therefore, a book like On Lisp mostly uses functional programming, but it is a very special use case for that style.
9:41:17
beach
Scheme is also not particularly functional, but maybe Scheme books emphasize that style more often.
9:44:58
Zhivago
I think it's more that recursion looks more functional than iteration, to people who don't realize that iteration is recursion.
9:55:49
Shinmera
It's somewhat convenient for getting a simple app running "directly" on every major OS
10:02:32
_death
it's useful in helping (read "practically forcing") people think about representations that may not be immediately obvious
10:15:38
whoman
C is close to the ... von neu? wait.. asm? x86? way of doing things. close to how the machine works, more so with our current machines than lisp afaik
10:24:45
p_l
VM is just a catch-all for the environment specified to be used by language so you have simple replicated target to write your applications against
10:25:21
whoman
or could i say, the unoptimized disasm of C more closely resembles the machines instructions than for Lisp ?
10:27:43
p_l
nope. unoptimized output of C also tends to not look very modern, though compilers kinda cheat there by not implementing truly unoptimized form in output
10:28:39
whoman
yea ? cuz that part is a bit of an obstacle for me with lisp as i grew up with C, but i really dont see how lisp is any different, if i grew up on that instead
10:30:22
p_l
C gives an illusion of being very low level, but I think it hasn't been true since it left PDP-11
10:31:45
p_l
_death: I know one person who trolled C programmers with standard-compliant C-in-Perl implementation
10:33:06
beach
So in fact, for applications, C is inconvenient, and for "system programming", you have to write nonconforming code to do what you want.
10:33:22
p_l
yeah, also known as "UB" and "compiler is allowed to do anything, including murdering your pet goat, upon encountering that line"
10:35:03
p_l
It's low level in the sense of making you worry about irrelevant (to application you're writing) concerns
10:37:15
p_l
for popular definition of "systems programming", the code is pretty much always full of non-conforming bits, or at least "uses a VM implemented in nonconforming code" as runtime
10:41:09
_death
I think C, Forth, and assembly are prime candidates for an embedded program.. of course, you could use Lisp to generate the code ;)
10:44:32
p_l
_death: assembly doesn't count, since it's essentially an intermediate form of a program generated by something else
10:46:22
p_l
that's not assembly then, just programming the way before assemblers gave us useful intermediate
10:47:39
p_l
I mean that assembler, in its typical form, doesn't count as essentially an intermediate for talking native language of the chip
10:48:28
p_l
hell, PDP-10 bootstrap was handled by handwriting opcodes into registers then swapping them with memory
10:49:20
p_l
_death: and arguably every lisp compiler that generates native code does something like that, though they sometimes happen to not show it directly
10:50:23
_death
p_l: yep.. the other day I pasted https://gist.github.com/death/5ec259ef473b982898a3c5e36b21b1cd
10:56:34
_death
p_l: I also found Kragen Sitaker's urscheme implementation, which generates assembly text, to be very neat.. http://canonical.org/~kragen/sw/urscheme/compiler.scm.html
11:05:34
beach
Shinmera: Yes, it's an independent repository: https://github.com/robert-strandh/Cluster
11:06:54
p_l
btw, does anyone know a single place where I could read about R. Scott McIntyre's CL libs?
15:49:17
jmercouris
Is it more expensive to pass around a large list as an arugment instead of a boolean? or is the cost the same?
15:52:06
jmercouris
Whenever someone has a question here that they ask, I always answer, refraining from saying RTFM
15:52:22
jmercouris
Additionally, my question is complex and implementation dependent, what am I to do, spin up an instance of each implementation and test it?
15:52:46
jmercouris
I don't pretend to be an expert, and I know when it is smarter to ask, rather than to fumble around
15:53:12
jmercouris
Shinmera: If you want to be real smart about it, consider an implementation that copies memory addresses when making a new caller
15:54:20
jmercouris
beach: Well, I have no way of knowing that as I've never implemented a CL system from scratch
15:55:24
jmercouris
beach: There are most definitely implementations of programming languages that copy the contents of memory when making a call
15:56:08
jmercouris
Well, this is just one example of how it MAY be more expensive, I see now very obviously why that is not the case in CL, but there are other scenarios I can think of
15:57:00
Shinmera
There are cases when passing a value /at all/ is more expensive than not passing it. Such as when a value can be immediate within a block, but needs to be boxed across boundaries.
15:57:11
jmercouris
Consider an implementation that does some checking of the contents of arguments before calling them in a new function
15:58:01
jmercouris
Why might it be checking the arguments? Maybe it is checking that they have not been corrupted, perhaps the code is running on some lunar probe that is subject to solar radiation
15:59:06
dim
it's ok to be lost in your own code and ask “stupid” questions to help debugging, we can be your rubber duck!
15:59:20
jmercouris
Consider a situation in which invoking a new caller will require the machine to begin paging memory on the hard disk, this means that now some amount of memory, entirely OS and implementation dependent will have to be moved to the HDD, how does the system decide? will one of the arguments be on disk while another is still in ram?
16:00:06
jmercouris
beach: I have provided two very plausible scenarios in which the size of the argument may cause strange behavior depending on the caching strategy of the implementation
16:00:50
jmercouris
The CL implementation is supposed to be a black box as far as I am concerned, I'm fairly confident that the spec does not say something along the lines of "function calling execution time shall not depend on the size of the arguments contained within the call"
16:05:21
jmercouris
If the safety of the system is important, and there is random solar radiation, it may be important
16:05:31
Shinmera
For all we know an implementation might just randomly insert SLEEP wherever it wants just to screw with you. How are we supposed to answer your question?
16:05:58
jmercouris
Shinmera: Xach answered it just fine, in a practical manner, effectively he said "no, it will not cause a slow down"
16:06:10
jmercouris
if there was some catch, like "on ECL it will be slow due to some xyz" he would have said it I assume
16:06:39
jmercouris
I'm not asking about the CL spec, I'm asking about a reasonable CL implementation whether it will have an impact in real life
16:07:09
jmercouris
These questions might seem stupid, but I've seen a lot of counter-intuitive things that have made me question my sanity, so I prefer to be safe than sorry
16:27:41
Xach
ebrasca: there are several ways. i like to use (logior (ash (aref array i) 8) (aref array (1+ i)))))
16:29:45
Xach
ebrasca: ok, then perhaps babel or similar would be better, with the appropriate encoding.
16:30:33
Xach
ebrasca: but underneath, babel or anything else will take two octets, create a 16-bit integer from it, and look up that integer in a table that maps to characters. you can do the steps yourself if you wish.
16:31:10
Xach
code-char is the table lookup function in CL. it will de facto (but not de jure) do what you want.
16:41:30
ebrasca
Xach: " The first 5, 2-byte characters of this entry. " in link http://wiki.osdev.org/FAT
17:03:58
ebrasca
pjb: I have 2 octet numbers, I have do it with (flexi-streams:octets-to-string vector :external-format :utf16)
17:38:12
jmercouris
Xach: I've only been working with CL for about 6 months now, it's not that I did not assume the answer to my question, it is rather that I do not want to assume anything
17:38:42
Xach
jmercouris: Your defensiveness displays many assumptions about the types of answers that you consider acceptable.
17:39:12
Xach
ebrasca: I don't think it's too hard to do - there are example patch sets in older pull requests.
17:39:14
jmercouris
Xach: I will admit, I am defensive, but that's because I don't like feeling like an idiot all the time
17:40:46
jmercouris
beach: The docs do it for me already, more than enough :D it is rather that I don't wish it from others. There are good and bad ways of instructing, and maybe I took things the wrong as is the nature of written text, but I felt attacked
17:41:41
beach
jmercouris: You are also observing the fact that IRC must necessarily be brief and to the point. It's the nature of the medium. That can be interpreted the wrong way sometimes.
17:44:59
beach
jmercouris: You are not being attacked. It is all for the purpose of making you understand. Don't take it the wrong way.
17:45:11
Xach
ebrasca: https://github.com/quicklisp/quicklisp-client/pull/60 has an example to follow in the future
17:47:23
beach
jmercouris: Oh, another problem. You have not been to ELS, so you have not met Shinmera. If you did, you would know.
18:29:39
jasom
jmercouris: print should go to the inferior-lisp buffer if you launched the lisp image from slime
18:31:33
jmercouris
if I invoke a function that prints from slime e.g. (my-function-that-has-a-print-in-it) it will print
18:32:28
jasom
so if the gui is running in a separate thread it should go to *inferior-lisp* rather than the REPL
18:34:23
random-nick
slime redirects stdout to the *inferior-lisp* but rebinds *standard-output* to a stream that goes into the SLIME buffer
18:38:35
random-nick
on some implementations, like SBCL, you can see that by looking at printed representation of *standard-output* with and without SLIME
19:05:54
beach
jmercouris: Now here is the thing I found the most amazing: If you treat the ignorant person with great respect, then learning does not seem to progress very quickly, but if you are a bit harsh (not insulting) I have discovered that newbies here stick around more often.
19:07:22
beach
To a professional educator like me, that observation is a bit strange. I don't know how to incorporate it into my teaching.
19:09:21
Xach
beach: I have observed that as well, but also mixed in with pointless or destructive harshness - it seems like a fine line that attracts sadists too
19:10:43
Xach
In a controlled, supportive environment it seems much safer to apply harsh lessons than in an open environment where people view it as license to abuse
19:12:25
Xach
This is applicable to lisp in the sense that lisp has attracted its share of helpful and hurtful harshness
19:57:02
jasom
a form of harshness that I deem unnecessary that I've seen particularly in the lisp community is to leave no mistake uncorrected. Someone new will ask an imprecise question and get told that their question is wrong, when it should be obvious what the question meant. Even just reversing the order of CORRECTION, ANSWER to ANSWER, CORRECTION would soften things up quite a bit.
19:58:53
parjanya
on the other hand, some people ask basic questions and still manage to be quite arrogant... the discussion about "on the fly" yesterdey shocked me a bit
20:02:38
dmiles
I try to not talk down to people... If my explaination leads to more questions then i expect to have to answer those questions as well.
20:08:04
dmiles
The other day someone asked me a question that was to tesg my knowledge of common lisp "How much do you know about how common lisp does make-instance?" I had know idea that was their agenda .. I thought they were asking me "what do you do differntly from common lisp?"
20:10:04
dmiles
well i thought the question was "how does your implementation vary from the normal ways impls make an instance and set slots?"
20:14:41
stylewarning
Are any folks in here generally interested in topics like writing, documentation, and community involvement; sort of like Steve Klabnik?
20:15:42
Xach
stylewarning: i don't know who steve klabnik is, but i am generally interested in those things
20:22:04
dmiles
for a shop to run well oiled it usualy takes two non-programmer people to document and interface to the community per programmer
20:26:03
dmiles
i had a programming job where one day a week i had to be interviewed by someone who wrote documentation and translated what i did to english, we had annother person who would get on a mailing list and fight for the design him and i agreed on. i am sure they wished i was all three people.
20:29:10
dmiles
however in the end, there other two people became the only two experts anyone ever heard of
20:30:50
warweasle
dmiles: That reminds me of an incident I had a few years ago. I had done pretty much all the work a part of a project, and I had another programmer who insisted it would not work because it wasn't object oriented. She said "I've worked on billion dollar projects..." I wish I had said: "I work on thousand dollar projects."
20:33:22
warweasle
dmiles: I've heard that "perfect" is the enemy of "done" but I think that "done" is the enemy of "profit".
20:35:14
dmiles
warweasle: admittedly since we adopting the comprimise bettween perfection and getting it done.. we tend to take on much bigger and complex projects (so they might still seem to take a longer time.
20:37:29
warweasle
dmiles: I found the system from "Thinking Forth" works best for me. I create a dictionary of Nouns and Verbs. (Functions and data structures). Then I create a library of functions and tools to solve similar problems to what I am eventually going to solve.
20:43:31
dmiles
planning things out ahead of time exposes a problem i had (I dont know if i still have, i wont tempt fate to find out either).. When i was very young i'd make text adventure games.. I'd get out graph paper and design the dungions and mazes first. all the neat riddles.. then all was left was boring grunt work i didnt feel like doing
20:44:18
dmiles
So now i realize i have to do the design *durring* in order to have the mental orgasms to keep the work going
20:44:55
warweasle
dmiles: What's fun is doing it backwards..."RunTheProgram()" -> "Step01() && Step02() && ..." -> "TurnServoMotor(degrees);"
20:45:31
warweasle
dmiles: I think that's using the computer to help write the code. You can't keep it all in your head.
20:46:00
parjanya
hah, that reminds me of a friend who wrote his entire programs before testing anything... he gave up programming quite quickly
20:47:10
warweasle
parjanya: There are two ways to write bug free code: 1) Test until there are no obvious bugs or 2) Make it so simple there are obviously no bugs.
20:51:47
warweasle
dmiles: One time I used flex and bison to do a large portion of my project. They hated the code it produced...but other than that there were no issues.
20:52:21
aeth
parjanya: That can sometimes work, even in CL. "Okay, now let's see what the compiler tells me I need to fix." followed by "Okay, now let's see what the runtime errors are."
20:55:46
White_Flame
regarding the text adventure stuff, that's where data-driven programming is nice
20:56:02
dmiles
the approach i use to avoid ever having to feel like i am doing "testing" is to use test driven development.. For every functionality i need i start a loop that continually (brutally) calls on what i need to happen but in a differnt window .. as i am typing the code out.. that test window is griping at me
20:57:51
White_Flame
literal data structures to define your world, then code which defers to the data
20:58:58
dmiles
(Like in prolog, we write in our Noun/Verb language, sometimes going in and explaining (in code) what we meant with our noun/verbs)
21:03:03
White_Flame
magic keys for when to perform tests on which game item, etc, and you can do your game logic right in the literal data without any hoops, just a few extra tests in the data processor
21:03:32
dmiles
So in other words "nested lists of strings & magic enums" and then making sure the interpreter you are writting supports all the features that you have been backfilling
21:04:06
White_Flame
I would consider it more of a world description graph than a programming language.
21:04:37
White_Flame
while there's not much of a techincal difference there, the view on it keeps it well contained and avoids general purpose programming feature sprawl
21:08:37
dmiles
i think lisp is the only other language that i can do that comfortably in. Though i used to try to do that still in several other languages. It just becomes crazy with all the extra typing
21:13:34
dmiles
White_Flame: indeed, now i am burried in these data statements https://github.com/TeamSPoon/prologmud/blob/master/prolog/prologmud/mud_builtin.pfc.pl#L600-L873
21:13:35
emaczen
given a C pointer ptr what would be the equivalent CFFI call to pass &ptr as an argument to a function?
21:15:41
White_Flame
dmiles: I'm sure you could either generate or infer all that from within prolog, from much simpler & more straightforward representations
21:17:23
dmiles
White_Flame: well that is what Prolog uses to generate the program .. the program is redesigned from that file