freenode/#lisp - IRC Chatlog
Search
21:59:27
verisimilitude
I'm currently adding system buffering and echoing control to my ACUTE-TERMINAL-CONTROL, even though I despise the idea.
22:00:51
verisimilitude
I'm currently adding CCL code for this, but it can't find its queer little databases on my system and so I'm doing it blind.
22:33:46
simplegauss
in common implementations (I'm particularly interested in sbcl) is there a way to declare a lambda inline? of course this is going to be used in a macro
22:38:29
simplegauss
what i mean is a macro might produce a lambda which gets assigned or called, and i'd like this lambda to be declared inline. of course i could do something like "(flet ((f (x) (declare (inline f)) (1+ x))) f)" but i'd like to know the better solution if it exists
22:41:28
jmercouris
simplegauss: What is the question? A macro can produce any kind of code, and a lambda can be made with (lambda ())
22:47:47
White_Flame
if you put the inline declaration inside the function body itself, that's not where inlining needs to happen
0:22:19
drmeister
CFFI question - what encoding does not change a string at all? *default-foreign-encoding* :utf-8 is screwing me up.
0:58:35
White_Flame
what does "not change a string at all" mean? what format is the string currently? as it's a vector of potentially 21-bit or so codes, they need to map to bytes somehow
0:59:09
White_Flame
also, it highly depends on what the byte reader on the other side thinks the encoding is
1:00:45
simplegauss
i got disconnected earlier, so i apologize if someone already answered this, but i was wondering if a lambda function definition can be declared inline in any implementation (sbcl). concretely i have a macro that expands to some lambda, and i'd like that function to be inlined.
1:01:38
simplegauss
so for example does the declaration here make a difference?: (defmacro m () '(lambda (x) (declare (inline)) (1+ x)))
1:02:16
White_Flame
your declare affects code inside the lambda body, which isn't where the inlining decision you want will happen
1:02:37
White_Flame
from above: (flet ((func ...)) (declare (inline func)) ...something that uses func...)
1:02:52
simplegauss
White_Flame: oh, so something like (defun f (args) (declare (inline f)) body...) does nothing?
1:03:46
White_Flame
if you pass around lambdas dynamically, you can't inline them. You'd have to recompile to have that effect
1:06:00
simplegauss
hmm. does the hyperspec or some document go into more details on these rules? this link (http://clhs.lisp.se/Body/d_inline.htm) seems to suggest that (inline blah) before a function definition can trigger some information to be saved
1:06:29
simplegauss
also, i guess there is no way to insist that all uses of a function are attempted to be inlined?
1:07:13
simplegauss
nvm, i guess that's what declaim is for. for some reason I thought i've seen people write (defun f (args) (declare (inline f)) body)
1:08:33
White_Flame
right, the declaim is outside the defun, meaning the outer scope uses that declaration
1:11:58
simplegauss
White_Flame: thanks! are there some good optimization notes that deal with these questions, even if only specific to sbcl?
1:14:01
White_Flame
I believe implementations are free to ignore inline declarations, so your speed/safety/etc settings have to be enough to allow it, too
1:32:07
simplegauss
White_Flame: thanks! I decided to do that to try and learn something about sbcl, and now i've seen something that looks very much like an optimization bug
1:32:55
simplegauss
then compile (lambda (x) (funcall (mfoo) x)), the function given by mfoo does not inline
1:33:33
simplegauss
but if i compile (lambda (x) (funcall (lambda (z) (1+ (1- z))) x)), the lambda gets inlined
1:34:02
simplegauss
i'm surprised this kind of behavior is even possible; don't macros have to be expanded before compilation?
1:37:49
simplegauss
to be precise i'm compiling (lambda (x) (declare (optimize (speed 3) (safety 0))) (funcall (mfoo) x)) and (lambda (x) (declare (optimize (speed 3) (safety 0))) (funcall (lambda (x) (1+ (1- x))) x))
1:56:43
pierpa
pfdietz: so, an implementation where (mapcar #'upgraded-array-element-type '((unsigned-byte 16) (signed-byte 16) (unsigned-byte 15))) ==> ((UNSIGNED-BYTE 16) (SIGNED-BYTE 16) (UNSIGNED-BYTE 16)) is in error, if I understand correctly? sigh :)
2:05:47
jlarocco
Hi, I'm writing a wrapper for libgphoto2, and I'm running into a problem with two functions that take struct arguments on the stack.
2:06:23
jlarocco
Adding cffi-libffi as a dependency fixed an error with my defcfun declarations, but now when I try to call the functions I get "There is no applicable method for the generic function" with a pointer, my struct type, and another pointer.
2:08:00
jlarocco
I'm finding conflicting information on whether passing structs on the stack even works
2:39:35
clintm
Before I buy lispworks out of sheer frustration, I thought I might ask here: Does anyone else (try to) use FreeBSD and either sbcl or ccl? Between sbcl's random "interrupted system call" errors, and ccl randomly hanging with slime, I'm THIS close to dropping them both.
2:41:22
verisimilitude
Considering that the FreeBSD developers don't even use FreeBSD, perhaps you should drop it instead, if you can.
2:45:01
verisimilitude
There's also ABCL, if you don't mind running the JVM, which probably works well under FreeBSD.
2:45:24
verisimilitude
Considering how much a Lispworks license costs, it's worth your time to test these first.
2:48:19
clintm
Hrm... I think I'll bring up an openbsd instance and see how well things work there. I feel a bit embarrassed that I didn't suspect FreeBSD itself more, and only blamed the lisps.
3:00:05
simplegauss
I asked on the sbcl channel, but i am getting some strange disassembly and i don't understand how it's even possible for this optimization bug to happen: https://pastebin.com/SjBV06L2 . the top function compiles a separate lambda and calls into it, but the bottom two completely elide the lambda and have no extra function calls in their body.
3:04:46
simplegauss
and why would assigning to a name in the flet help if it's still wrapped in a funcall?
3:08:14
pierpa
what happens if you change that macro to (defmacro mfoo () #'(lambda (z) (1+ z))) ? (or equivalently to (defmacro mfoo () (lambda (z) (1+ z))) )
3:21:48
pierpa
pfdietz: so, ccl, lw, and acl got it wrong. only sbcl is right of the ones I have checked
3:25:07
pfdietz
Complex type upgrading in the spec is broken, though. They didn't get it right before the spec writing process ended.
7:15:27
hajovonta
the same here. If I have to choose a popular language, I would choose python. It's easy to learn, and one can accomplish a lot with it.
7:16:39
hajovonta
We have tools developed in Java that I don't like to use so I developed my alternatives using Emacs Lisp
7:20:57
elderK
Like, when it comes to what I call "high level languages", I figure I might as well try to use Lisp.
7:21:17
elderK
Java, Python, etc. They don't really offer anything compelling besides being widely available and supported.
7:21:59
elderK
I guess for me, something is high-level if you don't have to worry so much about all the tiny details of memory and such.
7:22:39
elderK
In that sense, CL kind of fits as a semi-low-level language in that with SBCL, you can create VOPs and stuff.
7:23:03
elderK
My "perception" of languages probably isn't sane - it's not based on much other than my own feelings. So, take it with salt :)
7:23:20
elderK
But in general, Python, Java, C#, etc. They all seem like slightly different shades of the same color.
7:25:03
hajovonta
yes, but I sometimes find myself in a position that either my lisp knowledge is insufficient or lisp is not capable of doing a task, and then reach out to python and make lisp and python programs work together
7:25:09
verisimilitude
It's impressive how, despite its disgusting size, it still lacks so much important functionality.
7:25:27
elderK
The fact that it does not natively support unsigned integers was a major turn off to me.
7:25:46
elderK
And for a typed language, the lack of "references to const object" really pisses me off.
7:26:13
verisimilitude
Now, I don't know much Java, as I very much dislike it, but is most of the language OO patterns or some drivel? How do they waste so much space with so little?
7:27:12
verisimilitude
As an example, I'm begrudgingly writing some Common Lisp to pepper over some terminal functionality across implementations.
7:27:40
verisimilitude
For ABCL, I was planning to write some Java in Common Lisp to handle this, but, and I could be wrong, it seems Java has no functionality for this.
7:27:52
elderK
I've had to pick up Java for Uni. So much there is Java Java Java. I *actively* avoided it like the plague for a LONG time.
7:28:20
verisimilitude
Am I wrong or does Java, despite its disgusting size, truly lack simple functionality such as permitting raw I/O and echoing?
7:28:55
hajovonta
elderK: now in my old team Java is coming like a train and I could barely step away
7:30:00
hajovonta
I wrote a solution in 6 months (by myself) in CL that had the functionality of a large Java software that a whole team was working on for years
7:32:47
verisimilitude
Oh, but hajovonta, that team can be easily replaced piecewise; it's probably slightly harder to replace you.
7:33:22
verisimilitude
Just remember that it's all about reducing programming to assembly line work, where you don't matter and they can do whatever they want to you.
7:33:53
hajovonta
it was fun to prove what CL can do, and it reinforced my feeling that lisp is the only language that is worth of using
7:35:42
verisimilitude
I had fun demonstrating to some students I had the opportunity to interact with how a single line of APL replaces however many dozens of lines of Java they were writing.
7:36:40
verisimilitude
I was then having a discussion with someone else about this same topic and they joking responded with this, paraphrased:
7:37:05
TMA
java is the safe bet. as we all know, a team of two hundred is smarter than any single person (assuming an average intelligence for the team members their IQ total is 20000) plus it is easier to hire yet another java programmer than to find out, whether the applicant is smart
7:37:05
elderK
Have you guys found, like, I don't know. Most developers I speak to in real life, they seem to lack passion. Students, too. Instead of say, working on a personal project or getting excited about some new technology or language or idea, they just... leave it all at the door.
7:38:05
verisimilitude
Just look at how most Indians want to be programmers, according to a national survey, apparently.
7:39:58
verisimilitude
Perhaps it's an odd difference, to compare workaholics who hate their jobs but obsess over them to someone who actually manages to get fulfillment from their job and still puts in just as much effort, if not more.
7:40:06
TMA
elderK: they possibly have some passion, it is just not anything you happened to stumble upon; they might like to dance, watch birds, tend their bonsai, get wasted, ...
7:41:11
elderK
I don't know. To me, Software isn't just a tool or a job. It's not a simple process. It's more like art or expression.
7:42:15
elderK
Sure, you build something for some purpose. But the code itself, there are so many ways to evaluate it. Not simply that it "works." Is it maintainable? Is it flexible? Is it tested? Is it efficient? And the feeling that you get, when everything seems to be going right - design has come together. I don't know. It's just a great feeling.
7:43:00
verisimilitude
It's in a way bewildering to me how many programmers don't seem to have novel ideas for software.
7:43:31
verisimilitude
It seems like most programmers fetch this from that, fed into this, massaged by that, into this format to be fed to this later.
7:44:19
verisimilitude
Where's all of the programmers saying ``This entire way people do this is wrong and I'm going to design this to prove that my way's better!''?
7:44:44
elderK
Where's the love for the details, too? I have been kind of disgusted by how I see people write software. It's like, everyone thinks you have to be writing avionics software in order for a bug to do real damage.
7:45:18
elderK
Ignoring the fact that bad code today has more effect than ever before. Writing recklessly... is dangerous.
7:45:33
elderK
Say, a forum that stores people's contact info and passwords for some pointless reason.
7:48:03
elderK
Outside of that, I continue to learn about compiler implementation, parsing and stuff. I have crazy dreams I want to realize.
7:48:40
elderK
I've always been interested in the low-level, particularly with kernels and microkernel technology.
7:49:27
elderK
1. Implement a compiler for a dialect of Scheme or maybe CL. Ideally, gain enough smarts so that I can write something that I can say is not a toy.
7:51:01
elderK
I'd then like to investigate more into capability based security. And also do various experiments for my own satisfaction regarding how much I an shift into userspace.
7:52:12
p_l
elderK: The question is, do we truly need the "kernel space" and "user space"? Even when using supervisor/user modes on CPUs
7:52:30
hajovonta
the software developer industry is divided already. And everybody wants to write code, and nobody likes to maintain it.
7:52:41
elderK
p_l: Well, it depends on what you mean by "kernel and user space" when using "supervisor/user."
7:52:50
elderK
It's not necessarily the memory that defines kernel and user space - it's all about the privilege.
7:53:14
p_l
elderK: supervisor/user is *hardware* security barrier. How do you actually use it, now...
7:54:19
verisimilitude
Now, from the earlier topic, the only particularly bothersome aspect of writing lower level code in Common Lisp, to me, is how logical manipulation can be verbose, but that could be eliminated easily if one wanted it.
7:54:26
elderK
verisimilitude: I have spent the majority of my life learning "pointless" details to enable this dream. I've also spent insane amounts of time learning how to modularize and test things. That was handy as I leanred that the more easily tested something is, the more the more modularized and flexible the resulting desing.
7:55:03
verisimilitude
That's good, elderK; I firmly believe obsessing about a topic constantly is a good, perhaps even the best, means to improve the ideas created.
7:55:28
verisimilitude
So, Common Lisp can be verbose when manipulating binary formats and other such things.
7:55:52
elderK
verisimilitude: Also note, none of my ideas are particularly new. Pretty much everything I have done, has been done before, elsewhere and better. I'm simply trying to do it myself, my way, just for satisfaction I guess. And because I like to think I might be abl to do something more efficiently in some case.
7:56:45
verisimilitude
Would you care to see what I've been working on, elderK; it's written in Common Lisp, but is a decidedly non-lispy program.
7:59:47
verisimilitude
My idea is that you have machine code programs that use some services provided by the tool, such as disassembling an instruction or asking for an integer of a certain magnitude, to write machine code programs instead.
8:00:11
verisimilitude
Unfortunately, people tend to tell me that they can't give much of an opinion on it.
8:00:35
verisimilitude
I went to ##asm here and was told by one fellow that my article read as if ``a schizophrenic out patient'' wrote it.
8:01:07
elderK
You have reminded me of another "dream project" of mine. Maybe some ideas from that you would find intersting for your own project.
8:01:18
verisimilitude
This is the article that goes into good detail, elderK. I'd be interested to read what you think of it.
8:01:37
verisimilitude
Still, I suppose you should tell me in a private message, if you do, so we don't error from Lisp here.
8:02:41
verisimilitude
The actual Common Lisp is a mess, I think, at least in parts, but I did derive three libraries from it, which are rather nice, I think.
8:03:22
hajovonta
verisimilitude: so then by using your software, we would write machine code through your interface?
8:03:50
verisimilitude
This first version targets CHIP-8, which is why it's written in Common Lisp, as I've designed a Meta-CHIP-8 to use with this.
8:04:22
verisimilitude
That Meta-CHIP-8 isn't documented yet, however; there was an earlier version that I disregarded.
8:04:38
verisimilitude
It's all contained in the META-CHIP-8 procedure, though; it's a memory-to-memory system.
8:05:29
verisimilitude
It's a one-way street. I've purposefully designed the tool to only work in formats I've designed; it's not a Lispy program at all.
8:06:08
hajovonta
I had something similar in mind but not with machine code but other high-level languages
8:07:26
edgar-rft
AFAIK every machine-code can be parsed into Lisp code, but probably not very meaningful Lisp code. That's the only problem.
8:08:02
hajovonta
but I never got to the point of doing it (probably because I couldn't fully convince myself)
8:09:33
verisimilitude
You can't import common-lisp in Python, so that's a major barrier to a new implementation of Common Lisp in Python.