AltME: Liquid

Messages

Maxim
Just wanted to drop a little note here that I just released a new library for liquid which is a pretty simple dialect to build up dataflow graphs.
Its pretty advanced in the sense that it leverages binding and allows some nice in-line plug building with very little code required.
the library is called fluid and is part of the liquid-libs package here:
https://github.com/moliad/liquid-libs
Gregg
Sounds very cool Max.

Arnold
Any short info for those who are not familiar with liquid?
Maxim
liquid is basically a dataflow management kernel.  
You build up node classes (plugs) which have their own internal controlers for messaging, processing and more.
Then you connect them in various ways so that any change in dependencies automatically updates relevant data.
Liquid really becomes powerful when toolsets are built using it and then interconnected.  for example, Glass is built from the ground up using liquid, so that you can instantly connect any liquid node into the GUI with a single link and all changes to the data end up in the interface with absolutely no tracking work on your part.
In the next week or two I will release a lot of stuff which is liquid and Glass enabled, including the old Glass help and tutorial distribution.
The header-box and Glimmer apps will show very advanced examples of Liquid and Glass use.  now with Fluid, it should be much easier to work with complex liquid networks.
Arnold
Thank you Maxim. I have read your explanations 3 times by now, I am getting a bit of an idea now what it is about. Search terms Glass, Liquid and fluid are not very helpful on Google, unless you want to know if Glass is a solid or a fluid..
PeterWood
Glass is a liquid or to be more precise, a super-cooled ligquid. MAx knows his stuff :-)
Josh
I am sure Max is changing it, but this was the ormer documentation http://www.pointillistic.com/open-REBOL/moa/steel/liquid/plug/plug-quickstart.html
ormer=>former
Josh
I would suggest this for an example:  http://www.rebol.org/view-script.r?script=blood.r
DocKimbel
Max, where can I find GLayout dialect examples?
Typically, I'm interested in how you connect a scrollbar to a face, is that done at dialect level, or inside the GUI engine?

Josh
Max, this may be a naive suggestion, but for enabling folks to use your libs, in my mind, it may make sense to give a complete repository that contains slim at the root with the various libs in subdirectories.  Finally got things in working order, but rebol.org's blood.r is broken with the latest liquid version
Josh
The reason for that is I ran into this with pretty much every script I tried to run:
REBOL/View 2.7.8.3.1 1-Jan-2011
Copyright 2000-2011 REBOL Technologies.  All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> do %slim.r
>> do %libs/liquid/fluid.r
** User Error: SLiM/open() utils-words library not found (paths: )
** Near: to error! :value
I assume either I need to download the utils-lib from its repository or I need to use the SLIM dialect to open fluid, but may take me time to sort out which
Josh
I guess UTILS-WORDS and UTILS-LIB are not the same, not sure what to do then
Josh
Guess it's just the dialect:  liquid-lib: slim/open/expose 'liquid 0.7.0 [liquify link content fill !plug attach]
Josh
Threw together an initial attempt at my scheduling problem using Liquid:  https://raw.github.com/kealist/rebol/master/slim/schedule.r
Josh
Josh
Would like to know how to connect multiple plugs, like have a target plug, that sets a day and time, and the schedule plugs contain the data for all of the days/times
multiple types of plugs
Josh
Re: ealier question about complete slim:   Just say: https://github.com/moliad/slim-complete-set

