freenode/#lisp - IRC Chatlog
Search
17:13:41
pagnol
I have entities and every entity has key-value pairs and I want to store them persistently on disk
17:14:38
pagnol
in my case there are entity types, too, an entity type says which key-value pairs an entity must have and of which type the values must have
17:22:09
Shinmera
pagnol: As I understand it from your explanation you have some kind of object that acts as an entity and you'd like to persist them to disk, yeah?
17:25:12
Shinmera
If you need to have it automatically persist to disk when a change in any of the values occurs then things get more complicated of course.
17:26:57
pagnol
I have an existing program that I want to rewrite and which is relying on an rdbms with a messy eav-like layout, and I was looking at the problem from that angle
17:29:02
Shinmera
Okey. Well, there's multiple libraries for RDBMs interaction or RDBMs-like things. If you want something more lispy, perhaps have a look at Rucksack. https://github.com/arieltan/rucksack/blob/master/doc/rucksack-tutorial.lisp
17:30:40
pagnol
I was hoping to find something that gives me ACID and also lets me enforce the schema without having to write a lot of code myself, especially the validity of entity references
17:32:05
pagnol
btw I will be using this only from lisp, so the potential lack of implementations in other languages is not an issue
17:33:03
tazjin
pagnol: I'm only using it for a little toy project, for "real" things I use postgres, but cl-prevalence works well
17:37:03
tazjin
because the main problem with the concept is that things like web apps have waaay too much friction
17:50:19
tazjin
pagnol: well, I basically want to translate the UI of the web app into a physical thing - the fun part is that I know nothing about "making" (in the sense of building physical tech), so this is a cool side project
17:50:55
tazjin
pagnol: the idea is to have a sort of board with the tasks on it, where on the backend the tasks are now linked to slots on the physical board, and then there's indicator LEDs for the red/green/yellow statuses and an actual physical button for resetting the completion timer of each task
18:04:55
pagnol
tazjin, I've also always wanted to learn how to make actual physical devices that do something... I wish you luck
18:05:18
tazjin
we have a nice makerspace here in Oslo that I'm going to be consulting to get some help :P
18:07:04
tazjin
you mean hardware-wise? I don't really know yet, I've only done some sketching of how I want things to be.
18:07:27
tazjin
I have an Arduino starter kit somewhere that I never got around to using for anything so that's probably a good entrypoint
18:07:57
pagnol
Shinmera, thanks for suggesting rucksack earlier, I'm going to play around with it a little
18:08:35
pagnol
building a project on it seems like a somewhat risky undertaking though, given that it hasn't been maintained in the past 7 years
18:22:55
jackdaniel
I'm a big fan of `collecting' macro from cmu utilities, it unties collection from loop construct and is very handy
18:28:06
Shinmera
Here's another version :^) (prog((i n))x(and(< 0 i)(decf i)(read-line s NIL)(go x)))
18:29:14
Shinmera
Actually this is even better: (prog((i 3))i(and(< 0 i)(decf i)(read-line s NIL)(go i)))
18:30:06
Shinmera
well, change the 3 to an n, but you get the point. (the point is you shouldn't use this)
18:34:48
Shinmera
The hidden point is that I like to write intentionally obtuse answers to simple questions.
18:39:00
_death
(define-symbol-macro _ (progn (format t "Enter a specific number: ") (force-output) (read))) ;; you know the rest
18:53:05
Bike
"how they're used" covers a lot of things. is there something in particular that you want to do?
18:53:59
_death
you can check out http://infolab.stanford.edu/~paepcke/shared-documents/bibliography.html search "metaobject" (there is more than one paper)
18:57:30
pagnol
I was wondering if/how I could use mop for my current project in which I load a schema definition on startup, which is then used to check if certain objects that are created are conformant
18:59:01
pagnol
when the program attempts to update a slot, then the ... metaclass? ... would look at the schema to find out if it's ok
19:00:11
Bike
here's a start: define some class and then do (describe (find-class your-class)) and get a look at things
19:23:00
makomo
pagnol: what about the book The Art of the Metaobject Protocol (AMOP)? i didn't open the book yet, but it sounds like it might be useful?
19:30:59
pagnol
makomo, I have a copy of the book and skimmed the first few chapters but I feel I would need to set some time aside specifically for studying the MOP to get anything out of it
19:36:15
pagnol
I found a good tutorial here in case anyone cares: http://www.drdobbs.com/parallel/lisp-classes-in-the-metaobject-protocol/200000266?pgno=5
20:19:23
fiveop
Is there an idomatic name for the function that is similar to SOME, but checks elements of trees instead of sequences? Does Alexandria have such a function?
20:22:48
makomo
pagnol: oh, nope, but i want to learn more about it because (1) it's very interesting and (2) i've been doing some java/spring recently and am interested in the comparison between the two
20:23:42
fiveop
phoe: that would work, if I thought the thing through properly. I do not only want to check the atoms, but the three itself and its subtrees as well.
20:24:05
phoe
fiveop: ooh, i see. do you want some kind of tree traversal and apply the predicate to each tree node?
20:24:27
phoe
I think nothing in the standard or in Alexandria is suited for that. Feel free to roll your own.
21:34:44
Shinmera
pagnol: I implement a metaclass that does strict type checking on slots for my chat protocol specification
22:22:36
phoe
BTW, who is responsible for https://ccl.clozure.com/irc-logs/lisp/lisp-2018-01.txt ? It stopped logging earlier today.
23:11:20
krwq
hello, what is the best way to redirect multiple streams into one ideally without reading all of them entirely into memory? is there some good library for combining streams?
23:12:30
Xach
krwq: a concatenated-stream would be half the answer, then a loop of your own making to write the output.
23:22:11
krwq
Xach: this works for my case but in general do you know if there is any library which would conceptually as this? https://pastebin.com/aw4P1AqV
23:25:18
krwq
Xach: the problem with the concatenate-stream is that I have a function which compiles from stream and I'd like to provide it several files but I do not neccessarily want to open all files
23:28:46
krwq
technically I can create temporary file or with-input-from-string and with-output-to-stream together to have memory stream
23:32:02
pillton
Does the function that processes the input stream do something after reading all of the input?
23:33:34
pillton
Why can't you just call the function multiple times? Why do you have to concatenate the streams?
23:34:32
krwq
pillton: so specifically this is parenscript - I'd like to concatenate macros before the script I compile
23:36:41
krwq
but that's not the first time I'm fighting with streams - I'd like to learn some better way to handle them
23:58:03
pillton
I'd say you need to come to terms with the fact that the standard defines no "pipe" stream.
0:03:20
pillton
Personally, I would just write everything to a temporary file and process the temporary file.
0:04:30
pillton
It can be done with a single thread and there is no possibility of starvation/deadlock.
1:15:14
White_Flame
in terms of wanting (defconstant +fixed-list+ '(a b c)), since the list value is not the clhs-same as the prior read list value, what's the preferred way around it?
1:15:52
White_Flame
one would be to keep it in a file that isn't easily reloaded, another would be to wrap defconstant in a macro that tests if the constant is unbound before doing DEFCONSTANT
1:16:37
White_Flame
the problem being that when editing & recompiling, the constant differs in sameness and throws errors
1:17:22
White_Flame
smells like checking bound is the way to go, if it's common enough for alexandria (which we still haven't fully migrated to :-P)
1:25:01
Bike
part of it is that amop isn't even a reference, it's written like "hey, we could design clos to work like this. wouldn't that be cool? still kind of a work in progress" but then it gets used as a reference anyway.
1:26:04
Xach
reminds me because the story of self is kind of like "here's what we want the language to be like, let's work relentlessly to make it fast enough to be practical"
1:26:17
Bike
lots of parts of mop are actually kind of loony, which more design probably could have worked out
1:28:40
Bike
But most of the reason people use mop is to interrogate classes, rather than methods or generic functions. and the metaclass stuff is pretty solid.
1:29:08
Bike
i managed to write something that mimicked a python library with class annotations and such like in like, a day. pretty good
1:31:30
Bike
https://github.com/clasp-developers/cl-jupyter/blob/master/src/cl-jupyter-widgets/iwidgets/widgets/traitlets.lisp here you go.
1:31:49
Bike
the comment on top explains most of it... basically it adds some things to slot definitions
2:08:56
White_Flame
AND keeps testing to see if it hits something false, so it can drop out, default to true if nothing tripped that test
2:09:17
White_Flame
OR does the opposite, early exiting if it hits something true, defaulting to false if none is found
2:10:15
White_Flame
the #+ and #- reader macros are sortakinda like IFDEF from C's preprocessor, including or excluding the following form based on the boolean expression
2:10:48
White_Flame
so things like #+sbcl (sb-ext:something) #+clisp (something-else) will include a custom expression per implementation
2:11:27
White_Flame
because the symbols SBCL and CLISP are in the variable *FEATURES* on their respective plaform. #+/#- searches that list
2:11:29
aeth
It's actually interesting to see things with 0 arguments that can only be 0-argument in a non-infix language
2:11:44
fiddlerwoaroof_
As far as I can tell, your reader macro function gets called but its output is ignored
2:14:48
fiddlerwoaroof_
In my case, the problem was ccl would complain when it tried to read SB-SYS:SYSTEM-AREA-POINTER
2:16:12
fiddlerwoaroof_
Ah, yeah, I was using destructuring-bind on the result of read-delimited-list and getting nil
3:25:39
pillton
Bike: Why is make-method-lambda loony? I thought it was needed for call-next-method.
3:26:29
Bike
did you know that if you compile this file, the generic function will be defined by the defmethod at macroexpansion time, so that make-method-lambda can be used?
3:29:17
pillton
I don't really see the difference between that and a type being made available when compiling a defclass.
3:31:28
Bike
anyway, that's just a weird tidbit, the actual problem is that make-method-lambda lets you control the exact form of the method functions, except nobody seems to really support that super well
3:31:58
Bike
like, you can have a method function that takes more than two arguments, but how do you call it? call-method? call-method already has contradictory definitions between the mop and clhs