// Abstract ------------------------------------------------------------------------------------------------------------------------------

This sample contains all the examples used in Fizz' user manual.
 
// Code ----------------------------------------------------------------------------------------------------------------------------------

color {

    (red,1.0,0.0,0.0);
    (green,0.0,1.0,0.0);
    (blue,0.0,0.0,1.0);

}

weather {

    (paris,rain)        {stamp = 1507093154.766867} := 0.8;
    (seattle,sunny)     {stamp = 1507093158.846844} := 0.2;
    (london,fog)        {stamp = 1507093174.863446} := 0.9;
    (mawsynram,rain)    {stamp = 1507093176.743262} := 1  ;
    (honolulu,snow)     {stamp = 1507093177.671228} := 0  ;
    (honolulu,rain)     {stamp = 1507093178.743266} := 0.1;
    (honolulu,sunny)    {stamp = 1507093179.807307} := 0.6;
    (honolulu,cloudy)   {stamp = 1507093180.879415} := 0.3;

}

surely_raining {

    (:x) :- @weather(:x,rain) <0.7|1.0>;

}

maybe_rainbow {

    (:x) :- @weather(:x,rain), @weather(:x,sunny);

}

str.default {

    (:a,:b,:b) :- console.puts("1>"), !is.string(:a)^;
    (:a,:b,:b) :- console.puts("2>"), is.string(:a) , str.length(:a,0)^;
    (:a,:b,:a) :- console.puts("3>"), is.string(:a) , str.length(:a,_?[gt(0)]);

}

yearly_stats {

    (2001,0.4,45u,3f);

}

quotes {

    (DrSeuss,"Don't cry because it's over, smile because it happened.");
    (OscarWilde,"Be yourself; everyone else is already taken.");
    (Gandhi,"Be the change that you wish to see in the world.");

}

identifiers {

    (jill);
    (jack74);
    (bob.phone);
    (bob.age);

}

blobs {

    ('dGhlIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==');

}

lst.print {

    ([]);
    ([:h|:t]) :- console.puts(:h), @lst.print(:t);

}

gameboy.color {

    ({r = 0.509803, g = 0.784313, b = 0.294117});
    ({r = 0.325490, g = 0.670588, b = 0.392156});
    ({r = 0.164705, g = 0.549019, b = 0.349019});
    ({r = 0.000000, g = 0.294117, b = 0.282352});

}

weather2 {

    (paris,rain(0.5),wind(0.1),sun(0.4),snow(0.1),fog(0.1));
    (london,rain(0.6),wind(0.1),sun(0.3),snow(0.0),fog(0.7));

}

car.range {

    alias = crange

} {

    (ford(focus),76);
    (tesla(model_s),<210|315>);
    (tesla(model_x),<237|289>);
    (chevy(bolt),238);
    (nissan(leaf),107);

}

rand {class = FZZCRandomizer, min = 1550, max = 1650, mod = 4} {

}

product {

    (model_e,tesla,2012);
    (iphone_x,apple,2018);
    (vive,htc,2015);
    (coconut_water,zico,2000);

}

product {

    (iphone,apple,2007);
    (iphone_3GS,apple,2009);
    (7710,nokia,2005) := 0.9;

}

product.g {

    (:l,:m,:y,%gui) :- #product(:l,:m,:y?[gt(2005)]);

}

multiplier {

    factor = 2

} {

    (:v,:v2) :- peek(factor,:f), mul(:v,:f,:v2);

}

tick {
    class = FZZCTicker,
    mod   = 4
} {

}

// ---------------------------------------------------------------------------------------------------------------------------------------

[Home] [Email] [Twitter] [LinkedIn]