freenode/#lisp - IRC Chatlog
Search
16:07:28
beach
In order to test my library for "concrete syntax trees", I want to use my favorite testing technique, namely random tests. For that, I would like to characterize what a typical macro function does with its arguments. I came up with this:
16:07:29
beach
A macro argument is typically either included somewhere in the expanded form, or (if the argument is a CONS) occasionally, its CAR and CDR are included but not the CONS itself. The macro function will also add its own expressions to the expansions. These will most often be atoms. Does that sound right?
16:13:26
beach
It is not *that* critical, though. I just want to do something similar to what macros do.
16:26:33
_death
it sounds plausible that arguments or parts of them will typically appear in expansions.. I guess the majority of other expressions will be atoms, but the amount of conses will also be high
17:12:27
gigamonkey
Hmmm. Building SBCL 1.3.16 on an oldish Mac (10.9.5) with the 1.1.6 binary distro and I get "fatal error encountered in SBCL pid 3079: no size function for object at 0x223c3070 (widetag 0x31)"
17:47:44
Jonsky
(socket-server #(127 0 0 1) 8090 (lambda (stream) (format stream "~A" "<html><body>hello</body></html>")))
17:51:14
Grue``
the logic is quite complex actually, you need to accept browser's requests and respond to them appropriately
17:51:16
warweasle
Jonsky: You might look at "Land of Lisp". He creates a simple web server halfway through the book.
17:55:47
Jonsky
_death: but I was just sending oneline of html. How come I still need to print #\return #\linefeed?
17:56:36
Jonsky
Walternate: I looked at the code of usocket:socket-server. It's basically the same. I don't know why it doesn't work...
18:00:05
flip214
well, my most basic HTTP server is ( echo "200 HTTP/1.0" ; echo ; cat a_file ) | netcat -l 80
18:02:49
namosca
I am reading the basics of lambda calculus and I wonder if there is a way of playing with it in Lisp, so I can get a hands on feeling with that... do you have anything to recommend for this? A tutorial or book for instance
18:03:47
_death
Jonsky: it's also a good idea to read a request before sending a response and terminating the connection
18:08:56
namosca
pjb: I actually would like to try something interactive, but what you said could also be something of value... is there any tutorial you recommend?
18:17:40
Jonsky
(And somehow Safari still cannot understand my simple server...But at least I got Chrome and Firefox covered.)
18:21:07
Jonsky
Oh and I found that (format stream "~%~%") also does the trick somehow. I don't have to explicitly enter #\return #\linefeed
18:22:34
namosca
and I get what I want, but if i make a defparameter with the first lambda, naming it a, and do the same with the second and name it b, I expected that typing (A (B 2)) would give the same result, but it just crashes saying that b is undefined, but it works if I type (funcall a (funcall b 2))
18:22:38
mood
Most HTTP clients will be fairly lenient and accept linefeeds without carriage returns
18:28:18
Jonsky
mood: hmmm... so good to know and I just found that eww browser in emacs just displayed the html source without rendering it.
18:28:48
namosca
Grue``: If I try with defun, I get: Required argument is not a symbol (x). With flet, I get "Malformed FLET definitions: a. With labels, I get also "Malformed LABELS definitions: a.
18:29:31
Grue``
otherwise, you can do something like (setf (symbol-function 'a) (lambda (x) (+ x 1))) ;; not recommended in production code
18:30:22
fouric
for the purposes of learning more about Lisp and computer architecture: does anyone in here have particular ideas for hardware acceleration of Lisps?
18:31:28
fouric
(or "if you had a wishlist for adding hardware or OS features to make Lisp development easier or implementations faster, what would be on it?")
18:31:52
mood
Jonsky: HTTP specifies that, when you don't specify a Content-Type, the client may attempt to guess what the format is. Browsers like Firefox and Chrome are fairly good at that, but eww probably doesn't even try and interprets it as a byte stream
18:34:41
mood
Heh, eww is actually not HTTP compliant in that regard: When unspecified it treats the data as text/plain, instead of application/octet-stream
18:34:48
Jonsky
aha, I see. I should read a bit about http spec then. Thanks a lot and I feel so good now!
18:37:29
Grue``
namosca: sure it did because you copied my syntactically correct code. I'm sure if you write flet correctly it would work as well
18:39:25
namosca
I tried (flet a (lambda(x) (+ x 1))) and what I get is: Malformed FLET definitions: A
18:48:00
fouric
beach: it's less that i think that they're *bad*, and more that i'm interested in making them *better*, mostly for learning purposes
18:48:42
fouric
also, reading the SBCL man page, it appears that performance improvements could be made with respect to floating-point stuffs
18:49:24
fouric
"SBCL, like most (maybe all?) implementations of Common Lisp on stock hardware, has trouble passing floating point numbers around efficiently"
18:49:43
fouric
^ implying that this is less a problem with SBCL and more with CL implementations in general
18:50:40
beach
Right, you typically can't pass a raw floating-point number as an argument to or a return value from a function.
18:51:24
fouric
(because IEEE mandates 32-bit/64-bit fp formats...which also happen to be word sizes on 32-bit and 64-bit machines, which means no tag bits)
18:52:22
foom
This is easily solved, by having specialized entry-points for functions that take raw data
18:52:59
fouric
forgive my ignorance, but i don't know if i understand precisely what "specialized entry-points" means
18:53:41
foom
fouric: the calling convention currently requires that all arguments are lisp objects. You could imagine a function that's declared to take two doubles instead having a calling convention where both args need to be hardware doubles.
18:55:04
fiveop
foom: compilers generate different entry points for functions in the the machine code they produce
18:55:45
fiveop
for example there might be one entry point that does type checking first, another that does not. The latter is used if the compiler can infere for a call to that function that the types are in fact correct
18:56:05
fiveop
(or it might used because the user declares safety 0 speed 3 (or something like that
18:57:45
fouric
fiveop: multiple entry points for the same block of object code representing the body of the function?
18:58:32
fiveop
if you are running sbcl and disassemble a function one of the first lines usually has a comment "; no-arg-parsing entry point"
18:59:57
foom
Well, it'd be cleverer if was actually used for basically anything other than self-calls.
19:00:18
lmj
flip214: that problem with sb-ext:*derive-function-types* comes from an SBCL bug affecting bordeaux-threads. https://bugs.launchpad.net/sbcl/+bug/1289779
19:00:45
lmj
flip214: Non-toplevel DEFUN forms are magically processed and given wrong return types.
19:45:10
lmj
flip214: I just posted to sbcl-devel about it. Not being able to use sb-ext:*derive-function-types* should suggest a higher priority, I think.
20:22:16
thorondor[m]
does anyone know about mezzano's author background? you really need talent and knowleadge to write something like that
20:23:07
thorondor[m]
it helps, but I don't thinks that's enough. I don't consider myself capable even with lots of enthusiasm
20:23:26
Xach
determination helps there. that's where you just chip away at what you don't know how to do.
20:24:12
phoe
and I'm halfway through parsing the specification, currently taking a much needed break.
20:25:26
phoe
CLHS, and the standard, are amazing, and they have their downsides and errors at the same time
20:25:53
_death
maybe "sucks" could be understood in a more general manner.. sucks, adj. can be improved upon; example of use: "everything sucks"
20:26:41
thorondor[m]
the thing with mezzano is that it emcompasses so many things, from hardware, low level programming, common lisp mastery (custom compiler), gui
20:29:05
thorondor[m]
I've just built mezzano today, with no problems at all, and connect from slime from the outside, very nice
20:34:06
thorondor[m]
I think it is a bit far yet. how about multi-users, permissions, full hardware support, etc
20:34:46
shka_
honestly, this stuff is potentially so different from unix that it may very well fill like different world all together
20:37:20
phoe
thorondor[m]: shrdlu68: beach has an idea of first-class environments that could be used to have a safe multiuser Lisp operating system.
20:37:52
phoe
Mezzano uses SBCL to bootstrap itself and then compiles itself again using its own compiler.
20:38:10
phoe
so I think you could use Mezzano to compile Mezzano since that's already what happens in the second stage.
20:39:27
thorondor[m]
and permissions? everything is live and accessible now. I don't think it is clear how you would introduce permissions
20:40:01
phoe
you basically create a new dynamic environment for you through which you can only access objects that are exposed to you
20:40:36
phoe
so even if you replace/redefine something that looks like MEZZANO-INT::IMPORTANT-SYSTEM-FUNCTION
20:42:40
specbot
Introduction to Environments: http://www.lispworks.com/reference/HyperSpec/Body/03_aa.htm
20:43:04
phoe
"An environment is a set of bindings and other information used during evaluation (e.g., to associate meanings with names)."
20:57:37
lonjil
shka_: quake is in C, but the version running on mezzano is lisp. froggey made a CL-outputting backend for LLVM, kinda like Emscripten. So he's transpiling C programs to CL
20:58:39
lonjil
I figure just like emscripten, he probably just makes a really big byte array to emulate pointers
21:00:33
lonjil
although I think all of mezzano runs in ring0, so I wonder if a badly written program could actually crash the OS
21:02:24
lonjil
once he releases it, I'm going to try some really badly written C programs, see what happens
21:05:49
_death
what does (loop for thread in (list-all-threads) do (interrupt-thread thread (lambda () (loop)))) do
21:07:44
phoe
_death: oh, I guess it just makes them loop forever, until the thread doing the interrupting gets interrupted as well
21:15:15
shka_
it probably allocates buffer for new bitmap, composes on that bitmap, throws old buffer away
21:33:45
gigamonkey
Is there really no CL:COMPOSE? I see there's one in Alexandria but I could have sworn there was one built in?
21:37:50
phoe
gigamonkey: if it's in Alexandria, then it means it's not in CL, and the fact that it's not in CL is enough to put it in Alexandria.
21:58:57
pjb
That said, alexandria:compose is a function taking functions. cesarum's compose is a macro taking function names. (funcall (compose 1+ sin round) pi) --> 1.14112 vs. (funcall (alexandria:compose (function 1+) (function sin) (function round)) pi) --> 1.14112
22:00:42
pjb
Also, as a function using reduce, alexandria doesn't let the compiler optimize anything, vs. cesarum macro let the compiler optimize out function calls.
22:01:10
phoe
I know that you're advertising your own stuff, but the reader macros aren't there for nothing
22:19:29
fiddlerwoaroof
Does this mean that I can make my programs real by replacing all the space between tokens with newlines?
0:24:44
drmeister
::notify phoe I was building clasp within docker - I've done that on a machine of similar configuration to origin. I'm not sure what happened but I can't ping the machine at the moment. Maybe it got knocked offline or something?
0:44:37
holycow
i'm trying to install cffi-libffi with quicklisp and it is erroring out. anyone else have the same problem?
0:57:26
holycow
i tried installing cffi-libffi via debian package manager on debian 9 but no change in error, then thought to try using ql once again to install that way and still same error
3:05:41
lexicall
is there any macro or package that performs inline transformation from infix expressions to sexps? for instance #[a+b+c*d+e] -> (+ a b (* c d) e)
3:07:06
Colleen
Bike: drmeister said at 2017.04.05 06:41:41: I wrote that utility to attach the line number of each llvm-ir instruction to each llvm-ir instruction. This should facilitate debugging code generation considerably.
3:33:42
drmeister
Well, there is the :allocation (member :class :instance) option of a slot in defclass
3:35:01
loke
Exactly, but the CLOS implementation could elect to implement :ALLOCATION :CLASS as members on the metaclass?