freenode/#lisp - IRC Chatlog
Search
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
21:06:07
pjb
ebrasca: for example, https://gitlab.com/com-informatimago/com-informatimago/blob/master/common-lisp/heap/heap.lisp
21:06:49
pjb
ebrasca: instead, it uses a *gc-memory* object, and methods poke-uint64 peek-uint64 etc, to read and write the memory.
21:06:58
_death
ebrasca: find/position work on specialized arrays, and furthermore may have optimized variants for them
21:07:36
pjb
ebrasca: so you can have an implementation using a lisp vector (cf. the file memory.lisp in the same directory), or you can use a FFI to peek and poke the actual memory of the process (eg. to store the heap in a memory mapped block, to share a heap of lisp objects with another process.
21:08:49
borodust
Xach: heh, found the issue (apparently, gcc was optimizing away some functions during linking :/)
21:17:12
ebrasca
_death: ... I don't understand how to use with-output-to-string it output some stream .
21:20:55
_death
ebrasca: you can use w-o-t-s in the code below ;; Read long name: (setf name (w-o-t-s (loop ... do (format the-stream ...))))
21:22:41
_death
ebrasca: but I'd split the function into smaller ones.. and try to avoid needless subseqs
21:22:48
makomo
ebrasca: i think that's how java people usually call such a pattern. instead of explictily using some library/component in your library, delegate to the user the work of choosing the right component to use
21:24:47
pjb
modules should not depend on other modules, instead modules should take modules as parameters.
21:25:07
pjb
This allows the toplevel program to decide what module should be used another module at run-time, instead of compilation-time.
21:25:16
makomo
but i might be wrong. however, i don't see why that should be so special. it's kind of a central point when designing something that others will use
21:25:32
makomo
with "others" being not only other people, but also other modules within the same system, etc.
21:26:04
_death
(defgeneric disk-write (backend ...)) then you can have a mezzano backend.. though it may prove too slow and then you need to try something else
21:30:39
_death
also, it may not be a good idea to defgeneric disk-write directly, because then you'd need to pass the backend all over.. this is a job for special variables.. so you can have (defun disk-write (... &key (backend *backend*)) (disk-write* backend ...)) .. this is a common pattern
21:36:37
_death
there could be something like (defgeneric io-pattern (backend)) that returns the closures needed
21:37:43
_death
I've done this with https://github.com/death/constantia/blob/master/struct.lisp and it was useful at times
21:39:02
pjb
The point here is that dynamic = time; you would use dynamic variable if things changed in time. But when you work with a fat32 file system, you don't change the underlying storage mechanism periodically.
21:39:40
pjb
You can have 2 fat systems each on its own storage. So the storage is a parameter of the fat system.
21:43:55
sjl
_death: any chance of adding a specific license to https://github.com/death/constantia ?
21:47:20
_death
meanwhile, quicklisp :verbose t reveals lots of bugs.. maybe :verbose should have a default of (< (random 1.0) *bugrevealing-probability*) ;)
21:54:55
_death
erm, github says BSD-2-Clause.. now you know how I feel about licenses ;).. anyway, I'll push the correct one
21:58:55
_death
I have tons of utilities in other libraries.. I keep postponing their inclusion until I find that I need them in multiple cases
21:59:42
sjl
I mostly just dump them into my main util library, except for the mathy ones that start in my project euler repo's utils file and only graduate if I need them elsewhere.
22:00:12
_death
but usually end up implementation different designs that require different utilities.. such is the way with "code as art" in personal projects
22:03:18
_death
sjl: what about your other (public) projects.. for some reason I made sure my public ones don't depend on it
22:04:23
sjl
I try to make my libraries depend on as little as possible. E.g. I love iterate, but use vanilla loop in my libraries.
22:11:33
_death
sjl: wrt iterate (or series, or loop wars) this has been resolved for me for several years now, since I internalized the One Function to a Function rule
22:15:44
sjl
iqubic: that's usually part of it. "the FP way" can go further into things like "use pure functions whenever possible", but one-function-to-a-function is orthogonal to that
22:15:59
sjl
"one function to a function" comes from https://groups.google.com/forum/message/raw?msg=comp.lang.lisp/9SKZ5YJUmBg/Fj05OZQomzIJ as far as I know
22:19:57
dmiles
in CL must one ensure structures can be expected to be accessed by slot numbers or can just by name be sufficent?
22:22:07
pjb
dmiles: but ok, if you specify :type vector, no structure object is created, instead make-foo creates a vector and the foo- accessors access vector slots.
22:23:00
pjb
dmiles: as an implementer the question you have to ask yourself with respect to structure objects, is whether you want to do redundant work, or whether you're happy in implementing (defclass structure-class (object-class) ()) and be done with it.
22:23:50
_death
Shinmera: found plaster-new a bit confusing, and there's no completion for type of paste (and no "lisp" type).. used plaster-paste-region
22:25:10
pjb
dmiles: have a look at: com.informatimago.common-lisp.cesarum.utility:define-structure-class
22:25:23
_death
ebrasca: there are still some issues (some introduced by me :).. code-char and perhaps use of the name "end" to denote the upper bound of the interval
22:31:20
_death
ebrasca: my advice for performance is to profile first, and in general not to build structure just to throw it away unless it makes things clearer.. for the best style guide I know, http://norvig.com/luv-slides.ps
22:33:09
phoe
I find it very handy to have a set of tests that I can run. This way, I can detect some bugs when I modify my code later on.
22:33:23
phoe
Then you can use these tests to verify that your code stays correct between your changes.
22:36:56
phoe
ebrasca: sure thing. There are multiple test frameworks in Lisp that you can use to write automated tests.
22:38:21
dmiles
<Bike> slot locations in that sense are nonnegative integers. so there's a number. [14:23] Disconnected from freenode on Friday January 26th,2018 at 02:01pm. Server disconnect reason: hitchcock.freenode.net
22:44:41
phoe
ebrasca: pick your favorite travel vehicle to Marbela, Spain, and stay there for a few days.
22:47:55
jackdaniel
Malaga is the closest airpoirt as far as I'm aware, and there are buses going out from there every hour 24h to Marbella
22:52:33
jackdaniel
stealing (given you have necessary skills), but it's not socially acceptable ;-)
22:53:27
aeth
ebrasca, jackdaniel: Initial Coin Offering (ICO) seems to be the easiest way people make money these days
22:53:37
pjb
It would have to be improved, and to deal with :type list and vector, but the point here is to show that structure-object can be a subclass of standard-object.
22:56:00
dmiles
pjb: that indeed is what I am doing so i was trying to triage whther or not i created a list of slotnumbers to turn themseves into slotname .. i guess :type list and vector tells us to do it sonner than later
22:59:16
aeth
There are some practical differences with how implementations handle structs that is probably reflected in the assumptions in Lisp code. :type is usually respected in defstruct, and :type is usually ignored in defclass (only CCL seems to do type checking in the latter)
23:00:16
aeth
A while back I was using :type and only CCL would care. You can probably make CLOS always care, with the MOP.
23:01:08
_death
in fact I had an attempt at a patch to help it report better errors https://github.com/death/sbcl/commit/4341538e3e4f62ae111fee2e657d5969322f6b02
23:01:10
dmiles
i have no problem backing my structure with a vector or any sequence.. what i am missing is i've always assumeed there was also a get-slot-value-using-offset type function
23:02:37
dmiles
(since all the sub lisps like LarKC always has such a thing that works on any standard-object but definately on structures)
23:09:31
aeth
_death: (defclass foo () ((bar :initform 0 :accessor bar :type (integer 0 10)))) (let ((foo (make-instance 'foo))) (setf (bar foo) 10f0) (bar foo)) ; works and returns 10.0 in SBCL, ECL, CMUCL, CLISP, and ABCL, but does not work in CCL because it's not of the correct type, with "Condition of type CCL:BAD-SLOT-TYPE"
23:09:32
dmiles
well actualyl consider :type list i suppose they are doing that for some nefarious reason
23:11:20
dmiles
pjb: a little bit.. i know it does what we are talking about.. in fact i am counting on some parts of the system jsut making vectors with Layouts at 0
23:12:09
pjb
ebrasca: nope. in sicl structures are implemented as clos objects, and clos objects are implemented using two vectors IIRC.
23:12:41
pjb
I don't remember if in sicl lisp vectors are implement as clos object, but I would do that, at least for not specialized vectors.
23:14:21
dmiles
but the fact that they :type vector .. i am assuming they are trying to create a secario i already by fdefalt created thus they expected to have 0 slot free for their useage
23:15:33
pjb
dmiles: yes, but :type vector uses plain lisp vectors. The only thing is that you can have :name option (to add the structure type name in the first slot), and :initial-offset, and the fact that you can use :type `(vector ,size) to allocate more than needed slots.
23:16:27
dmiles
(oh .. i secretly roll include and type into the same dohickey ;P .. wasnt sure if that was going to play agaisnt me)
23:17:06
pjb
Well, one problem is that you need to define accessors with the conc-name of the current structure for all the slots that are included with :include.
23:17:35
pjb
So you need to keep track of them. For CLOS you can use the MOP and the superclass, but for :type list and vector, you have to handle it yourself in the defstruct macro.
23:20:56
dmiles
i think i see now.. it might still turn out ok.. if they are supplying the :type list :initial-offset 3 .. what is it they are expecting?
23:22:03
pjb
dmiles: (defstruct (point (:type list) (:initial-offset 3) :named) x y) (make-point :x 1 :y 2) #| --> (nil nil nil point 1 2) |#
23:22:50
aeth
_death: But is there a way to force the type checking on those who don't want safety (well, at least when safety > 0)?
23:23:29
dmiles
pjb: ah, thank you.. i know i should had gotten that from docs but it is more fun sometimes hearing it for sure
23:23:40
_death
aeth: sbcl has some machinery for fine-grained optimization settings, methinks.. but I don't know/remember much
23:24:05
pjb
(defstruct (point (:type (vector 10)) (:initial-offset 3) :named) x y) should be accepted, but apparently it's rejected by clisp, sbcl and ccl…
23:25:54
dmiles
pysically in my system i want to promot doing.. (defstruct (point (:type prolog::point/2)) x y)
23:26:21
aeth
_death: thanks for making me aware of alternatives, but I think for now I'll stick to structs when I want to force type checking.
23:28:46
dmiles
(when prolog code introduces lisp to its innerds ... i been thinking of having iot be seen as a structure that way)
23:30:05
dmiles
(also of course letting lisp see the innerds lisp is actualyl ussing as accesable autodefined structures :P)
23:32:29
dmiles
i been shifting the :initial-offset when someone uses :initial-offset on the :type super (super is shifted)
23:36:21
aeth
The problem I have with type checking at the moment is that I currently architecture my program as users providing data. So type-checking (and possibly other kinds of checks) might happen two or more times because ideally any mistakes should be caught early, but the program also cannot trust the input (someone could have created them another way other than the official way, to avoid the overhead of the checks).
23:36:27
dmiles
right so yes :include is shifting offsets .. but i am glad pjb mentioned that it doesnt shift the :type
23:37:26
aeth
But I think once the data is checked in my program, it could be trusted (even to the point of (safety 0), but I wouldn't do that) unless it's a function that can be redefined (for first class functions I funcall 'foo instead of #'foo based on recommendations here)
23:41:08
aeth
It looks like it would either be (blank blank blank name x y blank blank blank blank) or (name blank blank blank x y ...) or something similar
23:42:26
dmiles
ACTION relizes njow that this .. www.lispworks.com/documentation/lw70/CLHS/Body/m_defstr.htm has examples of :initial-offset but was hoping to see the :name shoved in there
23:44:02
dmiles
then again structs are secretly never really anything more than some synthethic getter/setters over typical list or vetors
23:45:42
dmiles
(make-binop :operator '+ :operand-1 'x :operand-2 5) => (NIL NIL + X 5) so aeth (type-of (make-binop :operator '+ :operand-1 'x :operand-2 5)) is CONS?
23:48:09
pjb
aeth: so, yes, (defstruct (point (:type (vector 10)) (:initial-offset 3) :named) x y) (make-pointm :x 1 :y 2) should return #(nil nil nil point 1 2 nil nil nil nil).
23:48:41
aeth
pjb: Afaik, blank is normally NIL, but blank can be 0 in specialized numeric arrays, but... this is I think undefined behavior, so :initial-element 0 or :initial-element 0f0 or :initial-element 0d0 etc. is probably necessary in those cases for true portability
23:49:48
pjb
aeth: obviously, structures cannot use specialized arrays. But an implementation could allow it, if you don't pass :named and if all the slots have the same type.
23:50:12
pjb
In that case, indeed, a different value would have to be used in the unintialized slots.
23:52:04
aeth
I do like that Lisps do set things to NIL, (coerce 0 'whatever-number-type), or (code-char 0) though. Or at least, tend to.
0:02:26
aeth
It would be nice if there was a way to do heterogeneous but typed arrays, though. Where e.g. the first element is a symbol and the next 3 are single-float.
0:31:58
holycow
okay so now i have a spreadsheet with 30 000 rows and rows counted. calc counts the rows, inserts a line and prints total and groups by date so i get total number of entries per day.
0:32:55
holycow
any suggestions on how to collect all of the subtotals and pull them all into a separate worksheet? i'm not googling an obvious way to do something like that.
0:50:49
holycow
hmm, although, strangely using lisp with a csv export of the data might just be the fastest
0:54:49
pjb
(let ((typed-vector (cons #(foo 1 2 3) #(symbol fixnum fixnum fixnum)))) (setf (tvref typed-vector 1) 4.4)) => type-error
0:55:22
pjb
aeth: don't ask that the implementation provides all the silly ideas you have (unless you're the implementor!)
0:57:11
aeth
then *only* tvref would be required, since the implementation will probably handle the types for me when using a struct
0:58:51
aeth
It would also print as expected with a defmethod print-object on the type created by the struct
1:03:07
aeth
(defstruct typed-vector-fixnum (name :name :type symbol) (slot-0 0 :type fixnum) (slot-1 0 :type fixnum) (slot-2 0 :type fixnum))
1:03:10
aeth
(defmethod print-object ((object typed-vector-fixnum) stream) (format stream "#(~A ~D ~D ~D)" (typed-vector-fixnum-name object) (typed-vector-fixnum-slot-0 object) (typed-vector-fixnum-slot-1 object) (typed-vector-fixnum-slot-2 object)))
1:03:34
aeth
pjb: Just that, with an aditional aref-like function also defined. Fairly easy to generate with macros, too. Might only be efficient for short things. ^
1:05:50
aeth
And tvref could be defined as an inline specialization via specialization-store with the new type definition creating a new defspecialization in addition to the defstruct and the print-object.
1:15:46
pjb
aeth: note that if you write: (defstruct (typed-vector-fixnum (:type vector)) (name :name :type symbol) (slot-0 0 :type fixnum) (slot-1 0 :type fixnum) (slot-2 0 :type fixnum)) then the structure "accessors" should still check the types, but indeed, you would need a custom aref for those vectors.
1:16:28
pjb
aeth: but for this custom aref, you will need to keep the type of each slot, unless you hardwire it in a aref specific to each structure type.
1:18:26
aeth
pjb: specialization-store can handle the dispatch. Efficient inline dispatch if you keep the type, runtime dispatch if it's generic. I don't think specializations can handle setters, though, which would be problematic for an accessor like a fooref in specialization-store, which will probably require a getter and a setter. That may be patchable depending on the architecture, though, and a patch would probably be simpler than a new scheme wit
1:19:19
aeth
pjb: I think the main issue is that most of the novel things will be stored in T arrays or T cons cells or T hash-tables, which *will* lose the type information.
1:19:54
aeth
If implementors would have to address any of that, that is what they'd have to address, not any specific data structure.
1:21:23
aeth
T cons cells are easy to replace with typed cons cells because of their simplicity. Just do the struct approach again. Arrays and hash-tables would be trickier.
1:23:37
aeth
As soon as you want to put this faked-via-structs typed vector into a long array (e.g. 1024 long)... I think that's where this falls apart.
2:46:54
pjb
aeth: I don't understand this fad for specialized arrays. Using T everywhere means that the same code is used everywhere all the time, therefore way fewer I-cache lines are needed, therefore the program runs much faster.
2:57:01
aeth
pjb: I don't commonly write code actually inteded for T. I generally write code that either gets type inferred well or code that gets type inferred poorly and can benefit from type declarations. The latter case is generally numbers and arrays. (Type declarations or check-type in the former case would just move the type error to the top of the function instead of somewhere else, and not actually improve the compilation.)
2:58:01
aeth
(defun foo (x) (car x)) ; x is going to have to be a list or a type error, and SBCL knows this
3:06:29
aeth
Oh, and afaik most of the second case can probably be avoided if everything was put it one compilation-unit (e.g. one file).
3:08:37
White_Flame
pjb: i-cache pressure would have an upper bound by type. d-cache pressure is by footprint, which I'd think would hurt more for non-specialized
3:10:59
White_Flame
really, the only thing that makes sense for specialization is unboxed numeric types, IMO
3:12:08
aeth
White_Flame: What about structs that primarily contain unboxed numeric types? They could also benefit from specialization.
3:13:04
White_Flame
hmm, yeah I guess. As long as the types are known by whoever's accessing the array
3:13:22
aeth
Also, arrays and structs can unbox things that are normally boxed, e.g. double-float and even (unsigned-byte 64)
4:08:46
red-dot
Is anyone aware of CL libraries for working with Google cloud? With the exception of https://github.com/death/gcm, nothing seems to turn up in searches.
4:24:36
p_l
red-dot: nothing available at the moment, should be quite quickly doable as they all follow REST quite well
4:41:14
red-dot
For anyone interested in Google APIs in Swagger (Google has its own version of Swagger): https://groups.google.com/forum/#!topic/google-apis-discovery/NdreD8_xWOk
4:48:04
red-dot
Finally, for someone wanting to generate a client via Swagger, this seem to be the only option out there for CL: https://github.com/incjung/cl-swagger-codegen