freenode/#lisp - IRC Chatlog
Search
7:00:09
White_Flame
I've used the cons cell for the purpose. It tends not to be just the smallest in memory footprint, but in code too
7:02:54
shka
beach: i need to track ownership for shared objects, owner can mutate his object, rest has to copy, i figured that i can stick gensym into box and then add this box to every object. Finalizer of owner will set content of box to nil to indicate that ownership can be taken by any other object.
7:09:46
shka
beach: anyway, it is not that complicated, and all it boils down is to side effect containment. Combined with lazy approach it gives optimized functional containers.
7:11:42
shka
beach: if you are interested in this: http://hypirion.com/musings/understanding-clojure-transients
7:13:27
shka
(that is: it does not prevent code from working, but it is a little bit pointless at certain point)
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