freenode/lisp - IRC Chatlog
Search
17:09:37
nij
Amazing: (sscanf "000000004713b902: 00000002 00000000 00010000 0005 01 19462 /run/WSL/8_interop" "%x: %8x %8x %8x %4x %2x %5lu %s") ;; => (1192474882 2 0 65536 5 1 19462 "/run/WSL/8_interop")
17:24:46
dieggsy
splittist: you have (sscanf "123 abc" "%d %s"), i'd almost expect (sscanf "%d "%s" "123 abc")
17:27:43
splittist
dieggsy: yeah. But that's how C does it: int sscanf(const char *str, const char *format, ...);
17:28:24
splittist
dieggsy: it kind of makes sense if you think of fscanf having the FILE *stream first
18:21:48
gigamonkey
I gather the folks who wrote uiop consider uiop/pathname a replacement for cl-fad. Can anyone point me to any discussion about why certain things that are in cl-fad are not in uiop (e.g. pathname-as-file unless I'm missing something)?
18:28:26
jackdaniel
(member '|Alpha| (list '|Alpha| '|sdas|)) for heavy-wieght eq-comparable not mutable strings ,)
18:29:14
phoe
you forgot about interning, please consider '#:|Alpha| as ultra-ugly heavyweight eq-comparable immutable strings
18:31:25
Shinmera
gigamonkey: Fwiw I wrote my own pathname mangling library in https://shinmera.github.io/pathname-utils
18:32:17
gigamonkey
Shinmera: well, it's just about manipulating pathnames. Like if you wanted to create a file name based on a directory name.
18:32:31
Shinmera
It has a very different idea of what it means to turn a pathname into a "file pathname"
18:33:04
gigamonkey
E.g. (let ((p #p"some/dir/")) (merge-pathnames p (make-pathname :type "foo"))) gives you a goofy result of a pathname with a type but no name.
18:33:28
gigamonkey
Whereaas (let ((p #p"some/dir/")) (merge-pathnames (pathname-as-file p) (make-pathname
18:34:19
gigamonkey
To my mind? If I have a directory named foo/bar/ and I want to make a file foo/bar.whatever it does that.
18:37:54
Shinmera
I guess. My disagreement I suppose comes from directories and files being fundamentally of different purposes, so "converting" a directory into a file seems wrong. I would have worded the same maybe like this: (make-pathname :name (pathname-utils:directory-name path) :type "foo" :defaults (pathname-utils:parent path))
18:40:02
gigamonkey
Yeah. The whole point of CL-FAD (when I wrote the original code for PCL) was to do syntactic manipulations of pathnames. And because pathnames distinguish between directory names and file names I needed a function to say, how would I make a syntactically correct pathname that is the "same" name but as a file.
18:44:59
Shinmera
The depressing thing about writing pathname-utils was that a lot of the behaviour around munging pathnames can be hairy on certain implementations.
18:56:37
loskutak
Hi, I want to do a SVD decomposition of (small) matrix in common lisp. Is there any library, that could do that for me? I have tried gsll, but so far I couldn't get it to work.
18:57:46
jackdaniel
dieggsy: yes; but then you limit yourself to .a linkage (i.e no C-compiled fasls)
18:58:20
jackdaniel
that limitation is more a defect than a hard constraint - it could be fixed with code
18:59:02
jackdaniel
compile ecl with --disable-shared to have libecl.a; as for how to compile libraries (with dependencies) to static libraries, check out examples/ directory
18:59:59
dieggsy
is there a big performance difference between e.g. SBCL and ECL (i know SBCL is like the holy grail of lisp performance lol)
19:00:51
jackdaniel
sbcl is much faster for a) generic function dispatch, b) inferred numeric operations
19:01:51
jackdaniel
sure. here is somewhat dated benchmark: Bhttps://common-lisp.net/project/ecl/static/files/misc/benchmarks/2016-05-bench-all.html
19:03:41
jackdaniel
I believe that a type inferencer and a fast generic function dispatch will bring ecl much closer to more performant implementations
19:04:15
Josh_2
does anyone know how SBCL compares to commercial implementations in terms of performance?
19:05:05
jackdaniel
Josh_2: I believe Rainer Joswig ran cl-bench also against lw and allegro, but I don't remember for sure
19:05:27
loskutak
In fact, I want to solve A*x = 0 (nullspace of A), so non-SVD methods would probably be ok as well.
19:08:20
dieggsy
hmm, what would be the best method to live code an ncurses application? Start a swank server in the program ?
19:09:58
loskutak
dieggsy: idk, I probably just cannot load it properly. I do (ql:quickload "gsll"), (in-package :gsll), then I want to create the matrix with (make-marray) and I get gsll::make-marray is undefined... I am quite new to CL, so I have no idea what is going on... I have also tried testing the installation with (asdf:test-system :gsll), but that fails after while with heap exhausted error
19:10:22
jackdaniel
dieggsy: here is a rather hackish tutorial (for cl-charms binding to ncurses) :http://turtleware.eu/posts/cl-charms-crash-course.html
19:10:49
jackdaniel
on the same blog you will see also two tutorials about controlling the terminal without ncurses
19:11:09
jackdaniel
http://turtleware.eu/posts/Controlling-the-terminal.html; http://turtleware.eu/posts/Charming-CLIM-tutorial-part-2--Rethinking-The-Output.html
19:13:48
charles`
Would it be bad to tell a user to redefine a function from my library for configuration?
19:14:22
dieggsy
loskutak: for example, after (ql:quickload :gsll) you can use the gsl:sv-decomposition function
19:17:15
Shinmera
if by define you mean set, yes. At least then reloading your library would not override it (provided you defvar).
19:17:33
Shinmera
but it's still not great if multiple different actors would want to configure different aspects of your library.
19:20:16
loskutak
dieggsy: cool, this works - I can gsl:sv-decomposition, but if I give it an array created by (make-array '(2 3) :initial-contents '((3 2 2) (2 3 -2))), it fails with: There is no applicable method for the generic function ... gsll:mpointer (3). So I guess I have to convert the array to some other type?
19:23:14
dieggsy
loskutak: dunno, i've never used it, i'm just googling stuff. i'd suggest https://common-lisp.net/project/gsll/#examples and https://quickref.common-lisp.net/gsll.html
19:29:22
loskutak
dieggsy: it seems that they create a matrix with #2m(...), but that gives me "no dispatch function defined for #\M"
19:29:59
jackdaniel
dieggsy: there is only one terminal, and that termial is accessed with standard-output (and other) streams bound in the thread started from said terminal
19:30:17
jackdaniel
so this (sleep 1) is to not have the repl in that "main" thread get in the way with input and output processing
19:30:52
jackdaniel
for example repl calls (read); so it is first waiting for a character (or a line) - to not have that you make it "busy"
19:34:14
loskutak
_death: sorry, I am new to this - what does it mean that it is not exported? Can I load it somehow, or does that mean, that I have to copy the function definition to my code?
19:36:32
_death
loskutak: it means it's not advertised as public by the library.. you can still call it like (cl-mathstats::singular-value-decomposition matrix)
19:37:46
dieggsy
loskutak: looked online for someone using GSLL : https://github.com/mnasoft/math/blob/0ab85a3a1b73f77d9283044df003b1d08547921f/src/ls-solve/gsll-samples.lisp
19:42:44
_death
loskutak: the library hasn't changed much in the last decade, so I think it's not a big deal.. you could try to submit a pull request that exports that symbol, or maybe start maintaining your own fork
19:45:22
Josh_2
Well I have (declare (special *validate*))(when (and (boundp *validate*) *validate*) <do my thing>)
19:48:42
loskutak
dieggsy: thanks, I am now able to create the matrices. So much pain... To finally arrive to "Requested feature not (yet) implemented; svd of MxN matrix, M<N, is not implemented in svd.c at line 60" :D
19:52:35
loskutak
I will now try the cl-mathstats svd, then do it with QR decomposition from 3d-matrices instead and if I fail on both of these I will just give up... I am really trying to like CL, but using any external code feels like hitting my head against a wall again and again. It is not very newcomer-friendly :D.
19:57:50
dieggsy
loskutak: good computational math libraries are hard to come by in most languages that aren't like the top 5
20:00:50
loskutak
that is understandable. I use python/numpy for most of my work, so I am used to having these functions. I was happy that there is numpy "clone" numcl, but that doesn't have the SVD implemented.. :/
20:03:27
jackdaniel
dieggsy: say you start lisp form the terminal. the repl runs and it calls (read-line)
20:04:33
jackdaniel
since the first repl already called dips, the first input will go to it (and confuse you probably)
20:05:45
Shinmera
I've had jonathan hard crash my lisp because it apparently does some really nasty shit in the name of optimisation.
20:06:44
jackdaniel
jsown has that safety 0 speed 3 declaration, just so you know (it may have unhandled memory faults for incorrect input)
20:08:44
loskutak
great news, the cl-mathstats SVD works :). It cannot do MxN matrices with M<N either, but it helpfully told me to add rows of zeros and then it works :) (except it doesn't sort the singular values, but that would not be a problem). I have then tried this "add zero rows" trick in gsll and it works too and gives me more precision. Thanks a lot for all the help, guys.
20:25:31
dieggsy
loskutak: nice! I'm definitely no stranger to missing numpy's convenience in other languages, so i feel your pain heh
20:40:06
dieggsy
moon-child: that's very cool and i hadn't heard of it, but I'm not sure I'd describe APL as "convenient" heh
21:47:30
dieggsy
besides rlwrap (and of course slime from emacs), is there a go-to for a more pleasant terminal REPL experience?
21:49:21
dieggsy
also, do you guys use roswell? can it be made to play nicely with quicklisp or do i have a misconception that they're somehow separate
22:00:14
dieggsy
hmmmm. i've figured out using roswell with system lisp, i wonder if i can make it use my pre-installed quicklisp as wel
22:03:22
dieggsy
moon-child: ros install install is failing with Symbol "%SIMPLE-FUN-NEXT" not found in the SB-KERNEL package.
22:33:41
MetaYan_
dieggsy: sbcl-readline is not in the distribution, so to install it, one just clones it in ~/quicklisp/local-projects/ and runs (ql:register-local-projects) once.
22:36:53
MetaYan_
dieggsy: I use it because it has completion and easy access to function documentation, plus it saves history.
22:39:14
dieggsy
i'm still mostly use slime, but having something nice to fallback to is always nice
22:44:30
MetaYan_
dieggsy: I have many with different OSes, so yes. Lisp works fine on all ;). Why? (Maybe continue in #lispcafe)
3:12:18
beach
hegz: #lisp is not really for truly basic questions, but they are tolerated. If it gets too lengthy, you might be redirected to #clschool. What are your plans with respect to Common Lisp? Write applications? Just play around? Something else?
3:18:02
beach
Thought I guess there are some questions that are "truly basic" but where the answers won't hurt to be repeated here, like the semantics of argument passing and how lists are represented.
3:26:54
hegz
beach I'm still not sure whether I will dig deeper into CL or not tbh, my journey with lisp was mainly me reading SICP and I was kinda surprised this channel is specific to CL but not lisps in general haha
3:28:12
beach
I see. Well, SICP is a nice textbook for genera ideas about programming, like encapsulation, etc. But the style of object-oriented programming in SICP is not as practically useful as CLOS.
3:31:11
beach
hegz: There is ##lisp for general Lisp discussions, but since there is no widely agreed-upon definition of "Lisp", I imagine the discussions can become strange. That's part of the reason I am not in that channel.
3:37:36
hegz
beayeahch yeah, the main reason that drove me into starting with SICP was the approach to programming in general and you get to learn scheme as a bonus haha.
3:37:45
Nilby
hegz: One of our lispers has written a Scheme in CL in case you want to do both at the same time - https://gitlab.com/mbabich/airship-scheme
3:41:01
hegz
<Nilby "hegz: One of our lispers has wri"> Lispers seem to love porting stuff don't they haha
3:43:23
Nilby
Yes they do, myself included. Once you have a CL environment that you like, it's hard to go back.
3:43:53
raeda
no-defun-allowed: Are you saying that nobody's made a self-hosting CL interpreter yet?
3:44:53
no-defun-allowed
A self-hosting interpreter? SBCL has an interpreter written in Common Lisp, but there aren't any full Common Lisp systems written entirely in Common Lisp (including garbage collector, operating system interface and so on).
3:45:13
beach
raeda: Modern Common Lisp systems don't have an interpreter at all, so it is entirely possible that nobody did that.
3:47:36
hegz
does it have something to do with the application or is it just entirely opinionated tastes.
3:48:31
beach
hegz: The condition system is unique, as is CLOS. But, again, there is no widely agreed-upon definition of "Lisp", so it is unclear which these "other lisps" might be.
3:49:32
no-defun-allowed
Common Lisp is a programming system, most other Lisp languages are just that.
3:50:08
Alfr
Hm ... i guess, getting away from C also would mean to implement handling systems calls.
3:51:30
moon-child
Alfr: system calls are not difficult. The challenge is that few systems have a stable syscall interface
3:51:51
beach
raeda: I suggest a compiler instead. It will take a bit longer, but it will be more useful.
3:52:17
no-defun-allowed
My personal opinion is that CL has more in common with Smalltalk or Self than some other Lisps (though it is hard to make a case with Scheme, I dunno).
3:54:11
Alfr
no-defun-allowed, in scheme you have call/cc and thus you can easily get green threads. (I think you were complaining the lack thereof recently.)
3:54:16
no-defun-allowed
The language is designed around interacting with an image, and there are facilities to make it work nicely in the language and its implementations.
3:54:20
beach
Alfr: System calls are messy either way. I have a long-term project for defining an implementation-independent protocol for POSIX and Linux system calls.
3:54:55
no-defun-allowed
Alfr: But then you also have call/cc and apparently if you breathe on it hard, you get performance problems. Don't get me wrong, I find it fun, but everyone else seems to think it's a bad idea.
3:56:08
no-defun-allowed
All that is necessary is a one-shot undelimited continuation, not multi-shot. And that is basically just a copy of all the registers of the thread, which is what operating systems use already.
3:59:38
Nilby
Even C isn't always exactly self-hosting as people thing. Ironically a popular C compiler has some tricky bits in a Lisp-like language.
4:01:06
no-defun-allowed
There is a .pd file with some S-expression stuff (pd for pattern dispatch?) and it is used for partial evaluation of C code.
4:01:40
beach
Nilby: RMS opted for a free version of Unix, rather than a free version of Genera, for political reasons. And he was right. If I had been in the position of RMS at the time I would have made the wrong decision.
4:01:51
no-defun-allowed
https://github.com/gcc-mirror/gcc/blob/master/gcc/match.pd Hm, yes, this is Lisp.
4:02:32
no-defun-allowed
Funny how I say that so-and-so clearly isn't Lisp, but then say I don't care because a language which just passes the definition doesn't interest me.
4:04:01
moon-child
no-defun-allowed: is that really lisp? I see quite a lot of c syntax, which would seem to indicate that's an sexp shim
4:04:33
Nilby
beach: I think it was also that he already had Emacs running on unix, and finding people who could write unix utilities is much easier than finding people to replicate Genera.
4:05:39
beach
Nilby: Yes, that's what I meant by "political reasons". His idea would have been a failure if he had chosen something other than Unix to copy.
4:06:43
beach
Nilby: But that must have been a very hard decision to make. Knowing that there is something better, but choosing the worse alternative anyway. I remember his phrase "Unix is not great, but it is not too bad".
4:08:19
Nilby
Exactly. I guess that's why we're still using Emacs as the top half of most of our current CL environments.
4:24:04
no-defun-allowed
I thought he didn't like keyword arguments at least, and this was from a presentation at some Lisp meeting in 2005.
4:24:40
no-defun-allowed
https://www.gnu.org/gnu/rms-lisp.html is a transcript of RMS at ILC 2002 rather.
4:25:41
no-defun-allowed
"I don't mind if a very complex and heavyweight function takes keyword arguments. What bothers me is making simple
4:25:41
no-defun-allowed
basic functions such as “member” use them." Fine, write a simple definition of object equality first.
4:25:49
Nilby
beach: Yes. It's interesting to see his votes and opinions on the CL committee. And funny that only after he's backed off does Elisp get nice things lexical scope.
4:30:02
Nilby
And funny that Gosling doesn't get more credit for writing most of the C code in the first versions of GNU+/Emacs, even if he made the worst lisp ever.
4:38:32
Jachy
I'm still amazed at how prolific Stallman was just in keeping up with a dozen already prolific Symbolics hackers in duplicating so much of their functionality for LMI.