freenode/#lisp - IRC Chatlog
Search
2:55:43
Zhivago
It's important to understand that atoms are essentially syntactic elements in lisp, rather than data types.
3:35:09
whoman
Zhivago, they cannot be divided further, in the sense. but what is there to consider aside from s-exps? if atoms build the structure, when are they not meaningful that is?
3:46:53
Zhivago
Atoms form part of the structure of s-exps. They're not meaningful when you're not talking about s-exps.
3:47:33
Zhivago
e.g. '(a b c) might be an s-exp (in which case, talking about atoms is meaningful) or it might just be a list of three symbols (in which case, talking about atoms is not meaningful)
4:09:31
ricky_ricardo
So an expression can't return an expression? Is that right? (just learning at the moment)
4:10:03
ricky_ricardo
Is it correct for me to say that a macro is similar to an expression, but it can return expressions?
4:10:44
White_Flame
a macro itself only differs from a function in that its parameters come in raw & unevaluated, in their source code form\
4:11:13
White_Flame
other than that, they work exactly the same as functions, returning data which should be in the form of source code to evaluate
4:11:55
White_Flame
a macro can return the _list_ (+ 1 2 3), containing 4 elements (one symbol, 3 numbers)
4:21:57
beach
ricky_ricardo: An expression can not return an expression, simply because "expression" in Common Lisp means data made up of atoms and CONS cells, so they can not return anything. Only functions (including macro functions) can return things.
4:21:59
beach
Now, technically, since a function is an atom and an expression can contain any atom, it is possibly for that particular kind of expression to return something when it is called, but that is not typically how the term "expression" is used.
4:24:08
marvin2
if you passed quoted sexps to a function, which returned a sexps (that is passed to eval after the call), is there any practical difference between that and a macro?
4:25:19
beach
marvin2: One difference is that a macro function takes an environment object that can be used to macroexpand sub-expressions.
4:26:32
Zhivago
ricky: You can think of that as how a macro is essentially implemented -- the remainder being protocols on when that gets applied.
4:33:00
jasom
vtomole: garbage collection, compiler, allows function-redefinition (with some restrictions).
4:34:07
vtomole
Of course, im just trying to figure out how it is implemented on a Lisp that is bootstrapped. I'm not sure how to phrase my question...
4:35:04
beach
vtomole: By "a Lisp that is bootstrapped", so you mean that it is written in some other language?
4:35:16
jasom
vtomole: I can think of two lisps in which the GC was implemented entirely in its self, and neither of them are common lisps
4:35:52
beach
vtomole: Ah, then you "just" have to generate machine code that does all the things that the system needs.
4:37:30
vtomole
jasom: Mezzano's runtime is all lisp: https://github.com/froggey/Mezzano/tree/master/runtime
4:37:58
jasom
https://github.com/froggey/Mezzano/blob/master/runtime/runtime-x86-64.lisp <-- it's a stretch to call that lisp
4:38:12
Zhivago
libc is part of a C implementation -- if it's part of the runtime depends on implementation choices.
4:38:55
Zhivago
vtomole: Sure -- and this is part of why longjmp doesn't guarantee to free up VLAs, for example.
4:40:53
Zhivago
There are things that need to be done -- organizing i/o, memory management, dynamic linkage, etc, which are generally considered to be part of the run-time of a system. If you're using a different definition, you probably need to talk about it.
4:42:05
jasom
glibc does in fact implement much of the C runtime; other parts are (possibly) intrinsic to the compiler (e.g. alloca())
4:42:54
whoman
we can write C that doesnt link to libc, cant we? runtime would add extra code. well any library is a runtime then
4:42:54
jasom
just don't type-pun without unions or have signed integer overflow (both of which you can do bare metal on most archs)
4:43:27
jasom
whoman: and I can write lisp code that doesn't ever CONS, so doesn't need at least the GC part of the runtime...
4:44:16
whoman
well lisp is kinda executed at runtime so it needs something before any code, i think i would call that a runtime
4:44:37
jasom
whoman: what about all the C code that runs before main (clear the BSS, initialize the heap, &c.)
4:45:21
Zhivago
There is nothing fundamentally different between C and lisp run-times, except for the protocols required (e.g., GC vs malloc, class-of, etc).
4:48:07
whoman
C's malloc could be avoided, though. you can write your own in your C code. i think C's runtime is minimal tiny boot header to find main and dlink stuff to preload dynamic libs
4:48:08
Zhivago
Sure, and I'll point out that they're still not portable. How do you portably implement FILE, for example?
4:48:28
Zhivago
C's malloc cannot be portably avoided unless you want to limit yourself to auto storage.
4:49:01
whoman
even in objective-c i wrote my own and almost didnt need the built in runtime (which the standard libs require)
4:49:11
jasom
Zhivago: gtk and qt are both called "portable" but they acheive that by implementing code specifically for different targets
4:50:05
Zhivago
jasom: You're confusing gtk being portable, with things that depend on gtk being portable.
4:51:24
Zhivago
And C has runtime for longjmp, and handling floating point error modes, and i/o, and memory management, and character locale support, and ...
4:51:45
whoman
ok- "whatever parts of the development system required for executing what is developed with that system" - runtime. lisp needs the whole image then, it is the runtime. ok i understand now
4:51:59
Zhivago
There's really no fundamental difference, except in terms of which interfaces they provide with which semantics.
4:52:22
Zhivago
lisp needs nothing more than what lisp needs, just like C needs nothing more than what C needs.
4:52:44
Zhivago
In lisp, (class-of x) needs to work -- how it works can vary -- it may need no run-time support at all.
4:53:10
jasom
whoman: there are many lisp implementations that can create images without parts of the runtime (e.g. the compiler) to make smaller images
4:54:08
whoman
well now we got the word 'implementation' - for eg. GNU C compiler, one can swap out the c library. what do we call an implementation of C
4:54:52
whoman
jasom, but the images is the development environment, like needing a web browser to execute html.
4:55:06
Zhivago
Whatever you swap it out with will need to be tailored specifically to work as part of gcc.
4:55:58
jasom
whoman: sbcl creates a base image that is loaded; you could swap it out with any compatible image just as you can swab glibc for musl
4:56:17
whoman
Zhivago, yeah the C code swapped of course should work as a valid replacement part =)
4:56:17
jasom
the fact that nobody has written such an image is orthogonal to the fact that it is technically possible
4:57:09
jasom
whoman: it's not even just GCC code, it's GCC code with a particular ABI (32-bit PowerPC had 3 different calling conventions in use on different OSes at one point)
4:57:34
whoman
Zhivago, but we can swap the library with other compilers after a produced binary of course. the compiler isnt needed
4:57:40
Zhivago
Probably the biggest issue for CL is that it lacks a declarative program definition.
4:57:48
jasom
whoman: the lisp runtime is much larger than the C runtime, *and* it is much more tightly coupled with the compiler due to garbage collection.
4:58:25
jasom
whoman: so writing a new runtime for sbcl would be much harder and less useful at the same time.
4:58:48
whoman
well, i think lisp *is* the runtime. and i think that C has a small bootstrap. what would the smallest C binary be produced, contain? just library linking info?
5:00:28
jasom
whoman: the smallest C program would be "int main() { return 0; }"; it's an implementation-detail how much runtime is needed to execute that
5:00:36
Zhivago
No. The C compiler realizes an implementation of a C program that is runnable on a target machine.
5:03:11
White_Flame
there's mechanism to call main, take its return value and pass it back to the OS. However, as has been mentioned above, that could conceivably be inlined with the bootstrap and collapse down to never actually entering a "C runtime environment"
5:03:16
whoman
well, this is what i think: for C compiled without optimizations, a simple return 0 in asm is likely produced. lets say we can produce the same unoptimized program from a pascal compiler without runtime. the binaries would be the same or not?
5:03:49
Zhivago
If hand compiled by the same person, why not? They're the same program, after all ...
5:05:10
whoman
i grew up with C, just trying to establish my beliefs about it since i havent really challenged them before (thank you) ^_^
5:05:31
jasom
pascal on 16-bit x86 traditionally ordered the function arguments in the opposite order from C on the stack
5:05:42
whoman
White_Flame, aha true. because reduced to functions, unoptimized, any compiler is just asm dialect then.
5:08:13
jasom
whoman: the C standard is very different from C implementations, sometimes surprisingly so. Furthermore C implementations tend to try very hard to be compatible with whichever C implementation was used to compile the operating-system libraries (for obvious reasons), so multiple C compilers on the same OS happen to be compatible; this isn't required though.
5:08:17
White_Flame
again, for tiny degenerate cases, where there's provably no other callers, the conventions can be ignored
5:08:38
jasom
e.g. the word "memory" does not appear anywhere in normative parts of the C99 specification.
5:09:30
White_Flame
since no in-language mechanism sets that up, it's the runtime that establishes that before any function is called
5:09:39
White_Flame
however, a runtime can also unload itself by the time the userspace code actually runs
5:10:16
jasom
whoman: no, it just changed READ, which is a library function, not part of the runtime :P
5:11:02
whoman
i mean at expansion time sorry =) that is, adds a level of language scope for every macro level. if that makes sense.
5:11:25
White_Flame
unless you specifically meant that "*c* function-calling needs to run-time at all"
5:11:55
jasom
whoman: but if you run a tree-shaker, it's possible that your runtime won't even include the function READ.
5:12:07
Zhivago
white_flame: What I mean is that there does not fundamentally need to be run-time support for function calls in C (or any other language).
5:12:40
whoman
hmm. implementation level can be different all the time. forth does its own stack doesnt it? it can be written in C. C could also be written in forth or whatever. just levels of implementations i think , i cant find the line between one and another now
5:12:46
Zhivago
Although there does need to be run-time support for constructing function calls in CL for programs which use that.
5:13:24
White_Flame
the program counter doesn't enter any runtime utility during a function call/return mechanism itself, right
5:13:30
whoman
jasom, unless it is referenced in the code which the tree shaker shook ? why would it shake out used things. lets imagine no shaking!
5:14:05
White_Flame
well, I can think of one language where the runtime is invoked for function calls: forth
5:14:19
jasom
whoman: just mentioned that as a parallel to "C that isn't linked with libc"; teasing out the runtime from the standard-library is ill-defined
5:15:40
whoman
objective-c too, for method invokation, uses runtime/library (which can be swapped, even the way objects are malloc'd can be rewired) for class lookup and such. i am not sure if even c++ has a runtime for method calls
5:15:47
Zhivago
That's because he still hasn't quite understood that the C standard library is part of the C implementation, and is not a C library.
5:16:41
jasom
whoman: C++ non-virtual methods are called just like any other function (fixed functions at link time). Most C++ implementations give objects with virtual methods a table, and every object has a pointer to that table
5:16:45
White_Flame
though certainly there are parts of the C stdlib that could be built up as standard C functions on top of a "core" runtime, like string manipulation, higher-level I/O, etc
5:16:53
Zhivago
The only really important thing to take away from this is that there is nothing fundamentally special in the difference between C, lisp, etc, runtimes.
5:17:26
White_Flame
because many programmers don't deal with the lower level stdlib calls, but mostly with those which would have a pure-C implementation, I could see that assumption as being a normal library
5:17:49
Zhivago
white_flame: An implementation is free to do that, or free to apply special optimizations. This is part of why you may not replace standard C functions with your own code.
5:22:12
whoman
well. C doesnt appear at runtime. but lisp does. as garbage collection, as exceptions, as image loading and code loading. C isnt there anymore when the binary is running. sorry i dont think C has the same kind of runtime as lisp. in practice very different.
5:22:43
whoman
the bare minimum of stuff needed to put into an executable binary is one thing. all binaries have that
5:25:20
flip214
whoman: but the C runtime eg. catches signals _during_syscalls_ and retries them, for example.
5:26:29
Zhivago
C has no calling convention. A C implementation may have zero or more calling conventions.
5:26:40
White_Flame
also, while C stdlib might shuffle heap data structures around during free(), so you might consider that user-invoked rather than autonomous, the same thing happens in Lisp, where GC is usually invoked during allocation, instead of on its own
5:27:07
Zhivago
whoman: You're delusional. C does appear at runtime as memory management, as non-local transfers, as dynamic library linkage, as ...
5:27:31
Zhivago
whoman: While the details differ, the fundamental problems remain similar, as to the implementation strategies.
5:29:05
White_Flame
at least, there's semantic categories you can lump various parts of the runtime into, but that's about it
5:29:27
whoman
the C runtime is just a library. lets not call people names, we already have enough trouble with the terminology we have going.
5:29:35
Zhivago
C defines the C Abstract Machine. Whatever parts of the CAM a C implementation doesn't realize at compilation time will be realized at run-time, and be part of the run-time overhead.
5:29:57
Zhivago
whoman: You're wrong. The C runtime is not just a library. You're just not listening.
5:30:32
White_Flame
and there's a difference between "C the language" and "C in a particular implementation", or even "C in common implementation strategies"
5:31:20
whoman
i do not know how i have offended you sir but i notice now that you have begun to take this discussion personally. like i said i am trying to clarify some terms for myself, that was all. i have thanked you earlier already but i thank you again.
5:32:28
Zhivago
whoman: You just keep repeating the same errors over and over without appearing to learn.
5:33:34
White_Flame
C is defined in such a way that it _should_ be able to collapse down to a very low-level, low-overhead model, but there's no guarantee of that
5:33:39
whoman
Zhivago, i think you are trying to call me stupid because you are jealous when i said i grew up on C. what does that mean to you? or is it something else? i do not wish to continue to "learn" with you. not the way you want.
5:33:54
White_Flame
therefore the assumptions of the stdlib you have tend to be around what implementations are usually like, not what C allows/defines
5:34:23
Zhivago
whoman: If you grew up on C, answer this question. char d[3]; What is the type of d?
5:34:34
whoman
White_Flame, well, i remember the days when glibc was being rolled out, and i think it was able to be swapped without relinking a binary, afaik
5:36:18
whoman
not a wierd fraternity test. sorry i failed. i would rather not want to pass that. lets just grow up ok?
5:36:38
Zhivago
Well, like I said, I suspect that the real problem is that you don't understand C very well.
5:36:53
whoman
i didnt think it was serious at first so i avoided it. i was busy learning and exploring and figuring stuff out.
5:37:13
Zhivago
And that believing that you do understand C very well is preventing you from learning.
5:37:21
whoman
good for you, that does not affect me. i have no reason to prove anything to you. can we continue ? i am going to read mezzano code for a bit. thanks for the link
5:37:50
beach
Very few people have actually read the C standard, so there are a lot of (usually incorrect) assumptions about what C really is.
5:39:54
whoman
no im good. i know what i know. but i didnt know that a big part of the discussion was hostile. which i cant learn with
5:41:20
Zhivago
No, atoms are everything other than lists -- but you're right that they're not datastructures, they're syntax.
5:46:47
White_Flame
string theory vocabulary applied to programming languages would really mess up character-string naming
5:48:19
Zhivago
Well, we could have a four hour discussion about why character isn't reasonable, if you like.
5:48:32
White_Flame
and because of BASIC as a kid, I often pronoune the "$" character as "string". eg "A$" is "A-String"
6:04:19
Zhivago
One thing I have come to appreciate more is having things like variables lexically distinct from syntactic elements.
8:38:05
ParrotSec_
i have a server list in a specific format and need to filter out specific servers without loosing whatever content is below there server address/title, for example "stanzas\ninfo1...\ninfo2...\nstatus...\nadmins...\nusers...\ntotal_logins...\nban_list...\nwhite_list...\nblacklist...\n" and so on for each server, how would i do so and what "tool" would be best suited for the task
8:39:10
beach
ParrotSec_: That's not a "list". It is a single string where entries appear to be separated by newlines.
8:40:12
beach
ParrotSec_: If you can't influence that data structure, you will need to move contents around to "compact" the entries.
8:42:45
ParrotSec_
say every server name contains <servername>:80 or something similar that is unique from its contents
8:43:34
beach
If all you have is a single string, you are going to have to move characters around, and REPLACE is probably the best tool for that. But what you have is not a great data structure for this kind of manipulation. Of course, if the length of the string is not too great, then it probably won't matter much.
8:53:58
beach
ParrotSec_: I gave you the tools. I am afraid I don't have the time to implement it for you. But if you have more questions, I'll be happy to answer them if I can.
9:07:28
beach
ParrotSec_: Like I said, I gave you the tools. I am afraid I don't have the time to implement it for you. But if you have more questions, I'll be happy to answer them if I can.
9:10:21
beach
You would then have to search for the position of the server name, and the position of the first following double newline. Given those positions, you would move all the characters following the last of those two position to the first of those two positions. No?
9:11:38
beach
Or perhaps you want to extract an entry? Same thing. Find those two positions and use SUBSEQ to extract the entry.
9:24:56
beach
For starters, it would be good to know exactly what it is that you want to do, i.e. what you mean by "filter out".
9:25:38
beach
Common Lisp is a general-purpose Turing-complete language, so unless you are trying to solve some undecidable problem, it should be possible.
9:26:49
beach
ParrotSec_: I'll leave that to someone who feels he or she has the time to wade through all that stuff, which is unrelated to Common Lisp on top of that.
9:27:29
phoe
and you are unwilling to explain what it does and instead tell me to read it and guess it myself.
9:27:44
ParrotSec_
the problem lies with the the second read loop "server_port80/stanzas is ACCAPTABLE
9:32:03
phoe
It seems that a person with a nickname candide is an operator of #bash. You can query them in private and ask them the question.
9:57:47
dim
2: (SB-THREAD:CONDITION-WAIT #<SB-THREAD:WAITQUEUE Anonymous condition variable {10044081F3}> #<SB-THREAD:MUTEX "Anonymous lock" (free)> $
10:05:22
dim
sbcl 9477 root 10u IPv4 149607 0t0 TCP localhost.localdomain:52316->localhost.localdomain:mysql (CLOSE_WAIT)
10:12:22
p_l
anyone using AllegroCL on windows and could suggest a way to make it open different browser than IE for everything in docs?
10:15:32
jonssons
I'd like to thank the author of "Practical Common Lisp" for open sourcing his book with monetary value. However, I do not want to pay taxes by purchasing the book. Any way I can send money to the author?
10:15:58
p_l
flip214: yes (Chrome), and there appears to be an option of embedded browser when writing CG GUIs
10:17:32
flip214
I'd suggest to open regedt32, and look in HKLM/Software/Classes/.html/OpenWithProgIDs
10:22:27
flip214
sorry, I thought this to be more of a windows question and not so distinctly for ACL