 I Worked over here. Who's that? So who was where why So they tell me like I said was created by Ritchie. She's also the guy that created closure This is really a talk about closure, but it's an immutable functional language. It's this JVM I Can demo a little bit about it? Not gonna go too much into it, so You guys see my screen? Yes name space declaration So if I switch to my repel, which is also I have access to the same name space so as I'm evaluating So I just evaluated this I can evaluate it in my repel and if I change I change this to In the value here, but it's immutable. So if for example, I concatenate is the best apple Apple my apple is the best, but if I Is functional so you could like map Yeah, I don't understand how you try to just demonstrate the new ability by calling a string function that That didn't seem like you were definitely going to build you because you did just mutate it when you did another depth You can mutate You can redefine what a variable is assigned to right, but once it's assigned You can't mutate it by virtue of doing an operation on it So concatenating so for example if I do Other string this concatenation Is done on other screen But not Apple so Apple other string Yeah, it's Those are there's returns a new variable Something to take care of the remote So I'm compiling on the fly and when I compile it is it's attached to the same port same rough wall Cool, so I want to add all these numbers. Yes, it's a 10 here map increment So I just map increment Roll that Oh, yeah, sorry So this is an infinite sequence because it's gonna repeatedly call random int I'll take the first 100 and stop it and stop So if I do first It's just accessing the first thing on there It's actually going to return to I can assign this to a new variable So a And you could When you have something like this you could do your version so you can take with the first address So I want to print all the things. That's something like that and I could also do it Rappel so let's say I want to change that functionality I could hotspot basically I could print a space and re-evaluate this function and when I read bucket It's the new so if you ever want to do continuous employment or something hotspot the code anyway That's another lot of closure So hopefully you got a feeling of how closure is So what's the atomic it is a database that starts non rectangular Non-rotangular data, so let's put data or facts into the rectangle My name is Felix. So that's a fact my origin is beautiful Philippines and my citizenship is And Neo relationship. Let's just say I'm single But I can get married and Say that I'm no longer single right, but now so the difference between They topic and normal databases that are not normal relational database you would go into the Relationship column and update single And the fact that I was ever single it's gone for it, right with the atomic to change the value of Identity which is this rectangle you just assert new data and retract the old data so by doing that You have access to the entire database At any given point in time so you can say give me the database as of This transaction number and you can explore the entire database And you can even access the current database and the old database and act pretend that they live So you carry across time Consistency So you can say an entity can have one thing Right, so if I try to assert my name is Romeo They'll say no, okay. There's only one That's different from You just have a document you can stop whatever in there, and you don't really know if it's consistent or you know, but instead of and they tell me instead of saying that a person has one name you say a Thing can have you can has a name and Has number of occupancy and that entity can represent a hotel, right? You never say Hotel entity you define those entities by what they're consistent So the same way that you don't think it's user like are you a user? You're a person right and you're only a user by the context and where you belong and that Attributes that you have So you're a user because you have a username and password You're not a user because you are a user Unless I do drops unless you do drops it It's all over the top You might get killed and distributed architecture. So unlike the races it doesn't live in one box the The data race is actually spread across different domains As this idea of peers peers are application basically If you have a closure application or Java application the logic engine lives in your application The database Storage only contains the data not necessarily the logic for your application So all your quarters are in your app Storage could actually be any database or it can be memory So you could use Postgres Oracle Mongo Almost any database to be your storage engine for the time So you can have many many peers and You might notice that the direction is on the up. So here's it only read from From your Here could be up here if you want to write To your storage you need to talk to something called a transactor Okay, I'm saying I'm gonna I'm gonna state this new fact All right, the transactor goes like, okay Let me put that in for you If it if it if it doesn't violate any of your scheme rules, right? So you can say like aren't all you money or whatever and The storage replies back a pair of it and then the transactor informs your peer and also informs all the other peers on a screen that this new data came in and Then the peers themselves can decide if I care about this data or not right So that's that's how access data at data the cool advantage about this is that you Have locality of data So let's say you have a bunch of data And you create a peer that's just doing analytics and you can't create another period that's doing Permission management for your users The peers themselves hydrate a cache so As you're accessing data it Encaches it for you and if you're accessing the same kind of data You can hydrate your cash in such a way that you never have to cross over the network to access your data It's actually in memory and that's happening for you automatically Another advantage of this architecture is since your logic engine lives in the peer You could use your query engine to query things from the database or things from your application And you can actually execute application code in your query So unlike sweet sequel where you create a screen basically and shove it up the network and then you get a reply back You can intermix your code and your query and your data from your application and your database In the same place, and it doesn't know any better It's it's agnostic. It seems like I can give you the trouble to it because database is awesome and that Sorry, traditional rdbms is awesome in the sense that I can talk to in sequel and it's like good I have a query analyzer. I'm gonna be doing exactly the right thing to do to be the most optimal Maybe and I'm gonna do it whereas I'm doing all this application land All my queries are running on the app space Then I might just do stuff in a really efficient way, right? So the oldest becomes on me to know what the hell I'm doing smart about it right it is You could get into a very dangerous situation where you're like Do this very in terms like a billion records There's no bars, but I really built it You just have to be responsible the thinking here is that for the sake of flexibility and Maintainability They keep it in the app Because it's hard to test sequel right in isolation because the only way to test it is to actually do the query it is as it So because you're doing all your transaction through the transactor it's Um the app the reading from the storage is it could be parallel, but every Right this sequence so that could be a bottom like but You'd have to have a very huge out to that actually Kill that We've had problems when we're importing a bunch of data from a dump That's the only time we've actually reached the limit of the transaction So as in what possibly resulting in race conditions, but that would you not write to the database the race Anything the race conditions because it's synchronous, so I'm right Right It's always Yeah Since it's a synchronous, right Have two things right against each other. What if they will fail? Yeah When you said consistent the first time around they don't think you were talking about like consistency Yes the peers The peers are consistent Almost instantly go because there's a screen that comes out of the transactor that notifies you whenever a new fact Unless there's like a net So where does it run So I just Like I said, it's in it's in it has a distributed Infrastructure, so you can actually You can run this in easy to or in your In your laptop or anywhere because the transactor is the one that I mean where does it look and your app Every time you need to know Why your data you go through It's a separate It's a nice server. Yes In memories also great because if you're running a test you could Create a database and doctor database every time you run your test or a test case I've actually been doing this and you think it's really slow, but Surprising fast, but you shouldn't probably rely on it If you have pictures and stuff you could actually You were talking about storing code and data You can't do that, but I don't think I said that You can store procedures inside the database, but what I was saying is that the query engine Lives in your application. It's a it's a closure library so you can implement functions that Leverage the query engine or queries that leverage the function, but you're right You can you can you can store a function Object that makes you would put an object with functionality into the base and it helps with stage I know that the idea of the photo is that things are stable Yeah So So There's idea of putting function and date on it and set that inside the data store But you could also store state and values with that Oh, no, they're separate. Okay. You store a function. You store data There's actually a value type of option And there's a value type for all the other things. Oh, so why does it exist? Maybe you can do some demo and You're a six-story rectangular data, and I want to try to do something That's why it's a fool All right, so we're just gonna start a new namespace Does anyone have any random questions? All right Let's say you can use something like post-breast store If I was using something like post-breast as a post-GIS extensions, can I leverage the post-GIS extension? So Data store. Yeah, it dumps blobs in there. You can't really Yeah, you can't use like active marker in atomic. All right So I just evaluated this namespace and now I have a namespace that requires the atomic EPI So this is what I was saying about the pure like the atomic API is a atomic library That contains the query and And then I'm defining the URL Which says that this is a memory Great database boots. I must have already created it. I've already executed this So this is a way for you to check If the database exists too, if you try to create it or turns false that means it already exists But I just want to start off Without having to kill my rebel, right? So I created a database to connect to it and so I have this schema so like I was saying You could define The attributes that you could store in the atomic you have to define the things that you're starting the database So I'm saying here that I'm storing an attribute called name It's a screen as part now you want And this is just a structure instruction for the topic to say that we're going to install this So this is an email the screen are now We're going to install it in the database and why I Unless you're So I just work Read in the schema and stop the database and now We should be able to Be the exact music this connection Hey So there and I could hear for that the queue So before I can query the database I need to get a database Actually, so so I'm like sequel When you're trying to interact with the atomic you actually get The database as a value. So this that database This is the entire database as a variable. So so it's smart, right? It's not yeah But you can treat it as if it's a value It's it's hybrid Well, you have I'm wondering if you remember to sacrifice a sheep I Think it's I didn't write I'm sorry I can pretend it work with that. This is the rest of the talk I Know that one's actually This is actually for some other talk where I can talk about this So This is trying to explain like how the datomic schema works So I'm demonstrate here that you can't just Transact something into the database without actually defining it into schema So here I just try to transact Db identity down though and email Without actually defining the schema So I know for that to actually work You'd have to Define the schema like we did with the green schema and now you can transact this That why are there some types of ideas? So Db ID is just the the ID that they topic Generates for you Whereas dbi debt is an alias that you can use to find that They could just query John down and then don't return this natural key. Yeah, and here Okay, and here I'm actually demonstrating that You can query For entities and you could even query for the entity that represents the database It's like you're asking what the difference between dbi then an ID db Dot part db. It's just a name is for C0 so that would return same Same as your first entity yourself. Yeah, and so I didn't really talk about this because I didn't have chance to but every Back that you store in the topic is called a datum and it has Bout attributes to entity ID it actually has the attribute name and attribute value and Transaction and it fits in the server or every track So the entity ID is Like the feelings energy and then the attribute name be like me and then the value of the Felix Transaction ideas every time we do a transaction ID and then every track number Asserts would be I am married. I am single. I retire Well, the DQ that you have that you wrote here right here Talk about the query atomic uses data log which I just does pattern matching like I was saying Every fact in the atomic is a data All right, so the first thing is entity ID The attribute name Attribute value then transaction and assert would be the other things That does not show up here because you could admit The last thing is that I needed to make your community more of mine And it just matches the shape of that data So in here, I'm saying find a data that has to shake Variable ID Give me any ID, but has the attribute email that has the value of Sarah and use the database to find Why don't we have the second and Right, and then the second argument is an implicit join so join on the dbid Because they match and find dbidad and Asserts in this variable Okay, and I don't know the map Sarah email Is it just because of the first thing to pass it like I want to pass two things You can pass as many things as you want here And You can just decide exactly so it's the same one. I said always Right, so this this in actually matches this dollar is database and this a variable value could be It's the demarcated by question So you can have as many of those and you can actually have as many data sources as you want So another data source Is there a way for you to give those keys Sarah the template on those query values Keys like symbolic names so that I don't have to know that Sarah is mapping to email or Felix mapping to something else because the order matters like a name for him Oh, no, right. Yeah, you did it in a function It's missing It has to be the same order here that they have to say layer wish I could write like email I wish I could pass up on map for the last few minutes I would just define a new function that was your mind. Yeah, but there is no Yeah, and then you could you could you could say like I Don't care about the empty ID just buy me all the email. There's more to they tell me It's one to give you as a So who's using this in production and why? There's one called rookie that's using it to find the best What's how about I use group? I'm not really sure why they went with with they talk on specifically aside from the fact that I thought it was On paper why are we supposed to use this on paper? so The cool thing about the atomic and I didn't really get to it because of my little Bill is that you can treat it as a relational database Key-value store or graph database just depending on how you access The information based on your query. So you could you could query based on the attribute, right, which is photograph data means as you can say like Give me all the people that go to location that that's the value of the location that they go to Or you can access the relationship by how is that efficient? Like granted Yeah, so It's designed to know You're gonna carry on that thing. So I'm gonna keep that index hot and ready to go Whereas if I haven't told it that and I say to tell me all the people who go to the T-Rise place So they talk about actually indexes for you all the attributes and all like elastic search. Yeah So it doesn't well not elastic search, but yeah, that's another search for something like elastic search for text search, but But it indexes all the attributes and any So it actually jumps to that index and then it knows whatever these Point it's not Yeah So I think that's like I mean I'll tell you one of the first thing Full idea of like Especially like you know had to go about weird for complex ERP systems where they like, okay So what happened look what happened two years back on this? How is this like huge So But again But in particular, yeah What particular problem does this solve and say we wouldn't be able to do When you're special like this But you know in the series develop a specific Specific problem Right So I don't know if it if it's super power, but I feel like the way they taught me implemented The way it organizes information is a lot simpler than most databases so Everything in the topic is just the data, right? There's no higher Yeah, there's no higher Idea apart from that the fact that you don't have to Decide upfront that you want to graph database or you want you want something that can travel back in time It just does that because of how it's implemented Makes me feel more comfortable because I don't really know What I can want You know I've been treated by the idea that I which Properly is waiting in-depth functional discussion of Wrapping data in the enclosures and funcler and funcler is to communicate how my data is being processed dreamed and graphed Seeing in fact that everything's data It's a program This is going back to the real statement saying that it doesn't it doesn't know the difference in fact it is Or it's just it's just closure with data in memory I'm very interesting how when I have big big data and my old database is in memory as a function to complicated Functional stuff on my data Sorry, that was a very rambling statement that didn't question the question that I was intending to ask Is it if I wanted to put closures around each of these statements That you're talking earlier and then pass them in so that when I'm asking for my data, I can Everything has to go around it and I can be muting to my data My is that a trivial So the thing is You have an immutable Version of the database. It's not actually Changing from underneath. Yeah, right But I am it's being filtered through whatever I pass through it's being transformed in the final right Yeah, and I can swap those transforms out Willy-nilly you can yeah I'm not sure Right. Yes, so all of these transactions are Atomic and if you value like it's several variations Yeah, so when you When you transact it it verifies that you're not violating it in the cardinality Like rules that you put in your seat, and is it blockings? Yeah, all all data rights are Yeah, well, you can update multiple data Sorry, an entity doesn't actually exist as As an idea, it's just it's just a joint on the first column of the day, which they're treating as the idea Yeah I'm not sure