Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
robotoad has joined #lisp
ah_ has joined #lisp
Kundry_Wag has quit [Ping timeout: 268 seconds]
dacoda has quit [Ping timeout: 268 seconds]
ah_ is now known as akoana
<griddle>
Does anyone know of a good reading source for how lisp JIT compilers or ahead of time compilers work? I'm mostly interested in how scoping is implemented
<Bike>
what does scoping have to do with jit?
<griddle>
dynamic scoping
<Bike>
i still don't understand.
<Bike>
(i'm a compiler dev)
<griddle>
I guess, when you define what is essentially a "curried" function right?
<Bike>
No?
<griddle>
(lambda (x) (lambda (y) (+ x y)))
<griddle>
how does the inner code know about the outer x in a compiled lisp?
<Xach>
griddle: the book Lisp in Small Pieces goes into great detail on the topic
<Bike>
that would actually be a lexical binding, not special.
<Xach>
it starts simple and slow and gets more complex and fast in a nice didactic way
<Bike>
The most obvious way is that the (lambda (y) ...) produces a "closure", which stores the binding of x along with the function.
<Bike>
LiSP is indeed good for this.
<griddle>
so thats just some data structure on the stack or something?
<Bike>
not necessarily on the stack, but yes.
Lycurgus has left #lisp ["Deus Ex"]
nchambers has joined #lisp
<griddle>
and you'd have some kind of feature to lookup information in that structure? Or would you know ahead of time where in the structure that value lives
sjl has quit [Ping timeout: 250 seconds]
<Bike>
If it's compiled, no reason not to do the latter.
logicmoo has quit [Ping timeout: 250 seconds]
flazh has quit [Ping timeout: 245 seconds]
smokeink has joined #lisp
flazh has joined #lisp
smokeink has quit [Remote host closed the connection]
Mr-Potter has quit [Quit: Leaving]
<aeth>
griddle: Naively, there could just be a defstruct to create a structure-object for every scope except the global one. Gensym its name to avoid the problem with redefinition.
<jasom>
griddle: In a compiled implementation, a lexical binding is just a mapping from an identifier to a location (i.e. lexical bindings do not need to exist in a meaningful way at runtime, only at compile time).
<aeth>
(I say structure-object because they're simpler and they can have inline accessors, or something like that. i.e. the location is known to the compiler at compile time)
<aeth>
(well, at least the offset, since if it's on the heap the GC can move it around)
<Bike>
i think if griddle doesn't know what a closure is they might be unfamiliar with defstruct.
<griddle>
I've implemented a lisp interpreter in the past, I'm just looking into how things like lexical scoping is done in a JIT if you can define different variable names at runtime
<aeth>
Bike: The parens are for everyone else
<jasom>
what usually happens is compilers have an expensive binding implementation that works in all cases and lives on the heap, but then a fast binding implementation for when a variable is never closed over (or is only closed over by lambdas that don't escape the heap).
<Bike>
griddle: i don't think being jit versus aot matters here.
<jasom>
griddle: for the most part, compiled implementations of lisp do not allow manipulation of lexical bindings at runtime
<griddle>
oh ok
<jasom>
griddle: the standard itself provides no such mechanism anyways
<jasom>
dynamic bindings have a defined lifetime at runtime, and those can be accessed via symbol-value.
<griddle>
yeah in past I've just had a really slow implementation with a recursive scope lookup of dynamic bindings
<griddle>
I never really gave a fixed time approach any thought
<jasom>
griddle: for variables that are never closed over, the value can be stored in a register. For variables that are closed over by lambdas that don't escape the dynamic scope, it can be the stack. For variables that are closed over by lambdas that might escape the dynamic scope, they must be stored on the heap.
<jasom>
griddle: I think you have dynamc and lexical backwards. Dynamic bindings are trivial to implement with global variables and unwind-protect.
<aeth>
jasom: Absolutely (re: expensive and fast implementations). The variable isn't even guaranteed to exist unless (debug 3)
<aeth>
On the plus side, that means that there's no (runtime) cost to naming intermediate steps if you want to
<jasom>
griddle: if you're familiar with compilers for less dynamic languages, all the approaches used there for temp allocation work just fine for any variables that are never closed over.
<jasom>
anyway I have to leave
elfmacs has joined #lisp
<griddle>
awesome thanks for all the help
<verisimilitude>
Are you familiar with the concept of Phantom Stacks, griddle?
<griddle>
looking at the paper now. tldr?
shifty has joined #lisp
<verisimilitude>
Well, I enjoy the colorful phrasing RMS used, comparing the stack to a government agency.
<griddle>
aptly, lol
<verisimilitude>
Put simply, treat the stack as a stack until it can no longer be treated as a stack, in which case it was never really a stack at all.
<griddle>
so treat it as a "heap" after a certain point and find a new one?
<verisimilitude>
Treat it as a heap if the stack discipline would be violated.
<griddle>
very interesting
arescorpio has joined #lisp
_whitelogger has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
thijso has quit [Ping timeout: 246 seconds]
arescorpio has quit [Remote host closed the connection]
stux|RC has quit [Ping timeout: 246 seconds]
permagreen has joined #lisp
beach has quit [Read error: Connection reset by peer]
wglb has joined #lisp
wglb has quit [Remote host closed the connection]
wglb has joined #lisp
flazh has quit [Ping timeout: 268 seconds]
wooden has quit [Read error: No route to host]
elderK has quit [Quit: WeeChat 1.9]
notzmv has quit [Ping timeout: 244 seconds]
elderK has joined #lisp
flazh has joined #lisp
zmt01 has joined #lisp
gendl has quit [Ping timeout: 252 seconds]
zmt00 has quit [Ping timeout: 264 seconds]
rnmhdn has joined #lisp
rumbler31 has joined #lisp
atgreen has quit [Remote host closed the connection]
atgreen has joined #lisp
nchambers has quit [Quit: WeeChat 2.2]
dmiles has joined #lisp
notzmv has joined #lisp
PyroLagus has quit [Quit: ZNC / WeeChat]
arescorpio has joined #lisp
marusich has joined #lisp
PyroLagus has joined #lisp
pjb has quit [Ping timeout: 268 seconds]
jcowan has joined #lisp
<jcowan>
Can someone give me a brief tutorial on restarts?
khisanth_ has quit [Ping timeout: 246 seconds]
<jcowan>
I understand the idea of conditions with restarts, such that the condition-catcher can choose which restart to invoke, do a snippet of code set up by the signaler, and then either return or do a non-local exit
<jcowan>
but I don't understand what the rest of the restart API is for.
Essadon has quit [Quit: Qutting]
robdog has quit [Ping timeout: 250 seconds]
dddddd has quit [Remote host closed the connection]
resttime has joined #lisp
khisanth_ has joined #lisp
<Bike>
so, what, the :interactive and the :report and the :test?
equwal has joined #lisp
dmiles has quit [Ping timeout: 250 seconds]
logicmoo has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
<jcowan>
Bike: I was thinking of restart-bind and friends, the ones that push the restarts into the dynamic environment
<jcowan>
as opposed to attaching them directly to a condition
<Bike>
well, probably restart-case expands to restart-bind, actually. the condition association is a separate thing.
pjb has joined #lisp
<Bike>
in sbcl at least, with-condition-restarts just puts the condition on a list stored within the restart.
<Bike>
(so you can't get to the restart from the condition, e.g.)
<rnmhdn>
any thoughts on a 1:30 h interesting talk related to functional programming?
<Bike>
usually handler-bind and resetart-bind just shove the thing on an internal dynamically bound list
<Bike>
and then invoke-restart or whatever just calls a thunk
<Bike>
a thunk that, for restart-case, will do a nonlocal exit
<Bike>
you can probably suss it out from the macroexpansion, really.
<jcowan>
Yes, I get that that's what it *does*, but what is it *for*?
<Bike>
oh, sorry, i misunderstood.
<Bike>
restart-bind i've never seen anyone use. restart-case though...
<jcowan>
np, I'm not being very clear, I know.
<Bike>
it's basically for when you want to recover from an error, i guess
<Bike>
like...
<Bike>
you can do an ASSERT, and when an ssert fails it'll pop up the debugger and ask for new values to use
<Bike>
so that you can then pass the restart
<Bike>
that's kind of nice sometimes
<Bike>
then it'll just resume after the assert.
<Bike>
(with those new values)
<jcowan>
But how does the caller know which restarts the signaler can handle at all?
<no-defun-allowed>
if i'm destructuring in a loop for clause, can i give the destructured values of-types?
<jcowan>
no-defun-allowed: Probably with `the`
<no-defun-allowed>
true
elfmacs has quit [Ping timeout: 252 seconds]
robotoad has quit [Quit: robotoad]
milanj has quit [Quit: This computer has gone to sleep]
SaganMan has joined #lisp
robotoad has joined #lisp
akoana has quit [Quit: Leaving.]
arescorpio has quit [Quit: Leaving.]
gravicappa has joined #lisp
hectorhonn has joined #lisp
<hectorhonn>
good morning
hectorhonn_ has joined #lisp
hectorhonn has quit [Ping timeout: 256 seconds]
hectorhonn_ has quit [Client Quit]
hectorhonn has joined #lisp
jkordani has quit [Read error: Connection reset by peer]
<jcowan>
I push some restarts on the stack and invoke some code that eventually calls assert. The user, or I on the user's behalf, chooses a restart, its code is executed, and the assert returns. But presumably the caller of the assert was doing that because some assumption that it depends on is being violated, and what is the caller to do when unexpectedly he gets control again?
<jcowan>
Bike ^^
Arcaelyx has quit [Read error: Connection reset by peer]
atgreen has quit [Ping timeout: 240 seconds]
<Bike>
i think you're misunderstanding something. control won't return from the assert unless the restart was set up in the assert.
Arcaelyx has joined #lisp
<Bike>
if you have like, (restart-case (... (assert ...) ...) (foo ...)) and select the foo restart when the assert fails, control returns from the restart-case. the assert is abandoned.
<Bike>
i'm pretty sure. little tired admittedly
<jcowan>
Hmm. Well, thanks, maybe I can figure it out from there.
atgreen has joined #lisp
<Bike>
with restart-bind you can have a restart that doesn't transfer control like that or at all, but i honestly have no conception of why anyone would want that, so i can't help there.
snits has quit [Remote host closed the connection]
lose has quit [Ping timeout: 250 seconds]
<jcowan>
I'll study the example at clhs restart-case
phax has joined #lisp
<verisimilitude>
You may be interested in the similarities between Common Lisp condition handling and PL/I and Multics, jcowan, if that's something you already find interesting.
phax has left #lisp [#lisp]
graphene has quit [Remote host closed the connection]
lose has joined #lisp
makomo has quit [Ping timeout: 240 seconds]
graphene has joined #lisp
Selwyn has quit [Ping timeout: 250 seconds]
<jcowan>
verisimilitude: I haven't looked at PL/I condition handling in years
<jcowan>
It appears to be plain exception handling with resumption semantics, like Scheme or Mesa (both of which I have used). But restarts seem to be only in CL and Dylan.
rnmhdn has quit [Ping timeout: 250 seconds]
nchambers has quit [Quit: WeeChat 2.2]
akoana has left #lisp [#lisp]
notzmv has quit [Ping timeout: 272 seconds]
notzmv has joined #lisp
vlatkoB has joined #lisp
Bike has quit [Quit: Lost terminal]
slyrus1 has joined #lisp
Oddity has joined #lisp
marusich has quit [Ping timeout: 250 seconds]
Lycurgus has joined #lisp
lose has quit [Ping timeout: 264 seconds]
dale has joined #lisp
_whitelogger has joined #lisp
Lycurgus has quit [Ping timeout: 244 seconds]
akoana has joined #lisp
yvy has joined #lisp
<akoana>
(quit
akoana has quit [Quit: Leaving]
hectorhonn has joined #lisp
dale has quit [Quit: dale]
<hectorhonn>
the primary unit of abstraction in java is classes. what is the primary unit of abstraction in lisp?
<beach>
It is called a "protocol" and it is not a first-class object.
<hectorhonn_>
beach: ok, let me read that up. thanks!
hectorhonn has quit [Ping timeout: 256 seconds]
<splittist>
good morning
hectorhonn_ has quit [Client Quit]
<beach>
Hello splittist.
elfmacs has joined #lisp
hectorhonn has joined #lisp
<hectorhonn>
beach: i see its a chapter 5. looks like a good book, how do i get to the other chapters?
<beach>
You wait until I finish the book and then you buy it from Amazon.
<no-defun-allowed>
beach: irrelevant, but how do you typeset those nice looking function/class/gf description lines in your documentation on closos and sicl? Is it something you made yourself or is it a common LaTeX library?
<hectorhonn>
:O
<hectorhonn>
you run the site?
<beach>
hectorhonn: Yes, metamodular is my site.
<hectorhonn>
beach: impressiveee
themsay has joined #lisp
<beach>
no-defun-allowed: I think it is just \begin{verbatim}...\end{verbatim}
<beach>
no-defun-allowed: Oh, wait.
<beach>
no-defun-allowed: I am using a small library that came with the CLIM documentation called specmacros.tex
<beach>
no-defun-allowed: You can find it in the SICL repository.
<beach>
I suppose Scott McKay wrote it.
<hectorhonn>
beach: erm, what's the take away from chapter 5? i'm don't feel like i've learnt anything
<hectorhonn>
beach: so, the primary unit of abstraction in lisp is also classes? and generic functions?
<no-defun-allowed>
beach: thanks, I'll go take a look at it.
<hectorhonn>
beach: for example, suppose i want to write a parser manually, as an exercise. should i represent the AST as a defclass?
<beach>
Yes.
<hectorhonn>
beach: instead of a list?
<beach>
You are talking representation.
<beach>
The very idea of a protocol is to avoid talking about representation.
<beach>
You were asking about abstraction.
<beach>
Abstraction means that you explicitly avoid talking about representation.
<hectorhonn>
isn't abstraction the same as representation?
<beach>
It's the very opposite.
<beach>
In a protocol, you talk about abstract types and abstract operations.
<no-defun-allowed>
hectorhonn: abstraction is how you hide representation.
<verisimilitude>
I'd think symbols and lists and functions and that manner of thing are the primary abstraction of Common Lisp.
<beach>
verisimilitude: You would think wrong.
<verisimilitude>
You could boil any language down to ``protocol'' as the primary unit of abstraction, if you wanted to.
<verisimilitude>
That's just boring.
<hectorhonn>
sorry, coming from java oop shop, haha
<verisimilitude>
Common Lisp has an OO system called CLOS, hectorhonn, but you can rather entirely ignore it if you feel like it.
<hectorhonn>
let me think of a way to rephrase
<beach>
verisimilitude: That's not very good advice.
<Inline>
morning
<beach>
Hello Inline.
<Inline>
heya beach :)
<verisimilitude>
Do you know what no good Common Lisp programmer can ignore, beach?
<verisimilitude>
It's macros.
<verisimilitude>
Macros are more important to Lisp than any OO system.
<verisimilitude>
Macros rely on the homoiconic nature of Lisp, related to its lists. Lists are important for abstraction.
rnmhdn has quit [Ping timeout: 268 seconds]
ggole has joined #lisp
<hectorhonn>
i guess what i really wanted to ask was, for example in java, i would write a XyzToken class for each type of token parsed, with a common base class Token, maybe with some common and specific operations. Then another class to represent a list of Tokens. so i have somehow represented (or abstracted?) this idea of "token" in the program,
milanj has joined #lisp
<hectorhonn>
In haskell there would be a record sum type, and several functions that can act on the record. then another record type to represent a list of tokens
<hectorhonn>
What would be a good way to do it in CL?
notzmv has quit [Ping timeout: 246 seconds]
<beach>
Those are representations, not abstractions.
yvy has quit [Read error: Connection reset by peer]
<jackdaniel>
hectorhonn: Common Lisp doesn't give you a recipe how to represent your program
<jackdaniel>
(i.e it is less opinionated how you should write your program than Java or Haskell)
<hectorhonn>
ok, i guess i meant representation, haha
<beach>
In Common Lisp, you would choose whatever is appropriate in terms of performance. It could be symbols, lists, hash tables, arrays, standard objects, whatever.
<hectorhonn>
jackdaniel: i see, then what options does CL give me?
<jackdaniel>
so while having "the one way" how to do things is comfortable it is also limiting
<verisimilitude>
Just use a list of lists or structures or what have you, hectorhonn.
notzmv has joined #lisp
<jackdaniel>
you may arrange your program around protocols (like in haskell), you may create a class hierarchy with functions operating on it (like in Java), or you may write your own dsl with macros (like verisimilitude suggests). I think that finding the programming style which suits you best is a hard but worthwhile endavour
<verisimilitude>
Your main options are making a class for tokens which you instantiate, making a structure representing tokens, or just using an informal representation, such as a list of whatever you need, hectorhonn.
<verisimilitude>
Until you have a good idea of what you're doing, the list of whatever you need option is the easiest and most flexible.
angavrilov has joined #lisp
<jackdaniel>
i.e there are libraries in Common Lisp which are referentially transparent (something often praised among programmers who fancy functional programing), but there are also many libraries depending heavily on OO
rumbler31 has quit [Remote host closed the connection]
<jackdaniel>
minion: tell hectorhonn about paip
<minion>
hectorhonn: paip: Paradigms of Artificial Intelligence Programming. More about Common Lisp than Artificial Intelligence. Now freely available at https://github.com/norvig/paip-lisp
<jackdaniel>
this book presents a nice overview of techniques you could use with Common Lisp
<jackdaniel>
minion: tell hectorhonn about pcl
<minion>
hectorhonn: have a 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).
<Inline>
where is AIM now ?
<Inline>
the successor to paip
<jackdaniel>
and this book is more concentrated about mainstream (these days) style of CL programming heavily depending on CLOS (but starts from basics)
<jackdaniel>
I don't know what AIM is (never heard of it)
<verisimilitude>
I assume he means AOL Instant Messager.
<verisimilitude>
That's the only AIM I'm aware of.
<hectorhonn>
haha... ever get that feeling when trying to start drawing something on a blank canvas? CL gives me that no restriction feeling
<verisimilitude>
Lisp is best, I think, when you don't quite know what you're doing yet, hectorhonn.
<jackdaniel>
hectorhonn: if you decide to listen to my advice, I'd recommend starting reading PAIP
<verisimilitude>
There are plenty of better languages if you know exactly what you're going to be doing, but Lisp is good for exploration.
<jackdaniel>
since it provides many case studies analyzing and evolving code bit by bit towards the sketched goal
ealfonso has quit [Disconnected by services]
ealfonso has joined #lisp
<verisimilitude>
Also, hectorhonn, I noticed I've yet to recommend you any reading material, even in our last discussion, so I'll recommend something you already have.
<hectorhonn>
ok, so combining advice from beach, jackdaniel, and verisimilitude, i should start out with lists, explore different ways to find out which style i like best, and remember that i can use *anything* in lisp, there is no idiomatic way like in haskell or java. that right?
<verisimilitude>
Press C-h i in your Emacs and go to the ``Emacs Lisp Intro''.
<verisimilitude>
Read that for a nice beginner's introduction to Lisp in general.
<verisimilitude>
There's a saying that if you give twenty different Lisp programmers something to do, you'll get twenty different programs, hectorhonn.
<hectorhonn>
jackdaniel: i'm halfway through pcl, yet to start on on paip
makomo has joined #lisp
<verisimilitude>
The related saying is if you give twenty different Java programmers something to do, you'll get twenty copies of the same program.
<jackdaniel>
hectorhonn: another way of studying (which proves to be more engaging for some people) is to contribute to open source projects
<jackdaniel>
then you have some conventions already in place, so you are not left without any clues how to do things
<hectorhonn>
verisimilitude: i don't see that option, only option for slime
<verisimilitude>
Just type in M-x info , then.
<hectorhonn>
verisimilitude: an absolute enterprise nightmare
<hectorhonn>
verisimilitude: yeah same
<hectorhonn>
(oh is your nickname long to type! :D)
<hectorhonn>
jackdaniel: any beginner friendly ones in CL?
<verisimilitude>
Use tab completion, hectorhonn.
<ealfonso>
I have a non-lisp source file vars.conf which I need to read from lisp. using a path relative to (uiop:current-lisp-file-pathname) works on the repl, but fails with no-such-file when the lisp source file is in ~/.cache/common-lisp: /home/USER/.cache/common-lisp/sbcl-1.3.14.debian-linux-x64/home/USER/git/path-to-file/vars.conf. How can I either make the compiler include the vars.conf next to the compiled source files, or refer to the
<ealfonso>
original source file pathname?
<jackdaniel>
I don't see much value in belittling programmers of other languages (or other programmers in general) [re java programmers]
<verisimilitude>
I didn't write the saying, jackdaniel.
<hectorhonn>
"The related saying is if you give twenty different Java programmers something to do, you'll get twenty copies of the same program" Actually this is exactly what a language should strive for, no? clear semantics
<jackdaniel>
repeating it is enough
<hectorhonn>
verisimilitude: OMG!
<verisimilitude>
Well, feel free to not see the value in it.
<hectorhonn>
verisimilitude: i feel really stupid now. hahaha
<jackdaniel>
ealfonso: try asdf:system-relative-pathname function
<verisimilitude>
What, you just got it, hectorhonn?
<hectorhonn>
verisimilitude: yeah, the tab thing
<jackdaniel>
that was euphemism, but whatever
<hectorhonn>
i've been typing nicknames since joining lisp
<verisimilitude>
Well, now you know.
<hectorhonn>
verisimilitude: thanks!
<verisimilitude>
It's no issue.
<ealfonso>
jackdaniel thanks
<jackdaniel>
hectorhonn: cffi maintainers are very nice people to work with. from other projects you could help with mcclim and ecl (I'm working on these); but I think that the best advice is to look for something you find useful and fun to work with
<jackdaniel>
slime project is also something benefitting whole community, so even small improvements have big impact
<hectorhonn>
jackdaniel: i see. anyone happen to know mmontone, the maintainer for djula?
<verisimilitude>
If we're recommending Common Lisp projects now, I'd recommend you at least start with projects that are implemented in pure standard Common Lisp, hectorhonn.
<hectorhonn>
there are impure standard Common Lisp? i thought common lisp is a dialect itself
dacoda has joined #lisp
<jackdaniel>
hectorhonn: some projects depend on foreign function interface
<jackdaniel>
(and shared libraries written in other languages)
<hectorhonn>
jackdaniel: oh, i see
<verisimilitude>
Put simply, there are plenty of Common Lisp programs or libraries that either only work on one implementation, usually SBCL, or use the CFFI and offload all of the work onto something written in a different language, both of which I believe should be avoided.
<jackdaniel>
laters \o
<hectorhonn>
verisimilitude: i must say i agree. CL seems capable enough for most tasks
makomo has quit [Ping timeout: 240 seconds]
<verisimilitude>
See you later then, jackdaniel.
<verisimilitude>
I was writing a program with an interactive terminal interface and did take a look at the available libraries.
<verisimilitude>
Guess what I noticed, hectorhonn.
<hectorhonn>
verisimilitude: what did you notice?
<verisimilitude>
All of these were just bindings to other libraries, most often Ncurses.
heisig has joined #lisp
<verisimilitude>
You have Common Lisp, this nice language, and yet these libraries risk memory leaks for what amounts to printing text.
<hectorhonn>
verisimilitude: that's a pragmatic decision i guess, ncurses library already exists and can interface easily with the os
<verisimilitude>
Not only that, but it's so much more bothersome to lead a Common Lisp library that wants an entire C library with it.
<verisimilitude>
So, I wrote my own library for this.
<hectorhonn>
verisimilitude: what is the library?
<verisimilitude>
You can see it here, if you're interested:
<verisimilitude>
It would be much harder to abuse copyright for taking down things you don't like, if so many people weren't all in a centralized location.
<hectorhonn>
i see. the problem is dmca, not github
<hectorhonn>
but yeah, it's good to have a backup site
makomo has joined #lisp
notzmv has quit [Quit: WeeChat 2.3]
random-nick has joined #lisp
dacoda has quit [Remote host closed the connection]
marusich has joined #lisp
dacoda has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
robotoad has quit [Quit: robotoad]
notzmv has joined #lisp
wigust has joined #lisp
wigust- has quit [Ping timeout: 250 seconds]
robdog has joined #lisp
makomo has quit [Ping timeout: 240 seconds]
elfmacs has quit [Ping timeout: 250 seconds]
_whitelogger has joined #lisp
rumbler31 has quit [Ping timeout: 250 seconds]
nckx has quit [Quit: Updating my GNU GuixSD server — gnu.org/s/guix]
nckx has joined #lisp
milanj has joined #lisp
nirved is now known as Guest64238
Guest64238 has quit [Killed (adams.freenode.net (Nickname regained by services))]
nirved has joined #lisp
<pjb>
verisimilitude: lists are important for abstraction, only if you use them to represent everything. If you were ready to use CLOS classes for everything (like in Smaltalk, say), then classes would become an abstraction device. Until that, they're just a representation device. It can be used to represent external objects, and thus abstract _them_, but not as an internal abstraction, since you could also have structures, vectors,
<pjb>
functions, or other representations.
<pjb>
verisimilitude: also, there is a way to distinguish the representation from the abstraction. This week, I had to debug a bug in C (it would be the same in lisp) where I had a typedef struct { void* data; int size } buffer; with a function buffer_new(int size) and a function buffer_free. The call to free failed on invalid pointer even thought it was allocated in buffer_new.
<pjb>
verisimilitude: the reason why that some client code used &buffer->data and incremented the pointer.
<pjb>
verisimilitude: the solution was to stop using this representation (the structure) and replace it with an abstraction: typedef struct buffer; void* buffer_data(buffer* b); int buffer_size(buffer* b); Then the client code could not increment the buffer data pointer. That representation was abtracted away, code become safe and correct.
<pjb>
Tests whether (member :+ *features*) and if true, reads the following form
<Inline>
the presence
<Inline>
and absence is #-
<pjb>
Otherwise, it skips over the following s/form/sexp/.
rnmhdn has joined #lisp
<ebrasca>
OK
<Inline>
for example #+clim
<ebrasca>
it is literaly skiping + ?
<Inline>
?
<Inline>
no no no
<Inline>
oh man
<Inline>
it is skipping the next form if the #+ fails
<ebrasca>
"#+" and "+"
nirved is now known as Guest24972
nirved has joined #lisp
<ebrasca>
mmm skip some code in all cl implementations?
<Inline>
ebrasca: say you want to eval some form conditionally
<ebrasca>
I have read macro with name "with-with" .
<Inline>
ebrasca: say you want to eval (startup-my-editor) only when clim system was loaded
<Inline>
ebrasca: then you can say #+clim (startup-my-editor)
<ebrasca>
I have allways read someting like #+sbcl or #+genera but never #++.
<ebrasca>
2 +
<Inline>
ebrasca: now if clim was not loaded and hence not pushed onto the *features* list then it will skip that form
Guest24972 has quit [Ping timeout: 252 seconds]
<Inline>
ebrasca: depends, if it is pushing + onto *features* itself it can check for it too
<Inline>
ebrasca: + can be anything
<ebrasca>
So it allways ignore?
<pjb>
verisimilitude: there's gitlab.com instead. Or framagit.org
<Inline>
ebrasca: no, it's a feature
<Inline>
ebrasca: it checks for a feature keyword named +
<Inline>
ebrasca: you get it ?
<ebrasca>
No
<ebrasca>
How do you give feature + to #++ ?
<pjb>
(setf *features* (delete :+ *features*)) (read-from-string "(a #++ b c)") #| --> (a c) ; 11 |# (pushnew :+ *features*) (quote (a #++ b c)) #| --> (a b c) |#
<pjb>
In #++ you already gave the feature :+ to #+ !
hectorhonn has quit [Quit: Page closed]
<pjb>
To give the feature + (assuming standard readtable and packages, ie. cl:+) to #+ you would write #+cl:+
<Inline>
so b was skipped because there was no + in the *features*
<pjb>
Because there was no :+
<Inline>
and in the second example b was not skipped because + was found in *features*
<pjb>
#+ reads the feature expression in the keyword package.
<pjb>
Not +, :+
<Inline>
ok
<Inline>
forgive my incompleteness sirrah!
<pjb>
#+#.(cl:if (cl:= (cl-user::version) 2) '(:and) '(:or)) (new-function) calls new-function only if (version) returns 2…
<ebrasca>
I think I undestand it now.
<pjb>
More simply: #+sbcl x #+ccl y #-(or sbcl ccl) (error "not implemented for ~S" (lisp-implementation-type))
<ebrasca>
wow I think I can make someting like #+little-endian
resttime has quit [Quit: Leaving]
nopolitica has joined #lisp
<pjb>
(find "LITTLE" *features* :test (lambda (x y) (search x (string y)))) #| --> :little-endian-target |# in ccl
<pjb>
in sbcl and ecl we have :LITTLE-ENDIAN, and in abcl and clisp nothing. (those works on VM that abstract away the endianness. eg. clisp always writes binary files in little endian, even on big-endian architectures, so clisp binary files can be compatible between clisp on different platforms)
<pjb>
In any case, if you depend on this flag, your code is in error.
<pjb>
(it's a big code-smell).
<pjb>
bbl
<ebrasca>
I have read it in my *features*
dacoda has quit [Ping timeout: 250 seconds]
Bike has joined #lisp
<sindan>
where can I read up on what everything in *features* means?
<jackdaniel>
sindan: you can't, because they are not standarized and they are pushed from different places
heisig has quit [Remote host closed the connection]
<jackdaniel>
i.e you may find a description in the implementation manual chapter about weak references
<jackdaniel>
or in the library documentation
heisig has joined #lisp
<jackdaniel>
there is a library which aims at partial standarization called trivial-features
<sindan>
I see. So, trivial-features and starting from implementation docs if they exist. I'm guessing there will be acceptable documentation for sbcl.
<ebrasca>
jackdaniel: What about mezzano , GNU hurd and others?
<ebrasca>
And in cpus why they don't add ppc64le or ppc64be?
<jackdaniel>
ebrasca: endianess is a separate feature
<jackdaniel>
it is listed first
<sindan>
that library is pretty green
<jackdaniel>
regarding mezzano, I think that such contribution would be accepted in the library, but I don't really know; ask luis
<ebrasca>
Why linux is in OPERATING SYSTEM section?
<jackdaniel>
and as of gnu hurd: is there lisp which actually works on gnu hurd as of today? and if yes, I suspect gnu hurd being a posix system, so this is explained that "sysname" information from uname is used
<ebrasca>
Linux is one kernel.
<jackdaniel>
I recommend reading paragraph before "Examples:"
elderK has quit [Ping timeout: 250 seconds]
<ebrasca>
Linux is not one operating system .
elderK has joined #lisp
<jackdaniel>
if you had read the pararaph as I have suggested, you would know, that on POSIX systems the "sysname" information from uname(3) should be used
buhman has quit [Ping timeout: 252 seconds]
<ebrasca>
ja
<jackdaniel>
and on linux this is, indeed, "linux"
buhman has joined #lisp
<ebrasca>
I think correct is GNU/Linux
themsay has quit [Ping timeout: 246 seconds]
ealfonso has quit [Ping timeout: 250 seconds]
themsay has joined #lisp
scymtym has quit [Ping timeout: 240 seconds]
themsay has quit [Ping timeout: 268 seconds]
atgreen has joined #lisp
<jackdaniel>
everyone is entitled to think what they desire to think, fact remains that this works exactly as specified, sysname value is "Linux" on systems powered by linux kernel
<jdz>
Not all operating systems that use Linux kernels use GNU userland utilities.
<jackdaniel>
(most notable example would be Android)
<ebrasca>
GNU/Linux , Android are ok . Linux is not ok.
<jdz>
It is OK, when talking about system interfaces.
rnmhdn has quit [Ping timeout: 250 seconds]
<jdz>
There's nothing GNU in POSIX or Linux syscalls.
* jackdaniel
resigns from trying to explain why it is irrelevant given how this *features* entry is specified in the document (with a disappointment)
<ebrasca>
Then unix
<jdz>
Also, Alpine Linux is a Linux distribution, and the GNU part is optional.
<jdz>
No, AIX is also Unix.
themsay has joined #lisp
<jdz>
ebrasca: Not sure what you are trying to accomplish here, but this is very off-topic, so I also resign from further discussion.
<ebrasca>
jdz: OK
<ebrasca>
jdz: I just asked about #++ .
themsay has quit [Read error: Connection reset by peer]
<ebrasca>
jdz: I am learning cl-vulkan. I am thinking if I can take care of cl-vulkan.
themsay has joined #lisp
Arcaelyx has quit [Ping timeout: 250 seconds]
<jdz>
Is the project abandoned?
<ebrasca>
I think |3b| have abandon it 3 years ago.
<ebrasca>
Or 1-3
<ebrasca>
years ago
makomo has joined #lisp
<ebrasca>
jdz: If I remember correctly I have write with |3b| and he say he abandoned it.
<ebrasca>
jdz: yea I have find it in my log. "<|3b|> ebrasca: no idea, haven't tried to run it since i stopped working on it :/"
<elderK>
Holy craaaaaap. A month since I last used C or C++!
<|3b|>
cl-vulkan isn't "abandoned", but it also isn't currently being worked on, so if you want to use it, you will probably need to add to it
<elderK>
|3b|: ;) you could just say it's "mature" :P :D
<elderK>
"It's not dead. Just mature."
<elderK>
Or "sleeping" :)
<|3b|>
elderK: that would sort of require it to be able to do anything first :p
vlatkoB has quit [Ping timeout: 240 seconds]
<elderK>
|3b|: It's reminiscent of GLAD :)
<|3b|>
"sleeping" maybe, that doesn't imply any sort of completion :)
* |3b|
intends to work on it more, it just isn't likely to make it to the top of my priority stack any time soon
<elderK>
:P It is taking a nap :D :)
<elderK>
Fair enough :)
<ebrasca>
Last Commits on Apr 14, 2016 from |3b|
<pjb>
You can make a CL implementation run directly on the Linux kernel. See an example with emacs: https://www.informatimago.com/linux/emacs-on-user-mode-linux.html for a CL implementation with (or new emacs with modules) FFI it would be easier, since we could do the mount directly.
<elderK>
It's like my tinkering on binary-typesy stuff has taken a backseat - past couple weeks I've been spending a ton of time learning about lisp implementation.
<|3b|>
(2 other unrelated projects ahead of it, then i probably want to work on spirv compiler some more before vulkan itself, and also get a better idea of how i want to use it)
<elderK>
Lots of reading old research papers and things, too. It's been fascinating.
<elderK>
|3b|: Sounds smart.
<|3b|>
spirv is probably less important now than when i last worked on it though, since i think there are glsl extensions available that would be good enough for getting the rest working
<|3b|>
knowing how i (or anyone else for that matter) would want to use it is important though, hard to design good abstractions without knowing use cases
<elderK>
|3b|: Parsing the spec file looks kind fo horrible
<elderK>
Like, the spec file itself looks kind of horrible.
<elderK>
so much C assumption there
<|3b|>
ebrasca: i'm not sure that was available last time i looked at vulkan
orivej has joined #lisp
<|3b|>
elderK: at least it is c :)
<ebrasca>
|3b|: I think you can do someting like this.
<|3b|>
and a lot of the C stuff can be ignored
<elderK>
|3b|: Sweet.
<ebrasca>
|3b|: I don't know how to make instance of VkSurfaceKHR .
dddddd has joined #lisp
<ebrasca>
|3b|: What 2 projects are you doing?
<|3b|>
trying to assemble a thermal camera (mostly just having trouble getting a working configuration of a 64bit arm board with all the drivers i need), and writing some simple utilities for android
<|3b|>
and probably write a similar with-*-surface macro to handle destroying it
<ebrasca>
|3b|: Some years ago you helped me with cl-opengl. I like to be more like you and write good code and look like I know everiting.
<|3b|>
%glfw:create-window-surface + %vk:destroy-surface-khr should replace the vk:with-xlib-surface
<|3b|>
i'm not sure you are calling %glfw:create-window-surface correctly though, the last argument is a foreign pointer to the surface
atgreen_ has joined #lisp
<|3b|>
you will need to ask borodust how to call that, i'm not familiar with the wrapper generator it uses
themsay has quit [Ping timeout: 250 seconds]
atgreen has quit [Ping timeout: 250 seconds]
<jackdaniel>
|3b|: new lesson learned! you look like you know everything , don't spoil it with "I'm not familiar…" talk ;-)
heisig has quit [Quit: Leaving]
<|3b|>
ebrasca: #++ is my lazy way of commenting out forms. slightly shorter and easier to type than #+()
scymtym has joined #lisp
<jackdaniel>
nb: both ways are incorrect, it should be even longer #+(or)
<|3b|>
yeah, that
* |3b|
forgets the 'correct' way since i don't use it :)
<ebrasca>
|3b|: Your macro "with-with" is very interesting.
<jackdaniel>
or if anyone bothers to define a reader macro, it *could be* #;something
<|3b|>
emacs/slime understands #++
<jackdaniel>
right, that is a good argument against #;
<|3b|>
and :+ on *features* seems sufficiently unusual that i'm willing to just let someone send me a patch to fix it if they come up with a good reason they need it
<|3b|>
(same as odd reader/printer settings, etc)
<|3b|>
not like people can't push :sbcl :ccl :genera etc onto *features* at random too :)
<|3b|>
(or remove them for that matter, though ideally most code would have pure CL fallbacks for non-bugfix cases)
<jackdaniel>
I'm taking my time to correct all #+nil 's to #+(or) when I encounter them in code I work with (for sake of correctness by default)
<|3b|>
i usually try to just remove them completely once i'm done actively working on something
SaganMan has joined #lisp
<|3b|>
most of them are debugging and/or multiple attempts at something i haven't figured out yet
<pfdietz>
Hmm. A use for an Eclector-based code rewriting tool.
robdog has quit [Remote host closed the connection]
<ebrasca>
pfdietz: What do you mean with ^?
rnmhdn has joined #lisp
<pjb>
I prefer the more direct #+(and) included or #-(and) skipped. #+(or) is kind of a triple negative…
<pfdietz>
A tool that would use Eclector to produce a kind of parse tree that can be converted back to something that is character-for-character equivalent to the original file. Then, do rewrites on that representation to get rid of #+nil forms (the example above).
<pjb>
|3b|: One reason why #++ is very bad, is this whole discussion above!
<pfdietz>
It would be easier if lisp files were directly equivalent to the forms after reading, but that loses comments and other reader-handled stuff.
<|3b|>
pjb: ideally it wouldn't show up much in 'released' code, unfortunately not much of my code makes it to that point :(
<ebrasca>
|3b|: I going to send PR with fix for #++ .
<|3b|>
ebrasca: which 'fix'?
<pjb>
#+(and)
random-nick has joined #lisp
<ebrasca>
|3b|: ^
<|3b|>
#-(and) you mean?
<pjb>
Right.
<|3b|>
ok, i'd probably apply that if sent, though i'd probably keep using #++ if i worked on it some more :)
<scymtym>
pfdietz: i made a very quick and dirty demo for something like this a few weeks ago (in this case replacing IF without alternative leg with WHEN): https://techfak.de/~jmoringe/refactor.png
<pfdietz>
The analogous tool in the C world is clang-tidy
atgreen_ has quit [Remote host closed the connection]
atgreen_ has joined #lisp
<pfdietz>
Although that can be a bit more semantic.
<ebrasca>
pfdietz: Is there some tool for detecting duplication in code?
<pfdietz>
Clone detectors? Lots of work on that in general. Dont know about for Common Lisp specifically.
<ebrasca>
mmm run some detector of duplication on all cl libraries and get better code.
<pfdietz>
I'd be happy to start with getting rid of package name duplication. :)
<ebrasca>
|3b|: Do you know how I can start making vulkan for mezzano OS?
<ebrasca>
|3b|: Have in mind I have done bad fat32 implementation and part of ext for mezzano.
rnmhdn has joined #lisp
Zaab1t has joined #lisp
<pjb>
I guess something like my electric-+-suppress https://pastebin.com/vYhbL47s could be achieved with abbrev too.
rnmhdn has quit [Ping timeout: 244 seconds]
rnmhdn has joined #lisp
Essadon has joined #lisp
yvy has joined #lisp
gravicappa has quit [Ping timeout: 250 seconds]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 250 seconds]
cpt_nemo has joined #lisp
rnmhdn has quit [Ping timeout: 250 seconds]
hectorhonn has joined #lisp
<hectorhonn>
how do i specify that a function returns a list of integers?
<beach>
You can't.
<beach>
... unless, of course, the length of the list is constant.
hectorhonn has quit [Ping timeout: 256 seconds]
lose has joined #lisp
hectorhonn has joined #lisp
<hectorhonn>
beach: oh dear. how about a function that returns an integer?
<beach>
Sure.
<beach>
Why do you care so much about specifying that? Just make sure that it does return an integer or a list of integers.
<hectorhonn>
it would make it easy to read
<hectorhonn>
instead of reading the entire function, just look at the signature
<beach>
Put it in a comment then.
<hectorhonn>
hmm, so its like python then
<hectorhonn>
beach: thanks!
<beach>
hectorhonn: Some authors claim that statically typed languages force the programmer to supply information early on in a project; information that is then very likely to change later.
<beach>
More often than not, the information is about representation of objects, which is an implementation detail that can change later. If you want to supply type information, you should do it in terms of the abstract types of your protocol.
<hectorhonn>
beach: true. on the other hand, changing the return type of a function would require a change at all call sites, so imho its better to have that kind of information supplied early during design and set in stone. then write an wrapper as an abstraction for the function if things do change
<hectorhonn>
beach: yup, the abstract types of the protocol, that's what i meant
<beach>
A list of integers is hardly an abstract type.
robdog has joined #lisp
<hectorhonn>
well.. technically its not very abstract :D
<drmeister>
It says in the documentation for *default-special-bindings*: "Forms are evaluated in the new thread or in the calling thread? Standard contents of this list: print/reader control, etc. Can borrow the Franz equivalent?"
<drmeister>
What the heck kind of documentation is that?
voidlily_ has joined #lisp
<drmeister>
It makes more sense to me to evaluate the forms in the parent thread because then bindings like ( ('*print-pretty* . *print-pretty*)) will get the value of the *print-pretty* binding of the parent. If you evaluate *print-pretty* in the child thread - then you will get the global value.
mrcom has joined #lisp
kajo has quit [Quit: From my rotting body, flowers shall grow and I am in them and that is eternity. -- E. M.]
random-nick has quit [Ping timeout: 268 seconds]
<beach>
MoziM: No, that looks totally wrong. And we don't write it "LISP" anymore. We write it "Lisp".
robotoad has joined #lisp
<beach>
MoziM: Common Lisp allows both assignments and sequences of forms (expressions to evaluate).
pierpal has quit [Read error: Connection reset by peer]
razzy has quit [Ping timeout: 250 seconds]
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
<beach>
MoziM: And the "value of a symbol" thing is wrong. Common Lisp uses eager evaluation.
dddddd has joined #lisp
<beach>
MoziM: And (A+B) isn't valid Common Lisp syntax.
<beach>
MoziM: But if you do (SETQ X (+ A B)), then the addition is computed once and the result is stored as the value of X.
equwal has joined #lisp
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
equwal has joined #lisp
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
equwal has joined #lisp
milanj has joined #lisp
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
logicmoo is now known as dmiles
pierpal has joined #lisp
<jcowan>
interestingly, Univac Lisp is a Lisp-1; that seems to be a common change for people reinventing Lisp from scratch
<pjb>
jcowan: it's a simplification for the implementer…
random-nick has joined #lisp
pierpal has quit [Ping timeout: 268 seconds]
lose has quit [Ping timeout: 250 seconds]
<jcowan>
indeed it iw
<jcowan>
is
<pjb>
tarball at ftp://ftp.informatimago.com/pub/lisp/univac-1100-lisp.tar.bz2
<jcowan>
interestingly, it has a non-closed function constructor spelled LAMBDA, and an otherwise identical closure constructor spelled LAMDA (which is how it is spelled in Modern Greek)
<jcowan>
so the "classical vs. modern" lambda
equwal has joined #lisp
<Bike>
ew.
rumbler31 has joined #lisp
sunset_NOVA has joined #lisp
jmercouris has joined #lisp
rumbler31 has quit [Ping timeout: 244 seconds]
pierpal has joined #lisp
jmercouris has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
<phoe>
What is the function that does the inverse of REMOVE? I want to keep all the elements instead of removing them.
graphene has joined #lisp
zmt01 has quit [Quit: Leaving]
<phoe>
I can do it via (remove-if-not (curry #'eql thing) list) but I wonder if there's a shorter way.
<Bike>
:test-not #'eql, i think
<Bike>
this is, of course, confusing
<phoe>
Well, yes, that works.
<phoe>
It's the first time I use :TEST-NOT.
angavrilov has quit [Remote host closed the connection]
Zaab1t has quit [Quit: bye bye friends]
rnmhdn has quit [Ping timeout: 246 seconds]
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
equwal has joined #lisp
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
gravicappa has quit [Ping timeout: 250 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
_whitelogger has joined #lisp
blackadder has quit [Quit: WeeChat 1.6]
Mr-Potter has joined #lisp
orivej has quit [Ping timeout: 240 seconds]
razzy has joined #lisp
notzmv has quit [Ping timeout: 245 seconds]
gigetoo has quit [Ping timeout: 250 seconds]
vlatkoB_ has quit [Remote host closed the connection]
notzmv has joined #lisp
<phoe>
I have a class object. I want to remove it from the Lisp system altogether. No live instances of that class remain. Is it enough to call REMOVE-DIRECT-SUBCLASS on all of the direct superclasses of that class and remove all methods that specialize on that class?
<LdBeth>
good afternnon
<phoe>
Hey LdBeth
orivej has joined #lisp
<LdBeth>
phoe: for you question, I think the class is kept somewhere that FIND-CLASS can get it by it's name
<phoe>
I am already after (setf (find-class 'foo) nil).
<phoe>
I want to ensure that the class object itself is inaccessible. This means removing everything that links to it from CLOS.
<phoe>
Including other class objects and method objects.
equwal has joined #lisp
<LdBeth>
phoe: It might be easier to delete an entire package, I guess
<flip214>
phoe: I think I discovered a nice trick for that
<LdBeth>
interesting, so seems (setf find-class) to nil is sufficient, all the other things are mop specific, https://groups.google.com/forum/#!topic/comp.lang.lisp/hzQ7RRTK4Lg