freenode/lisp - IRC Chatlog
Search
18:18:54
pjb
(bt:make-thread (lambda () (loop (sleep 3) (update)))) ; more or less precisely regular…
18:21:33
phoe
execute (update) in a separate thread that sets some sorta variable when it's starting, and then sets it again when it's done
18:21:48
pjb
(defmacro on-overtime (time exception &body body) `(let ((start (get-universal-time))) (multiple-value-bind prog1 (progn ,@body) (if (< time (- (get-universal-time) start)) ,exception))))
18:26:03
pjb
I saw people using MacLisp at the university on a Macintosh in 1985, and I couldn't understand then why. Later I could beat me for not having started using lisp in 1986 (ten years earlier!)
18:29:14
pjb
Teach them to read and write with a keyword: HA-NEUL ; then: (loop (print '(annyeonghaseyo ha-neul)))
19:55:43
MichaelRaskin
Mine is CL-Emb. But I am biased, I am currently nominally maintaining it (if bugs are reported, I do investigate and push a fix if I can). But I am only nominally maintaining it because I liked it and it was unmaintained, so to add features I had to pick up maintainership.
19:59:59
MichaelRaskin
Well, it doesn't actually mean I am doing anything. Most of the time it doesn't.
20:01:36
aeth
If I needed to generate HTML, I'd probably write it myself, like a true Lisper, always writing a new library.
20:03:33
MichaelRaskin
But… But… Parsing is also a fun problem with a lot of interesting things inside!
20:04:19
aeth
Parsing is comparatively rare because it's not as trivial because there's no FORMAT for parsing
20:05:06
aeth
Of course, a few lines means you used hard to read FORMAT strings instead of many FORMATs and/or lower-level writing functions
20:05:10
MichaelRaskin
… yes, the standard of Common Lisp does not include an almost complete solution for parsing, that's true
20:08:17
aeth
By rendering you mean (:html (:body)) to "<html><body></body></html>" or the character stream equivalent, right? (And a stream solution can build strings, too... the direct string solution would either use FORMAT NILs or one giant generated FORMAT string)
20:12:06
aeth
White_Flame: Parsing with FORMAT-style strings is probably a bad idea... I think C has something like this?
20:12:45
White_Flame
btw, my renderer does something I gleaned from erlang: generate nested lists of strings ("iostring"), and output it serially as a separate step
20:13:05
White_Flame
it makes more literal conses, but ends up being quite a bit faster, and WAY simpler
20:14:02
verisimilitude
Well, there's that example of writing a JSON parser using only reader macros.
20:15:00
aeth
White_Flame: I suspect comparative benchmarks would depend on with-output-to-string's implementation
20:15:54
vms14
aeth: you are right about a lisper should create it's own, and it's like one of the first exercises a lisper should make to practice with sdl
20:17:16
aeth
I suspect a generating a string from a stream is a character buffer that gets copied and doubled if it runs out of space that is then written with its length and type tag at the end, making the front part of it a valid string. Possibly more efficient than anything we can directly write in CL itself
20:18:24
aeth
"character buffer" being probably UTF 32 characters, not C chars, even though I described a C-like algorithm
20:19:44
aeth
What you can't directly do in CL itself is cut the length of the string once the final size is known. You'd subseq, although a sufficiently smart compiler could see that that is the last use of the original
20:23:11
aeth
(You also can only have adjustable vectors by changing its type or doing the copying manually.)
20:55:21
pjb
aeth: you can directly cut the length of the string, if you allocated it with a fill pointer, or as an adjustable array.
22:54:23
Josh_2
If I (bt:kill-thread <thread>) and that thread is running a function that has a handler-case does the handler-case get called?
22:56:01
Bike
" Terminates the thread THREAD, which is an object as returned by MAKE-THREAD. This should be used with caution: it is implementation-defined whether the thread runs cleanup forms or releases its locks first. " oh, good
22:58:04
Josh_2
I need a big boi thread to stop my other networking threads, currently I just use destroy-thread but the unwind-protect doesn't seem to be called
23:03:07
Josh_2
I think the best way to kill my threads would be to have a variable that the threads will atomic read to check if they should continue
23:13:27
tsizz
idk. all i remeber is that graham website about lisp and he wrote websites with lisp. and since i work with web for now, i thought that'd be cool
23:14:38
Josh_2
There is Hunchentoot which is a webserver and you can use a library like cl-who to generate html
23:15:12
Josh_2
I personally just write the JS normally and include the scripts in my cl-who functions
23:18:44
Josh_2
https://plaster.tymoon.eu/view/1244# this is the navigation bar in this image https://cdn.discordapp.com/attachments/252495909517131776/553259132589703169/yeet-site.png
23:19:15
Josh_2
So whenever I want a navigation bar I just call the function (navigation) within a with-html and it will display that bar in that site
23:20:50
Josh_2
So the client requests a page on my hunchentoot server, the server then generates the page dynamically and serves it to the client
23:22:00
Josh_2
But remember how you use <script src= ...> in html, well all my scripts are just included in my dynamically generated html
23:22:10
aeth
pjb: But only a implementation internals can do this with the simple-string that with-output-to-string returns, i.e. (type-of (with-output-to-string (out) (format out "Hello, world!~%"))) => (SIMPLE-ARRAY CHARACTER (14)) ; technically, only string is specified, but I'm sure some code would break somewhere if it wasn't a simple-array
23:23:21
aeth
If you implemented it yourself you'd have to copy it into a simple character array at the end, or manually adjust it with (simple-array character (*))s and subseq at the end to get the correct final length
23:24:14
Josh_2
tsizz: https://plaster.tymoon.eu/view/1288#1288 that is my html header which is part of all the pages
23:25:26
Josh_2
so my index page ends up being (defun index-page () (with-html (:html (header) (index-body))))
23:25:27
tsizz
import is big in JS/node, but isn't that not a thing in lisp or is that just my academia just talking about strictly functional programming
23:25:33
aeth
pjb: Actually, slight correction, I should have used typep since reporting either simple-array character or simple-string is up to the implementation.
23:27:10
Josh_2
so cl-who the library I'm using to generate that HTML is imported like (ql:quickload #:cl-who) once you have quicklisp installed :P
23:28:05
tsizz
Josh_2: okay cool thanks im reading the first part right now the why learn CL part hha
23:28:36
tsizz
i think this is the one of the most intriuging parts "You'll get more done, faster, using it than you would using pretty much any other language."
23:29:41
Josh_2
you will get things done faster if the program is sufficiently complicated, not sure if people will agree with me
23:30:28
Josh_2
doing simple things can seem a bit annoying but when it comes to doing harder things its a joy to use CL
23:33:14
Josh_2
well major libraries are all documented really well, but stuff you find on github might not be
23:36:08
tsizz
im just a bit confused bc natural language for browser is JS so when CL comes in the picture not too sure
23:36:46
Josh_2
so all ur webdev stuff still works but you can use CL as your backend instead of PHP
23:38:17
tsizz
but then dynamic stuff...? u use js or some CL library that compile to JS or something..?
23:38:20
Josh_2
The client sends a request to my Hunchentoot server, which then evaluates some functions to get the HTML it then sends that HTML to the client
23:41:16
aeth
tsizz: A slight variation on what Josh_2 is saying... I personally find that writing things from scratch in Common Lisp is easier than in just about any other language, but that the necessity to write things from scratch is greater, so I'm not sure there's a real net time savings or not. It does suggest that CL is well-suited for very underexplored problems, though.
23:41:51
aeth
Writing something in C++ or Java is much harder than CL but someone else almost certainly already wrote a library to do it.
23:46:46
aeth
Really, none of the above. ML is done on GPUs (or specialized hardware, like Google's TPUs).
0:02:08
no-defun-allowed
there's some ML libraries in CL without C, I am finishing up a deep network library with Petalisp, and GPU programming can be done in "Lisp" using oclcl
0:02:30
aeth
Isn't ML just essentially running CUDA or OpenCL (nothing to do with CL as in Common Lisp) or similar?
0:03:27
aeth
I'd be interested in seeing a proper abstraction over SPIR-V so Lisp-like GPU-oriented languages can compile down to it.
0:05:50
no-defun-allowed
yeah, but most people abstract the GPU (or TPU i guess?) as a machine that does matrix multiplication and element-wise sigmoids, adds and multiplies
0:06:03
verisimilitude
That would be amusing, at the least, using a Lisp for that idiotic idea of ``machine learning'', when it's more suited to proper symbolic manipulation.
0:07:12
no-defun-allowed
indeed, but symbol manipulation doesn't make much sense in a high performance matrix library, and you can't get the kids hooked on calculating derivatives unfortunately unless they're maxima users
0:07:39
no-defun-allowed
well, the IR is SSA like LLVM which isn't very lispy (i have a library that converts trees to LLVM IR/SSA for that reason)
0:07:49
no-defun-allowed
https://www.khronos.org/registry/spir-v/papers/WhitePaper.pdf may be of interest?
0:09:16
aeth
no-defun-allowed: In CL, you have far more abstractions available to you than in most other languages for dealing with things like e.g. GPU shaders. This is because you can transform arbitrary s-expressions into just about anything you want. Other approaches would probably be string-to-string or heavily object-oriented (not too unlike a database ORM) or similar messes.
0:09:38
aeth
verisimilitude: Common Lisp has been an acceptable FORTRAN for years at this point, especially SBCL. It's not just symbolic.
0:14:09
aeth
Bike: At the moment, most SPIR-V tools are LLVM and/or C++ oriented. Targeting SPIR-V properly from CL involves a lot more than e.g. targeting GLSL properly (really, that can just be generating a valid source string). Just look at https://www.khronos.org/spir/ and then https://www.khronos.org/assets/uploads/apis/2018-spir-api-ecosystem.jpg
0:21:41
aeth
verisimilitude: The way you harmonize symbolic behavior with numeric behavior is by writing some pretty low level CL. (SBCL works pretty well with the structs-of-arrays low-level pattern, and nothing is stopping other implementations from similarly optimizing.) You then abstract over these low-level details, including via macros, getting something pretty high level, as if you wrote your own programming language to solve the problem.
0:22:08
aeth
Not really a particularly good solution for ML in particular, though, because afaik serious ML is done on GPUs, so you'd need to write your own GPU-mini-Lisp.
0:23:05
no-defun-allowed
though, i wonder how hard writing a petalisp backend is, probably too hard for me, but running it on a GPU should be possible i think if you can copy over all the GPU-used functions too
0:27:35
aeth
You wouldn't want to put a proper Lisp on the GPU because proper GPU programming is all about knowing when to do things on the CPU and when to do things on the CPU. Implementing it as a DSL in CL means you can do all the macros, list processing (probably for the macros), etc., on the CPU in CL.
0:28:06
no-defun-allowed
of course, i'm suggesting a backend for a matrix processing library that offloads work to the GPU
0:28:36
aeth
I'm not sure about GPU compute, but GPU graphics shaders definitely have a "program" metaphor that imo is unnecessary. Why not just define-shader-function etc.?
0:31:47
aeth
The whole thing is structured for familiarity for C programmers, but it's pretty far from PDP-11 so it's imo pretty weird imo to see things like a main()
0:39:58
no-defun-allowed
makes the C++ people feel fuzzy inside, and makes the interface fuzzy for everyone else
0:40:59
aeth
More "UNIX philosophy" than C++. It's pretending you're doing something Unixy with independent programs like: head -n 42 foo.txt | grep bar
0:48:48
aeth
GLSL for GPU shaders is kind of strange. Every shader stage has its own main() but then you link them. But you'd just get a multiple main()s issue if you tried that with GCC and C... so it's inconsistent in its C-like behavior. Shaders aren't programs!
0:49:50
aeth
tsizz: Common Lisp is mostly compatible with the historic Lisps, so it seems more archaic than Scheme, which broke compatibility with historic Lisps and even itself.
0:51:26
aeth
tsizz: Common Lisp is a primarily a replacement for Maclisp and Interlisp, which predate Scheme, and Lisp Machine Lisp, which apparently came out in the same year as Scheme. See the timeline at https://en.wikipedia.org/wiki/Maclisp#History
0:56:03
aeth
tsizz: Newer is definitely always better for programming languages... because that way you can't use anyone else's code and have to write all of the key libraries yourself!
0:58:38
tsizz
aeth: since ur saying that tho, i feel like current languages do have way better support, but im not sure
0:59:26
aeth
tsizz: Current languages? Most new languages either have nothing or they're backed by Google, Apple, Microsoft, etc. Many are built on the JVM so they can just use Java libraries.
1:00:59
aeth
JavaScript has a ton of libraries because its bar for "library" is much lower. A single function can be a library in JS land.
1:02:23
aeth
(Okay, CL has one popular library that comes close to that: split-sequence, but it's very non-trivial and it has three functions.)
1:08:14
verisimilitude
Common Lisp wasn't designed in a week and wasn't designed solely by people who had no place designing a language.
1:08:40
verisimilitude
Not counting Ada revisions, I'm not aware of a single new language that is worthwhile.
1:14:57
aeth
verisimilitude: The ML family of languages (and influenced languages like Haskell) have some interesting ideas. There are also some specific language features that might be interesting, such as async.
1:17:23
aeth
Looks like Standard ML is 1983 so it predates CL by a year, though. Haskell is 1990, OCaml is 1996.
1:20:04
aeth
Another language of potential interest for proglang design features is Erlang (1986). I'm probably missing a few more, but quite a few interesting languages are pre-1984 languages.
1:21:16
aeth
The 1990s were mostly about web-oriented Unix scripting languages... exactly the sort of thing you'd probably not call interesting, e.g. most of the ones here: https://en.wikipedia.org/wiki/History_of_programming_languages#1990s:_the_Internet_age
1:22:57
aeth
verisimilitude: Just looking at that history page... Forth is 1970, APL is 1962, Smalltalk is 1972, Prolog is 1972, SQL is 1978... all of which might be interesting even to a CL programmer. I was trying to exclude languages that weren't "new", relatively speaking.
1:25:21
aeth
Julia seems to be the only really new (released this decade, specifically in 2012) major language that interests Lispers.
1:26:37
aeth
I don't really see what others seem to see in it, though. It's dynamically typed but the fast numerical code that does well in benchmarks uses type declarations... exactly like SBCL.
2:04:43
Hexstream
Check out the Common Lispers list! Discover Common Lisp open-source contributors and their best contributions! Add yourself! Gone are the days of toiling in obscurity, now everyone has a chance! We're ushering in a new era of unprecedented discoverability!
2:22:31
pjb
Once we've done (ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil), how can we select it as default distribution for ql:quickload?
2:51:24
Hexstream
The "barren" setting is a planned feature, but unfortunately won't happen soon. My version has always contained 148 "RS" links to easily get to the corresponding section in Robert Strandh's more barren version.
3:57:14
patrixl
I'm trying to use cl-sqlite on my Mac, as part of using Radiance. So Radiance + cl-sqlite needs regex support in sqlite, which is fine I can install it, however.....
3:57:38
patrixl
so I installed one with brew which supports it, and compiled regex support for that one and it works
3:58:02
patrixl
but it seems like cl-sqlite still uses the default sqlite and not the one compiled with brew. Not sure if I can somehow make it use the newer one?
3:58:20
patrixl
hopefully someone here has similar experience and can help... otherwise I'll have to dig in and figure it out ;)
4:00:31
patrixl
right, well as far as I can see, cl-sqlite is usinf cffi, so I would assume that it would need to find the correct libraries when cl-sqlite is being compiled?
4:00:59
jackdaniel
Hexstream: is there exclusion policy? while I appreciate the effort I have mixed feelings about such data aggregation and public release without my consent
4:05:23
patrixl
ok let me try to clear the cache ,and try what brew is suggesting, see if cl-sqlite can find the correct libs this time
4:05:47
patrixl
if not, then you would recommend adding brew's sqlite lib path to cffi:*foreign-library-directories*?
4:10:08
patrixl
yeah!!! now I am actually hitting bugs in Radiance, so at least I can move forward lol
4:11:10
Josh_2
anyone know how to send a mouse click event with Xlib? am using (xlib:send-event :pointer-window :button-press 256 :display display) but I get no-applicable-method :O
4:36:44
equwal
Is is possible to have an immutable variable? So (and (setf *five* 5) (setf *five* 6)) will give an error? I can make immutable structures with defstruct, but I can't store them.
5:12:51
pjb
equwal: well, defconstant defines a constant variable, which is a variable with a constant binding. However this constant binding can be made to a mutable object!
5:13:15
pjb
equwal: (defconstant +cell+ (cons nil nil)) (setf (car +cell+) 42) +cell+ #| --> (42) |#
5:14:09
stylewarning
Coalton now has basic pattern matching. (Not as expressive as a full fledged ML or Haskell but it’s getting there.) https://github.com/stylewarning/coalton/blob/master/src/library.lisp
5:44:50
stylewarning
it's better to just design an API that discourages mutability, e.g. by making copies, not exposing accessors, etc.