freenode/#lisp - IRC Chatlog
Search
10:20:04
hjudt
is there an easy way to read a whole text file into a string instead of reading it line by line and concatenating?
11:33:59
jackdaniel
you may want to read about the differences between ~s and ~a (readably vs unreadably)
12:20:42
genos
(sudo rsync --verbose -r --ignore-existing ~/Downloads/books/* /media/${whoami}/247B-947E/books)
12:20:42
genos
(sudo rsync --verbose -r --ignore-existing /media/${whoami}/247B-947E/books/* ~/Downloads/books))
12:21:10
Shinmera
This is not the channel for elisp or emacs. And it's even less the channel to just paste code into.
13:07:07
Xach
scymtym: xml.location references lisplab in one of its systems, but lisplab isn't in quicklisp - should i add lisplab? or ignore the xml.location system?
13:19:41
scymtym
Xach: it used to be an optional dependency but is no longer relevant. i can just remove the integration
13:20:30
scymtym
Xach: i have been meaning to do that for quite some time but forgot about it. thanks for bringing it up
13:22:12
Shinmera
That depends on your file system, but generally no. You can write out a new file and delete the old one though.
13:30:50
billitch
the url scheme is subject of much more design than disk layout which is left to the OS
13:34:53
billitch
well i think the most common data structure is a variable length string which is the filename
14:18:16
pjb
(setf (ldb byte place) val) = (setf place (dpb val byte place)) ; but without the place duplication.
14:20:49
jmercouris
there doesn't appear to be a straightforward way to copy a dir in CL, is there one I'm not seeing?
14:21:42
jmercouris
I see uiop:copy-file and I guess I could copy the folder file, but I'm not sure how that would work
14:21:46
_death
jmercouris: copying a directory (or even a file) is not a straightforward operation.. it depends on what you want to use it for
14:22:21
jmercouris
_death: I'm trying to copy a directory of static assets for exporting a site-generator page
14:22:30
Shinmera
jmercouris: Use DIRECTORY, a wild-inferiors pathname, and COPY-FILE, and ENSURE-DIRECTORIES-EXIST.
14:23:14
_death
jmercouris: here's an old snippet https://gist.github.com/death/2b7b1cfe6a38fc4b368ba91419c75e2e
14:26:07
_death
jmercouris: depending on your situation, it may even make sense to invoke cp -R or somesuch
14:26:08
jmercouris
Shinmera: What do yo umean by "wild-inferiors" pathname? a pathname that includes a wildcard matching all child files of the dir I wish to copy?
14:27:15
Shinmera
jmercouris: For instance: (make-pathname :directory '(:absolute :home :wild-inferiors))
14:28:39
jmercouris
Shinmera: So i'd match all the dirs, and which I would then have to walk, and then match all the files and then copy them?
14:29:40
Shinmera
(directory (make-pathname :name :wild :type :wild :directory '(:absolute :home :wild-inferiors))) will list all files reachable from your home directory.
14:30:46
jmercouris
Right, so I would still need somehow to know the tree structure of the dir I'm copying over
14:31:35
Shinmera
You truncate off the common path to make it relative, then make it absolute to the destination directory again. Then use ensure-directories-exist to make sure the folders are there, then copy.
14:31:42
jmercouris
That's true, but unless there's a copy-file flag that will construct all the necessary folders to get to a path, I'd still need to somehow do some processing no?
14:33:51
Xach
For example, getting a list of relative pathnames via DIRECTORY on a given base directory has a pitfall to carefully avoid.
14:34:18
Shinmera
Yeah, might do symlink resolution or truenaming, so your paths might not all have the same root.
14:34:22
Xach
if the base pathname isn't a truename, the results from DIRECTORY won't be amenable to enough-namestring.
14:34:49
_death
ACTION wonders why that snippet didn't give him a warning as it's missing a symbol in import-from
14:35:36
jmercouris
would be a nice utility for someone to write though, or nice to have in uiop like uiop:copy-dir
14:37:08
Xach
It sure would be nice to have a utility like that. I can understand why it's hard to get right, though.
15:42:59
rumbler31
not bad on the east coast of the US, waiting for it to make up its mind about the cold
15:46:04
JuanDaugherty
ACTION is only wanting to destroy all humongs by merciful means, does that count as a good day?
16:06:46
Xach
http://report.quicklisp.org/2018-01-26/failure-report/claw.html <-- argument count mismatch
16:38:02
pjb
beach: I have a suggestion for sicl (and really, for all CL implementations): annotate the function with the special variables used, and issue warnings or print notices about them (systematically and automatically). Notably, for implementation operators. Again this week somebody in #ccl had a problem that a ccl function to open a network stream failed, when *print-base* or *print-radix* were different from the default value; thi
16:38:02
pjb
function used princ to convert a port number to a string… This can be considered a bug, but in any case, it should be documented!
16:56:01
pjb
beach: by annotate here I mean in the compiler data structures. So that it may issue the warnings or write notices on its output.
16:57:27
rumbler31
paule32: in half adder you also setf a and b, but take in i1 and i2. I don't think these would explain your errors though, since a,b,c are globals, but maybe the fact that they are special is messing things up
16:58:44
makomo
pjb: hmm, why would you need to document it if it's only used internally by the function?
16:59:12
makomo
if we suppose that the function correctly binds *print-radix* and w/e it needs before PRINC-ing
17:02:07
megachombass
if i manage to compile fibo (means be able to compile constants, a defun and a IF) ill be good
17:04:47
pjb
beach: additionnal similar annotations could be about side effects: mutation of bindings, mutation of lisp objects, and mutation of external state (file system).
17:05:02
shrdlu68
megachombass: You'd be better of using "CL" instead. clisp means something different to most people here.
17:05:55
pjb
beach: the problem being that programmers have a mental image of what state is used or mutated by functions, but it is not always exact (eg. a lot of *print-…* variables are ignored for non-I/O functions…), and it's in general unknown for implementation specific functions.
17:07:11
pjb
makomo: yes, indeed if there is a local dynamic binding of a dynamic variables used by a function, then it can be removed from the list of dynamic variables usedby the caller.
17:10:05
makomo
megachombass: clisp happens to be the name of a particular cl implementation. that's why you should use "cl" instead when referring to common lisp as a language
17:11:57
pjb
megachombass: it's easy, Common Lisp comes from a package named "COMMON-LISP" and with a nickname "CL". So call it common-lisp or cl.
17:12:19
pjb
"LISP" was an old, pre-standard nickname. This is why #lisp is #lisp and not #cl or #common-lisp :-)
17:13:35
pjb
beach: (dynamic-variable-used-by-function 'concatenate) -> (*debugger-hook* …) assuming it signals type errors, and signal calls invoke-debugger which uses *debugger-hook* ;-) See the range of the problem…
17:14:30
pjb
perhaps the result will be that all functions always use indirectly all the standard dynamic variables. :-(
18:29:48
phoe
pjb: is https://github.com/informatimago/lisp/tree/master/common-lisp licensed under GPLv2 or GPLv2+?
18:31:00
phoe
I see a file called GPL there that confuses me, because the main README states that the project is AGPLv3 with exceptions.
18:31:36
megachombass
so, do you guys see any useless code, reduntant code, or better way to do things here? https://codepaste.net/aspmng
18:34:26
jackdaniel
this is waste of everyone time if we click that link and decide, that it's not formatted correctly and point that out *again*
18:35:08
jackdaniel
I think that you need to understand: formatting your code and aesthetics is a *prerequisite*, not an addendum
18:35:40
beach
You are supposed to do it before submitting the code, because otherwise, you put additional burden on the people you are asking for help. That is so incredibly rude, especially since you have been told this already.
18:40:23
beach
megachombass: See if from my point of view. You come here and ask for improvements. I spend time and energy on you. Then you completely ignore what I told you, and submit crappy code again. What makes you think I would want to help you again?
18:40:41
megachombass
https://codepaste.net/y6mtwn whitespaces removed, parenthesis on the right lines.
18:46:07
phoe
it contains emacs + sbcl + slime + git in a pretty nice package that should work out of the box
18:49:05
jmercouris
phoe: +1 on the portacle reccomendation, always very easy for a beginner to get set up in this way
18:49:27
jmercouris
unless they are already an emacs user, in which case they should be able to figure it out (assuming they didn't just install spacemacs and call it a day...)
18:52:05
Fade
I used portacle to drag a handful of windows devs along on a lisp 'show and tell' a few weeks ago.
18:52:34
Fade
it was so nice just to install it and run, instead of spending an hour getting everybody's systems up to snuff.
18:53:21
jackdaniel
it's the fact that it is a hell lot easier to point someone at portacle than scare him with: install emacs, install slime, install sbcl, go to quicklisp and install it, configure stuff
18:53:59
jackdaniel
(but it's still emacs, so that particular someone will probably have a trauma either way)
18:55:04
megachombass
thats why i never used emacs, even copy paste is so different than everything else
18:59:19
jackdaniel
megachombass: try Ctrl+h Ctrl+t for in-browser tutorial which will show you how to work with emacs on basic level
19:08:07
megachombass
i start to understand the emacs, first thing i will do before even learn more about lisp , will be how to handle this editor
19:08:18
loginoob
I installed sbcl and loaded quicklisp.lisp. Then i did this (quicklisp-quickstart:install) and (ql:add-to-init-file) and (ql:quickload "quicklisp-slime-helper")
19:08:55
loginoob
And after that i added (load (expand-file-name "~/quicklisp/slime-helper.el")) and (setq inferior-lisp-program "sbcl") to ~/.emacs file
19:09:14
phoe
learning Lisp is not easy, learning Emacs is not easy, learning both at the same time is (not easy)²
19:10:02
zazzerino
megachombass: Looks nice. Don't forget to move the parens at the end of your compilation-appel function so there's no whitespace before them and put a blank line after is-cas.
19:10:37
megachombass
okey zzaz. but what about code itself, what is useless ,and what can i change?
19:11:45
zazzerino
megachombass: I don't have time to look at it. There are several people more knowledgable than myself here- I just wanted to get you to format your code correctly so they might actually be inclined to look at it!
19:15:12
loginoob
In this line (setq inferior-lisp-program "sbcl") should i give path as to where sbcl is installed?
19:16:25
megachombass
yesterday they told me about remplacing gensym by memsym, but i dont find memsym in the doc?
19:24:43
phoe
2018-01-25T22:16:05Z pjb: megachombas: you can use gentemp instead of gensym to generate interned temporary symbols so you don't have this problem with the textual representation.
19:51:28
pjb
phoe: Well, there's a GPL v2 file in the repository, but the file headers specifies in general AGPL3. The later is autoritative. There may be a couple of files with a different license for contribution reasons. Notice that you may find an old release (of part of it) with a different license too. It's not maintained or supported.
19:51:52
pjb
phoe: I shall indicate in the README that the default license is AGPL3, and update the license file…
19:52:16
pjb
phoe: you can also notice that the asd file contains a :license property set to "AGPL3".
19:54:37
pjb
megachombass: in http://prntscr.com/i61mwj you may notice that after you typed C-g, the minibuffer (bottom row of the emacs frame) shows "Quit". This is the sign that C-g was successful and emacs is ready for the next commands.
19:55:08
pjb
megachombass: in emacs, you're led to watch out for status and messages at the bottom of the windows and the bottom of the frame.
19:55:24
phoe
pjb: yes, I supposed that AGPL3 was the proper thing. I was confused by the lone GPL file containing GPL2 though.
19:55:35
pjb
megachombass: this is to stay consistent with interface on terminals, where the last line output (and the status line when a terminal is able to display one) is usually on the bottom.
19:57:36
pjb
megachombass: concerning channel logs, you can download them all from http://ccl.clozure.com/irc-logs/lisp/ and read them so you'll know all that have been discussed (and learn a lot of things) since ever in #lisp! Similarly, you may be able to find archives of news:comp.lang.lisp and learn a lot (best parts from 1995 to 2010).
19:58:54
pjb
megachombass: then, you may also want to read the AIM (AI-Lab Memos), and other TR (Technical Reports), to learn all about the history of lisp and artificial intelligence; we have complete historical tracks from the 1950s…
19:59:58
megachombass
i feel like a complete idiot to have to ask questions in every step i do in this language
20:01:14
pjb
megachombass: it's customary to use an explicit T as condition in the last clause of COND: (cond … (t `(function ,(car exp)) (compilation-appel exp env fenv nomf)))
20:02:18
pjb
megachombass: if you remove it, it works only if you have a single expression in the clause. But cond clauses accept multiple expressions!
20:03:52
pjb
but indeed, (cond (t e)) and (cond (e)) are equivalent. (as long as the clause is the last in the cond).
20:04:22
pjb
It's clearer for the human reader, to write the T explicitely, as it demonstrate that this is exactly what you want, and not an error.
20:04:51
_death
do I as a user really need to care that some library has an invalid :version specifier or that it defines a foo-tests system isn't named foo/test.. does asdf really has to bother users with such things..
20:04:53
pjb
megachombass: it's like, () '() nil 'nil and (list) (amongst other), when evaluated, all return the same thing, CL:NIL.
20:05:33
pjb
megachombass: but there are conventions about them: () is an empty list in source (not evaluated). '() is an empty list expression (evaluated).
20:05:47
phoe
but it's preferable to write NIL if it's meant to be used a boolean, () if it is not e---
20:06:15
pjb
nil is the boolean false. 'nil is the symbol CL:NIL. (list) is the creation of a new empty list (all empty lists are the same CL:NIL symbol, but sometimes you may want to stress you're creating lists, so you'd use (list) instead of just '()).
20:07:09
pjb
loginoob: notice also there's liskell ;-) (once you know both lisp and haskell, you merge them).
20:07:10
phoe
“APL is like a beautiful diamond - flawless, beautifully symmetrical. But you can’t add anything to it. If you try to glue on another diamond, you don’t get a bigger diamond. Lisp is like a ball of mud. Add more and it’s still a ball of mud - it still looks like Lisp.”
20:07:58
phoe
these two languages are pretty damn different, too. Haskell is purely functional with a stress on this paradigm, while Lisp is multi-paradigm with a stress on allowing the programmer to program however they want.
20:11:43
megachombass
there was about changing the structure of the vm etc, making it like a struct instead of just setting variables.
20:13:27
borodust
Xach: i see bodge-chipmunk generates some style-warnings, gonna check if i can remove those
20:13:38
pjb
megachombass: for example, instead of worrying about gensym/gentemp, etc, you would just use a generate-label function everywhere you need a new label. Then you can modify the generate-label function to use whatever you want to create a label.
20:20:20
_death
worse yet, these asdf warnings are simple-warnings so cannot be selectively muffled..
20:34:57
Xach
borodust: some style-warnings aren't worth the trouble, but some are - not sure which is the case in claw
20:36:30
borodust
Xach: some missing foreign functions in the compiled blob, does not affect main functionality, but i'm working on fixing those anyway
20:39:22
borodust
this basically means i compiled chipmunk w/o some functions for some reason (probably missing custom config or whatnot)
20:50:51
Xach
ebrasca: I don't think you should have a struct slot that defaults to NIL but has an integer type.
20:51:13
ebrasca
For now I don't know how te refactor : read-dir-from-cluster , remove-dir-from-cluster and write-metadata.
20:52:25
sjl
I usually do the equivalent of (slot-name (error "Required") :type (unsigned-byte 8)) to get around that annoyance
20:52:35
Xach
ebrasca: loop to check for membership in a set of magic values would be better done with FIND or POSITION or MEMBER or similar.
20:53:57
pjb
ebrasca: I would have written a macro to generate the defstruct, read-fat32 and write-fat32…
20:55:57
pjb
Instead, take as argument a vector of closures to perform this I/O; or define a CLOS protocol (a set of defgeneric function).
20:56:52
pjb
This way, your fat32 file system package could be used to read and write fat32 everywhere it's needed. (sd-cards, planetary sondes, embedded hardware, synthesizers, mezzano, etc).
20:58:20
pjb
Instead of calling mezzano.supervisor:disk-write, you would call (funcall (write-function disk) …)
20:59:23
pjb
makomo: as I said, the detail doesn't matter much. It could be a single closure with a message parameter (but then you have to use &optional or &rest arguments). It can be a vector a list or even a structure containing closures. Or it could be a set of defgeneric function with an opaque object.
20:59:30
makomo
ebrasca: he's just getting at the fact that you should abstract the writing to disk into, for example, a generic function
20:59:57
pjb
ebrasca: For example, to access a FAT-32 virtual disk, you can just open a binary file, and implement disk-write using write-sequence!
21:00:21
Xach
makomo: i've seen passing a chain of closures, but it just looks like a closure, like a list looks like a cons...
21:01:45
ebrasca
Some tips to make 1 funtion from read-dir-from-cluster , remove-dir-from-cluster and write-metadata ?
21:01:49
makomo
ebrasca: and then a concrete implementation of such a function would use mezzano or something