Josh
just say => just saw
Josh
Maxim, I think I need a little help with a paradigm shift with making my code more efficient.   I rewrote the above schedule.r here: https://raw.github.com/kealist/rebol/master/slim/libs/liquid-libs/schedule2.r
However, I see some kind of race condition (with all the other plugs, where even if the variable FREE? is false, it still does the code in the if FREE? [do stuff] conditional.    If that particular value in any of the plugs is set to true, it causes it to be true for all of them
Maxim
hi guys, sorry was out for the week-end.   :-)
Maxim
Doc, GLayout was pretty ordinary stuff basically just a big layer over VID.
in, Glass links between a few plugs creates the algorythm which keep scrolling and face offset in sync.  this is one of the most advanced setups in Glass because there are 3 values in sycn through a bridge plug.  basically, you have pixel offset/range of the faces, pixel offset/range of the scroll bar and value offset from the scrollbar.   Its all done within the scrollface group style.
Josh, wrt distribution, there is that project ( https://github.com/moliad/slim-complete-set ) which basically allows you to get all of the sub repositories, but that might be removed at some point because you still need to know how to get all the sub libs and its a pain through Git.
in my next release push (which I'm working on right now) I will fill up a new repository with a throve of tools and stuff, one of which is a script to Get and update all slim libraries from Git, all you need is a version of Git installed and available from CALL .
Arnold, to search for my stuff, write REBOL as the first keyword and then the project you want (ex: "REBOL GLASS") ... in general its pretty on-topic.
note that the releases I am going to be doing in the next few weeks should help all of you get to grips with my complete framework, which includes A LOT of tasty code to build apps which more polish in very few steps.
Maxim
john, I'm giving a little look at your schedule example...
(oops, I meant josh... hehehe)
Josh
Thank you for checking into it.
Maxim
so, gone over it and found the issue in you code.... it's not related to liquid.  the idea is that the data you give is not what you expect.  
in your table, true and false are words... not logic! values.   So, either you use #[true] #[false]  or you reduce the block before searching within.
btw, I'm having fun re-writing it quickly.
Josh
Sweet, thank you.  Not sure I fully grok it, but I'll keep an eye for that in the future.   Love to see your version
Josh
I think I got ya:
>> if true [print 2]
2
>> if false [print 2]
== none
>> b: 3
== 3
>> b: [3 true]
== [3 true]
>> if (second b) [print 1]
1
>> c: [3 false]
== [3 false]
>> if (second c) [print 1]
1
>> if (do second c) [print 1]
== none
>> if (do second b) [print 1]
1
Kaj
Yep
The difference is not so much DO, but BIND

Endo
c: [3 false]  ; this should
c: reduce [3 false]  ; to get desired result
Maxim
Endo yes, that is the prefered method.
Josh
Got it.  I have a better working version now! Generates a new schedule that shows for each hour who is available

Josh
Can generate crappy HTML even:  https://raw.github.com/kealist/rebol/master/slim/libs/liquid-libs/calendar.html
That's one of my week areas.
Anyways, to keep on topic with !liquid, I have a !plug that generates the schedule of availability, it's of a particular type, can I just link it to another type to process data from that?  I ask this because I'm not sure what the following line does at the end of the Process(plug,inputs) function
  plug/liquid: available
week=> weak
Cyphre
Endo, IMO the best method is to use :
c: [3 #[false]]
Endo
But it leads problems when encapping the script.
Maxim
Hi Josh, here is your inital example rewritten.  I put three versions for you and all to compare.
you will have to update your repository, as It doesn't contain fluid and there have been a few fixes since you forked my libs.
http://www.pointillistic.com/open-REBOL/moa/files/josh-test.r
http://www.pointillistic.com/open-REBOL/moa/files/josh-test-fluid.r
http://www.pointillistic.com/open-REBOL/moa/files/josh-test-glass.r
Maxim
btw, I usually put my libraries at the same depth as my projects, so that all my projects use the same libs by default.... so I have this on disk:
dev/projects/
    slim-libs/
        slim/
        liquid-libs/
        glass-libs/
        utils-libs/
        ...
    projectA/
    projectB/
and in my scripts, I'll thus use   do %../slim-libs/slim.r
(btw, in the above scripts, the scripts where in a subdir of the project, so they have %../../  instead of %../
Maxim
Endo, yes, serialized values are the death of many encaps and the encap system being extremely faulty led me to write a String parsing equivalent which doesn't LOAD scripts.
Josh
Maxim, nice!  I will rearrange the libs and adapt my code to match the style of yours if I have time tonight
Maxim
happy it helps you.  There will be some improvements to the fluid dialect again this week for sure.  We will start using it at the office, so it should be solid (pun intended ;) very quickly.
now if you realize it, adding new stuff to the app is quite easy because you can just link to some of the data which is already processed.  no need to even know why or how it ends up there.   you can just rely on it being up to date each time its manipulated.
Josh
There can be circles in the graph, right?   and different types of plugs as inputs would be differentiated with an if plug/type = !sometype conditional in the process function?
Maxim
in theory, liquid allows circular references, but by default they are verified and prevented.  the reason is that when a dependency is modified, it will run in circles indefinitely telling its observers they should adapt.

Maxim
for differenciating input *plug* types, at processing that is not something you should be doing.  plugs should not behave differentely based on what type of plug they are linked to but what type of data is comming in.     There are a few philosophical and a few technical reasons for this.  all of them concerned with your well being in the future.  
its funny, my co-worker asked me the same exact thing today and I showed him that it was better to find a different way to link his stuff ... which did in fact solve the problem he had created in the first place.
its a bit like function parameters.  their order is significant, you don't react based on which other function called you, only to the data which comes in.  in Liquid you have the extra option to have variable number of inputs.  it makes it tempting to try and figure out what type of plug sent you each item of data, but its better to just make sure the data items are of the type you expect and put extra effort into linking your stuff properly.   the network is as significant as the data flowing through it.
in the examples I wrote, you'll notice how I inspect the input data within the '!AVAILABLE plug type.  that is the proper way of filtering out input.  also, since you'll be setting the plug/liquid to none, and each node will likely ignore any none input, it just fails gracefull, until one node in the graph decides its can recover from bad input and reset part of the graph below it.
Josh
I see a few things I was doing improperly,  The data plugs don't need to be the !available plug type.  You set them as containers.  Is the PICK DATA 1 just getting the first linked plug?  If so, iss that a common practice? (The order of linking is important?)
Maxim
yep, you got everything right  :-)
the linking order is guaranteed to be preserved (until you change it)
Josh
Which is why I was worried about !plug type to begin with, but using containers is just data, unless it isn't a leaf
Maxim
containers are always leafs... anything you use  'FILL on becomes a leaf (or more precisely can be or contain, a leaf)
when you fill a plug, it bypasses the normal dependency system.  but you can setup a plug so it uses both the filled data and the links.  
When you set it up like so, the filled data acts just like a link, which you can decide to be always the first or last item in the process data you receive.
Josh
If I dynamically create a lot of plugs/containers with random data and linked them to a plug, what would be the best way to unlink them if necessary?
I guess I need to read through the code comments to see all the functionality
Maxim
Regarding cycles...   usually, when a cycle is required in your data, you can relink it differently to create a different graph which doesn't require a cycle.  some things require to take a value and modify it, for example adding to a leaf.  that can't be done within liquid easily.   it CAN be done, but requires advanced understanding of all the messaging and processing so that you replace some of the low-level code within !plug.
if you look at the !LATCH plug type in the glue.r module, you'll see that you can play around with messaging and allow for some cycling... since that plug will only allow ONE cycle in the second link until you change the value of the first link.
Josh
I think this is a pretty interesting way to program.   I appreciate all your help and hopefully I can get this whole application up and running.
Maxim
unlinking is done in one of two ways depending on what end of the plug you want to stop looking at.
its either the unlink function, a plug stops looking at (depending on) another one, or the insubordinate function which unlinks all the plugs depending on it.
Maxim
the fluid dialect makes it sooo much simpler now.
there will be a new release of it today.
Josh
You are really on a roll these days!  Just hope to have some documentation.  Wish i could have seen your presentation at RECODE.
Gregg
For docs, what we need to do is take Max's posts here, format as blog entries, and publish. :-)
Maxim
I'm releasing or updating stuff just about every week... if you look on my stats on github... there is quite a bit of green.  :-)
for now, I was thinking of using github's wiki:
https://github.com/moliad/liquid-libs/wiki
though I haven't had a lot of time to put on documentation... lately, I'm using unit tests more and more as documentation.   my next big project release (Steel is comming back) will have a few tools (those shown at devcon) and a few odds and ends.
if you want to contribute stuff on the wiki... be my guest AFAIK its public, so any github user should be able to add stuff.
Gregg
Wiki = good. :-)
Maxim
Can anyone confirm that they can play with the wiki without me needing to adding them to some "allowed contributors" list?   TIA
Gregg
Confirmed.

Maxim
kewl  so if anyone wants to start taking charge of documentation for one or many of my projects... you are more than welcome  :-)
note that just about all the code I release is being actively used in production right now.  Some of these are mission critical apps which run automated systems and integrate into other systems like Sharepoint.
Josh
After a little trouble, I got it converted to more proper techniques.   I am going to add HTML emitter nodes instead of manually doing so, then I'll work on integrating it into Glass.
(It outputs two html files)
Maxim
only comment is that you should try out vprint.  much easier than having to comment out all the prints.  :-)
Josh
Max, I had an incorrect variable name (I had changed it from a previous version)  I got no error at all, only the vin output and nothing after that (it hung).  Is there a way to still have it still output errors such as that?
It was the last line of the script, I had CONTENT AVAILABLE-PLUG ; instead of CONTENT AVAILABILITY
It took me about 15 minutes to figure that out instead of half a second because of the lack of reporting
Maxim
vprinting doesn't play with error raising.
Josh
"doesn't play with" -> Does that mean does not affect?
Maxim
yep.  only fluid plays with error reporting when it creates plug types on the fly.
Josh
Let me make a case example and send it to you before I say anything else :)
Maxim
oki

Maxim
updated fluid on github.

Maxim
I just did a 5 minute demo of fluid to a non programmer and she understood everything she saw almost instantly...
I showed her sample direct liquid coding and the first line she saw already screwed up her sanity... so I think fluid is going to be quite a big deal   :-)
I just did a 5 minute demo of fluid to a non programmer and she understood everything she saw almost instantly...
I showed her sample direct liquid coding and the first line she saw already screwed up her sanity... so I think fluid is going to be quite a big deal   :-)

Maxim
Fluid Dialect had a big update on friday and I updated the Unit testing script on Steel today.

Maxim
just released a big revision of Fluid.   it can now remodel any plug and can share plugs between two contexts, such that modifying plugs in the flow, will ALSO modify plugs in the source context they where taken from.   this allows us to use flow directly within glass, and even merge the aspects, materials of several controls into one pool and do linking between them.
this makes it much easier (though slower) to build layout graphs, for example.
slower in that the the flow fluid dialect does add a big overhead to liquid manipulation, (it adds a lot of error checks, builds temporary datasets and automated house cleaning).
arghhh   "the the flow fluid "   ==  "the fluid"
I will probably build a fluid compiler, which returns a block of raw liquid commands that you can use directly in place of your fluid block, once it does what it should.

amacleod
Maxim, I see you mention a port to Red. Just wondering how that process was....
Also, are you planning a port of glass?

Maxim
hi alan, yes on both accounts.  My team and I are currently preparing the project.

Last message posted 308 weeks ago.