Church BooleansBuild an adding machine using NAND logic gatesBuild a multiplying machine using NAND logic gatesBuild a 2-way universal logic processor using NAND logic gatesBuild a bit-counting comparator using NAND logic gatesBuild a minifloat adding machine using NAND logic gatesBuild an EBCDIC converter using NAND logic gatesCreate a Boolean parser (continued)Gerrymandering with Logic Gates

Why doesn't mathematics collapse down, even though humans quite often make mistakes in their proofs?

Unbiased estimator of exponential of measure of a set?

How do you call it when two celestial bodies come as close to each other as they will in their current orbits?

How can I describe being temporarily stupid?

iPhone 8 purchased through AT&T change to T-Mobile

Why does my air conditioner still run, even when it is cooler outside than in?

Is there such a thing as too inconvenient?

Why should someone be willing to write a strong recommendation even if that means losing a undergraduate from their lab?

How could China have extradited people for political reason under the extradition law it wanted to pass in Hong Kong?

Convert HTML color to OLE

Unsolved Problems (Not Independent of ZFC) due to Lack of Computational Power

Does C++20 mandate source code being stored in files?

Is "stainless" a bulk or a surface property of stainless steel?

Can my Boyfriend, who lives in the UK and has a Polish passport, visit me in the USA?

Are there reliable, formulaic ways to form chords on the guitar?

Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")

Use of vor in this sentence

How could Tony Stark wield the Infinity Nano Gauntlet - at all?

Can I submit a paper under an alias so as to avoid trouble in my country?

What can I do to keep a threaded bolt from falling out of it’s slot

Do living authors still get paid royalties for their old work?

Infinite loop in CURSOR

Why didn’t Doctor Strange stay in the original winning timeline?

Earliest evidence of objects intended for future archaeologists?



Church Booleans


Build an adding machine using NAND logic gatesBuild a multiplying machine using NAND logic gatesBuild a 2-way universal logic processor using NAND logic gatesBuild a bit-counting comparator using NAND logic gatesBuild a minifloat adding machine using NAND logic gatesBuild an EBCDIC converter using NAND logic gatesCreate a Boolean parser (continued)Gerrymandering with Logic Gates






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








8












$begingroup$


Church booleans



A church boolean is a function that returns x for true and y for false where x is the first argument to the function and y is the second argument to the function. Further functions can be composed from these functions which represent the and not or xor and implies logical operations.



Challange



Construct the church booleans and and not or xor and implies church gates in a language of your choice. And or and xor should take in two functions (representing church booleans) and return a function (representing another church boolean). Likewise, not should invert a the function it takes and the implies gate should perform boolean implies logic where the first argument implies the second.



Scoring



The total length of all of the code required to make church true and false in your language and the and not or xor and implies church gates excluding the functions name. (for example, false=lambda x,y:y in python would be 13 bytes). You can reuse these names later in your code with them counting 1 byte toward the byte total of that gate.



Pseudo code Examples:



The functions you create should be able to be called later in your code like so.



true(x, y) -> x
false(x, y) -> y
and(true, true)(x, y) -> x
and(true, false)(x, y) -> y
# ... etc









share|improve this question









New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$













  • $begingroup$
    Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    @UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
    $endgroup$
    – Ryan Schaefer
    7 hours ago










  • $begingroup$
    @JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
    $endgroup$
    – Ryan Schaefer
    5 hours ago






  • 1




    $begingroup$
    @JonathanAllan I edited it so it was correct. The prompt is as it should be now.
    $endgroup$
    – Ryan Schaefer
    5 hours ago

















8












$begingroup$


Church booleans



A church boolean is a function that returns x for true and y for false where x is the first argument to the function and y is the second argument to the function. Further functions can be composed from these functions which represent the and not or xor and implies logical operations.



Challange



Construct the church booleans and and not or xor and implies church gates in a language of your choice. And or and xor should take in two functions (representing church booleans) and return a function (representing another church boolean). Likewise, not should invert a the function it takes and the implies gate should perform boolean implies logic where the first argument implies the second.



Scoring



The total length of all of the code required to make church true and false in your language and the and not or xor and implies church gates excluding the functions name. (for example, false=lambda x,y:y in python would be 13 bytes). You can reuse these names later in your code with them counting 1 byte toward the byte total of that gate.



Pseudo code Examples:



The functions you create should be able to be called later in your code like so.



true(x, y) -> x
false(x, y) -> y
and(true, true)(x, y) -> x
and(true, false)(x, y) -> y
# ... etc









share|improve this question









New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$













  • $begingroup$
    Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    @UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
    $endgroup$
    – Ryan Schaefer
    7 hours ago










  • $begingroup$
    @JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
    $endgroup$
    – Ryan Schaefer
    5 hours ago






  • 1




    $begingroup$
    @JonathanAllan I edited it so it was correct. The prompt is as it should be now.
    $endgroup$
    – Ryan Schaefer
    5 hours ago













8












8








8





$begingroup$


Church booleans



A church boolean is a function that returns x for true and y for false where x is the first argument to the function and y is the second argument to the function. Further functions can be composed from these functions which represent the and not or xor and implies logical operations.



Challange



Construct the church booleans and and not or xor and implies church gates in a language of your choice. And or and xor should take in two functions (representing church booleans) and return a function (representing another church boolean). Likewise, not should invert a the function it takes and the implies gate should perform boolean implies logic where the first argument implies the second.



Scoring



The total length of all of the code required to make church true and false in your language and the and not or xor and implies church gates excluding the functions name. (for example, false=lambda x,y:y in python would be 13 bytes). You can reuse these names later in your code with them counting 1 byte toward the byte total of that gate.



Pseudo code Examples:



The functions you create should be able to be called later in your code like so.



true(x, y) -> x
false(x, y) -> y
and(true, true)(x, y) -> x
and(true, false)(x, y) -> y
# ... etc









share|improve this question









New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




Church booleans



A church boolean is a function that returns x for true and y for false where x is the first argument to the function and y is the second argument to the function. Further functions can be composed from these functions which represent the and not or xor and implies logical operations.



Challange



Construct the church booleans and and not or xor and implies church gates in a language of your choice. And or and xor should take in two functions (representing church booleans) and return a function (representing another church boolean). Likewise, not should invert a the function it takes and the implies gate should perform boolean implies logic where the first argument implies the second.



Scoring



The total length of all of the code required to make church true and false in your language and the and not or xor and implies church gates excluding the functions name. (for example, false=lambda x,y:y in python would be 13 bytes). You can reuse these names later in your code with them counting 1 byte toward the byte total of that gate.



Pseudo code Examples:



The functions you create should be able to be called later in your code like so.



true(x, y) -> x
false(x, y) -> y
and(true, true)(x, y) -> x
and(true, false)(x, y) -> y
# ... etc






code-golf logic-gates functional-programming






share|improve this question









New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 5 hours ago







Ryan Schaefer













New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 9 hours ago









Ryan SchaeferRyan Schaefer

1415 bronze badges




1415 bronze badges




New contributor



Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Ryan Schaefer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • $begingroup$
    Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    @UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
    $endgroup$
    – Ryan Schaefer
    7 hours ago










  • $begingroup$
    @JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
    $endgroup$
    – Ryan Schaefer
    5 hours ago






  • 1




    $begingroup$
    @JonathanAllan I edited it so it was correct. The prompt is as it should be now.
    $endgroup$
    – Ryan Schaefer
    5 hours ago
















  • $begingroup$
    Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    @UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
    $endgroup$
    – Ryan Schaefer
    7 hours ago










  • $begingroup$
    @JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
    $endgroup$
    – Ryan Schaefer
    5 hours ago






  • 1




    $begingroup$
    @JonathanAllan I edited it so it was correct. The prompt is as it should be now.
    $endgroup$
    – Ryan Schaefer
    5 hours ago















$begingroup$
Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
$endgroup$
– Unrelated String
7 hours ago




$begingroup$
Do we have to treat the function inputs (or closest substitutes) as black-box functions, or can we inspect the code within? And must the return values of the logical operations be the same functions as previously defined as the Church booleans, or can they be something else which does the same thing?
$endgroup$
– Unrelated String
7 hours ago












$begingroup$
@UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
$endgroup$
– Ryan Schaefer
7 hours ago




$begingroup$
@UnrelatedString the inputs to the function are essentially a cat program that copy input to output, but based on if they are true or false. For example, a true church boolean takes in two inputs (which chould be "foo" and 3, basically anything) and returns the first argument ("foo"). They don't have to be the exact functions you previously described, but I would imagine it would save a lot of space if you did this.
$endgroup$
– Ryan Schaefer
7 hours ago












$begingroup$
@JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
$endgroup$
– Ryan Schaefer
5 hours ago




$begingroup$
@JonathanAllan I added it later, and I am regretting it. I should've just kept it to purely gates.
$endgroup$
– Ryan Schaefer
5 hours ago




1




1




$begingroup$
@JonathanAllan I edited it so it was correct. The prompt is as it should be now.
$endgroup$
– Ryan Schaefer
5 hours ago




$begingroup$
@JonathanAllan I edited it so it was correct. The prompt is as it should be now.
$endgroup$
– Ryan Schaefer
5 hours ago










5 Answers
5






active

oldest

votes


















9












$begingroup$


Haskell, 52 - 6 = 46 bytes





t=const
f=t id
n=flip
a=($f).n
o=($t)
x=(n>>=)
i=o.n


Try it online!






share|improve this answer









$endgroup$














  • $begingroup$
    Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
    $endgroup$
    – nimi
    6 hours ago










  • $begingroup$
    a can be shortened.
    $endgroup$
    – Khuldraeseth na'Barya
    4 hours ago






  • 2




    $begingroup$
    Why is no one using f=n t?
    $endgroup$
    – Christian Sievers
    2 hours ago






  • 1




    $begingroup$
    You can save a byte by using t=pure instead of t=const.
    $endgroup$
    – Joseph Sible
    46 mins ago


















3












$begingroup$


Python 2, 133 - 6 = 127 94 bytes





exec"t!u;f!v;n!u(f,t);a!u(v,f);o!u(t,v);x!u(n(v),v);i!o(v,n(u))".replace('!','=lambda u,v=0:')


Try it online!



Shamelessly stealing the sneaky idea behind Jonathan Allan's answer; no bytes deducted though.






share|improve this answer











$endgroup$














  • $begingroup$
    I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
    $endgroup$
    – Ryan Schaefer
    7 hours ago










  • $begingroup$
    I'd wager that although the answer is yes, it would be considerably longer in Python.
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    I stand corrected
    $endgroup$
    – Unrelated String
    7 hours ago










  • $begingroup$
    This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
    $endgroup$
    – Mr. Xcoder
    7 hours ago











  • $begingroup$
    @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
    $endgroup$
    – Ryan Schaefer
    6 hours ago


















2












$begingroup$


JavaScript (Node.js), 92 - 7 = 85 bytes





t=p=>q=>p
f=p=>q=>q
n=p=>q=>r=>p(r)(q)
a=p=>q=>p(q)(f)
o=p=>p(t)
x=p=>p(n)(f())
i=p=>o(n(p))


Try it online! Link includes basic test cases.






share|improve this answer











$endgroup$














  • $begingroup$
    @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
    $endgroup$
    – Neil
    5 hours ago


















2












$begingroup$


Python 2, 101 - 3 = 98 bytes



David Beazley eat your heart out!





exec'=lambda x,y=0'.join('F :y;T :x;N :x(F,T);A :x(y,F);O :x(T,y);X :x(N(y),y);I :O(y,N(x))'.split())


Try it online!



I think 101 - 3 because I don't reuse the functions A, X, or I, but I use a single = for assignment (in front of lambda). Maybe I cant remove any?






share|improve this answer











$endgroup$














  • $begingroup$
    @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
    $endgroup$
    – Jonathan Allan
    4 hours ago











  • $begingroup$
    95 bytes (before the -3)
    $endgroup$
    – Chas Brown
    20 mins ago


















0












$begingroup$


J, 67 bytes - 7 = 60



t=.[
f=.]
n=.~
a=.2 :'u v]'
o=.2 :'[u v'
x=.2 :'u~v u'
i=.2 :'v u['


Try it online!



Worth noting:



Higher order functions work differently in J than in a functional language. To create a new verb from 1 or 2 existing verbs, you need to use either an adverb (in the case of 1) or a conjunction (in the case of 2).



Syntactically, adverbs come after a verb, and conjunctions go between them. Thus to "not" a verb f you do f n, and to "and" verbs f and g, you f a g.






share|improve this answer











$endgroup$

















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "200"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Ryan Schaefer is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f190325%2fchurch-booleans%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    9












    $begingroup$


    Haskell, 52 - 6 = 46 bytes





    t=const
    f=t id
    n=flip
    a=($f).n
    o=($t)
    x=(n>>=)
    i=o.n


    Try it online!






    share|improve this answer









    $endgroup$














    • $begingroup$
      Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
      $endgroup$
      – nimi
      6 hours ago










    • $begingroup$
      a can be shortened.
      $endgroup$
      – Khuldraeseth na'Barya
      4 hours ago






    • 2




      $begingroup$
      Why is no one using f=n t?
      $endgroup$
      – Christian Sievers
      2 hours ago






    • 1




      $begingroup$
      You can save a byte by using t=pure instead of t=const.
      $endgroup$
      – Joseph Sible
      46 mins ago















    9












    $begingroup$


    Haskell, 52 - 6 = 46 bytes





    t=const
    f=t id
    n=flip
    a=($f).n
    o=($t)
    x=(n>>=)
    i=o.n


    Try it online!






    share|improve this answer









    $endgroup$














    • $begingroup$
      Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
      $endgroup$
      – nimi
      6 hours ago










    • $begingroup$
      a can be shortened.
      $endgroup$
      – Khuldraeseth na'Barya
      4 hours ago






    • 2




      $begingroup$
      Why is no one using f=n t?
      $endgroup$
      – Christian Sievers
      2 hours ago






    • 1




      $begingroup$
      You can save a byte by using t=pure instead of t=const.
      $endgroup$
      – Joseph Sible
      46 mins ago













    9












    9








    9





    $begingroup$


    Haskell, 52 - 6 = 46 bytes





    t=const
    f=t id
    n=flip
    a=($f).n
    o=($t)
    x=(n>>=)
    i=o.n


    Try it online!






    share|improve this answer









    $endgroup$




    Haskell, 52 - 6 = 46 bytes





    t=const
    f=t id
    n=flip
    a=($f).n
    o=($t)
    x=(n>>=)
    i=o.n


    Try it online!







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 6 hours ago









    NitrodonNitrodon

    8,6662 gold badges10 silver badges27 bronze badges




    8,6662 gold badges10 silver badges27 bronze badges














    • $begingroup$
      Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
      $endgroup$
      – nimi
      6 hours ago










    • $begingroup$
      a can be shortened.
      $endgroup$
      – Khuldraeseth na'Barya
      4 hours ago






    • 2




      $begingroup$
      Why is no one using f=n t?
      $endgroup$
      – Christian Sievers
      2 hours ago






    • 1




      $begingroup$
      You can save a byte by using t=pure instead of t=const.
      $endgroup$
      – Joseph Sible
      46 mins ago
















    • $begingroup$
      Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
      $endgroup$
      – nimi
      6 hours ago










    • $begingroup$
      a can be shortened.
      $endgroup$
      – Khuldraeseth na'Barya
      4 hours ago






    • 2




      $begingroup$
      Why is no one using f=n t?
      $endgroup$
      – Christian Sievers
      2 hours ago






    • 1




      $begingroup$
      You can save a byte by using t=pure instead of t=const.
      $endgroup$
      – Joseph Sible
      46 mins ago















    $begingroup$
    Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
    $endgroup$
    – nimi
    6 hours ago




    $begingroup$
    Side note: you can define Show instances for const and const id and print the church booleans directly. Try it online!.
    $endgroup$
    – nimi
    6 hours ago












    $begingroup$
    a can be shortened.
    $endgroup$
    – Khuldraeseth na'Barya
    4 hours ago




    $begingroup$
    a can be shortened.
    $endgroup$
    – Khuldraeseth na'Barya
    4 hours ago




    2




    2




    $begingroup$
    Why is no one using f=n t?
    $endgroup$
    – Christian Sievers
    2 hours ago




    $begingroup$
    Why is no one using f=n t?
    $endgroup$
    – Christian Sievers
    2 hours ago




    1




    1




    $begingroup$
    You can save a byte by using t=pure instead of t=const.
    $endgroup$
    – Joseph Sible
    46 mins ago




    $begingroup$
    You can save a byte by using t=pure instead of t=const.
    $endgroup$
    – Joseph Sible
    46 mins ago













    3












    $begingroup$


    Python 2, 133 - 6 = 127 94 bytes





    exec"t!u;f!v;n!u(f,t);a!u(v,f);o!u(t,v);x!u(n(v),v);i!o(v,n(u))".replace('!','=lambda u,v=0:')


    Try it online!



    Shamelessly stealing the sneaky idea behind Jonathan Allan's answer; no bytes deducted though.






    share|improve this answer











    $endgroup$














    • $begingroup$
      I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
      $endgroup$
      – Ryan Schaefer
      7 hours ago










    • $begingroup$
      I'd wager that although the answer is yes, it would be considerably longer in Python.
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      I stand corrected
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
      $endgroup$
      – Mr. Xcoder
      7 hours ago











    • $begingroup$
      @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
      $endgroup$
      – Ryan Schaefer
      6 hours ago















    3












    $begingroup$


    Python 2, 133 - 6 = 127 94 bytes





    exec"t!u;f!v;n!u(f,t);a!u(v,f);o!u(t,v);x!u(n(v),v);i!o(v,n(u))".replace('!','=lambda u,v=0:')


    Try it online!



    Shamelessly stealing the sneaky idea behind Jonathan Allan's answer; no bytes deducted though.






    share|improve this answer











    $endgroup$














    • $begingroup$
      I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
      $endgroup$
      – Ryan Schaefer
      7 hours ago










    • $begingroup$
      I'd wager that although the answer is yes, it would be considerably longer in Python.
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      I stand corrected
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
      $endgroup$
      – Mr. Xcoder
      7 hours ago











    • $begingroup$
      @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
      $endgroup$
      – Ryan Schaefer
      6 hours ago













    3












    3








    3





    $begingroup$


    Python 2, 133 - 6 = 127 94 bytes





    exec"t!u;f!v;n!u(f,t);a!u(v,f);o!u(t,v);x!u(n(v),v);i!o(v,n(u))".replace('!','=lambda u,v=0:')


    Try it online!



    Shamelessly stealing the sneaky idea behind Jonathan Allan's answer; no bytes deducted though.






    share|improve this answer











    $endgroup$




    Python 2, 133 - 6 = 127 94 bytes





    exec"t!u;f!v;n!u(f,t);a!u(v,f);o!u(t,v);x!u(n(v),v);i!o(v,n(u))".replace('!','=lambda u,v=0:')


    Try it online!



    Shamelessly stealing the sneaky idea behind Jonathan Allan's answer; no bytes deducted though.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 24 mins ago

























    answered 7 hours ago









    Chas BrownChas Brown

    6,1791 gold badge6 silver badges25 bronze badges




    6,1791 gold badge6 silver badges25 bronze badges














    • $begingroup$
      I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
      $endgroup$
      – Ryan Schaefer
      7 hours ago










    • $begingroup$
      I'd wager that although the answer is yes, it would be considerably longer in Python.
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      I stand corrected
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
      $endgroup$
      – Mr. Xcoder
      7 hours ago











    • $begingroup$
      @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
      $endgroup$
      – Ryan Schaefer
      6 hours ago
















    • $begingroup$
      I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
      $endgroup$
      – Ryan Schaefer
      7 hours ago










    • $begingroup$
      I'd wager that although the answer is yes, it would be considerably longer in Python.
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      I stand corrected
      $endgroup$
      – Unrelated String
      7 hours ago










    • $begingroup$
      This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
      $endgroup$
      – Mr. Xcoder
      7 hours ago











    • $begingroup$
      @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
      $endgroup$
      – Ryan Schaefer
      6 hours ago















    $begingroup$
    I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
    $endgroup$
    – Ryan Schaefer
    7 hours ago




    $begingroup$
    I was going to post an answer to my own question but I was unsure if this was allowed and I think that this is against the spirit of it. So I think I will just guide you along instead. Instead of using lists, is there anyway you can use the functions that are being input themselves and the specific manner in which they return their inputs to shorten the code?
    $endgroup$
    – Ryan Schaefer
    7 hours ago












    $begingroup$
    I'd wager that although the answer is yes, it would be considerably longer in Python.
    $endgroup$
    – Unrelated String
    7 hours ago




    $begingroup$
    I'd wager that although the answer is yes, it would be considerably longer in Python.
    $endgroup$
    – Unrelated String
    7 hours ago












    $begingroup$
    I stand corrected
    $endgroup$
    – Unrelated String
    7 hours ago




    $begingroup$
    I stand corrected
    $endgroup$
    – Unrelated String
    7 hours ago












    $begingroup$
    This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
    $endgroup$
    – Mr. Xcoder
    7 hours ago





    $begingroup$
    This is 127 bytes. You may not remove o= nor f= nor t= nor n= because you use them to define the other functions.
    $endgroup$
    – Mr. Xcoder
    7 hours ago













    $begingroup$
    @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
    $endgroup$
    – Ryan Schaefer
    6 hours ago




    $begingroup$
    @Mr.Xcoder you are correct, I had the wrong number of bytes for the example function. They would be allowed to remove 6 bytes though for the names of the functions.
    $endgroup$
    – Ryan Schaefer
    6 hours ago











    2












    $begingroup$


    JavaScript (Node.js), 92 - 7 = 85 bytes





    t=p=>q=>p
    f=p=>q=>q
    n=p=>q=>r=>p(r)(q)
    a=p=>q=>p(q)(f)
    o=p=>p(t)
    x=p=>p(n)(f())
    i=p=>o(n(p))


    Try it online! Link includes basic test cases.






    share|improve this answer











    $endgroup$














    • $begingroup$
      @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
      $endgroup$
      – Neil
      5 hours ago















    2












    $begingroup$


    JavaScript (Node.js), 92 - 7 = 85 bytes





    t=p=>q=>p
    f=p=>q=>q
    n=p=>q=>r=>p(r)(q)
    a=p=>q=>p(q)(f)
    o=p=>p(t)
    x=p=>p(n)(f())
    i=p=>o(n(p))


    Try it online! Link includes basic test cases.






    share|improve this answer











    $endgroup$














    • $begingroup$
      @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
      $endgroup$
      – Neil
      5 hours ago













    2












    2








    2





    $begingroup$


    JavaScript (Node.js), 92 - 7 = 85 bytes





    t=p=>q=>p
    f=p=>q=>q
    n=p=>q=>r=>p(r)(q)
    a=p=>q=>p(q)(f)
    o=p=>p(t)
    x=p=>p(n)(f())
    i=p=>o(n(p))


    Try it online! Link includes basic test cases.






    share|improve this answer











    $endgroup$




    JavaScript (Node.js), 92 - 7 = 85 bytes





    t=p=>q=>p
    f=p=>q=>q
    n=p=>q=>r=>p(r)(q)
    a=p=>q=>p(q)(f)
    o=p=>p(t)
    x=p=>p(n)(f())
    i=p=>o(n(p))


    Try it online! Link includes basic test cases.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 5 hours ago

























    answered 6 hours ago









    NeilNeil

    87.6k8 gold badges46 silver badges183 bronze badges




    87.6k8 gold badges46 silver badges183 bronze badges














    • $begingroup$
      @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
      $endgroup$
      – Neil
      5 hours ago
















    • $begingroup$
      @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
      $endgroup$
      – Neil
      5 hours ago















    $begingroup$
    @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
    $endgroup$
    – Neil
    5 hours ago




    $begingroup$
    @Mr.Xcoder That's not how I understood the scoring system, although it's changed again since so I restored 7 bytes anyway.
    $endgroup$
    – Neil
    5 hours ago











    2












    $begingroup$


    Python 2, 101 - 3 = 98 bytes



    David Beazley eat your heart out!





    exec'=lambda x,y=0'.join('F :y;T :x;N :x(F,T);A :x(y,F);O :x(T,y);X :x(N(y),y);I :O(y,N(x))'.split())


    Try it online!



    I think 101 - 3 because I don't reuse the functions A, X, or I, but I use a single = for assignment (in front of lambda). Maybe I cant remove any?






    share|improve this answer











    $endgroup$














    • $begingroup$
      @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
      $endgroup$
      – Jonathan Allan
      4 hours ago











    • $begingroup$
      95 bytes (before the -3)
      $endgroup$
      – Chas Brown
      20 mins ago















    2












    $begingroup$


    Python 2, 101 - 3 = 98 bytes



    David Beazley eat your heart out!





    exec'=lambda x,y=0'.join('F :y;T :x;N :x(F,T);A :x(y,F);O :x(T,y);X :x(N(y),y);I :O(y,N(x))'.split())


    Try it online!



    I think 101 - 3 because I don't reuse the functions A, X, or I, but I use a single = for assignment (in front of lambda). Maybe I cant remove any?






    share|improve this answer











    $endgroup$














    • $begingroup$
      @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
      $endgroup$
      – Jonathan Allan
      4 hours ago











    • $begingroup$
      95 bytes (before the -3)
      $endgroup$
      – Chas Brown
      20 mins ago













    2












    2








    2





    $begingroup$


    Python 2, 101 - 3 = 98 bytes



    David Beazley eat your heart out!





    exec'=lambda x,y=0'.join('F :y;T :x;N :x(F,T);A :x(y,F);O :x(T,y);X :x(N(y),y);I :O(y,N(x))'.split())


    Try it online!



    I think 101 - 3 because I don't reuse the functions A, X, or I, but I use a single = for assignment (in front of lambda). Maybe I cant remove any?






    share|improve this answer











    $endgroup$




    Python 2, 101 - 3 = 98 bytes



    David Beazley eat your heart out!





    exec'=lambda x,y=0'.join('F :y;T :x;N :x(F,T);A :x(y,F);O :x(T,y);X :x(N(y),y);I :O(y,N(x))'.split())


    Try it online!



    I think 101 - 3 because I don't reuse the functions A, X, or I, but I use a single = for assignment (in front of lambda). Maybe I cant remove any?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 4 hours ago

























    answered 5 hours ago









    Jonathan AllanJonathan Allan

    59.1k5 gold badges44 silver badges185 bronze badges




    59.1k5 gold badges44 silver badges185 bronze badges














    • $begingroup$
      @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
      $endgroup$
      – Jonathan Allan
      4 hours ago











    • $begingroup$
      95 bytes (before the -3)
      $endgroup$
      – Chas Brown
      20 mins ago
















    • $begingroup$
      @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
      $endgroup$
      – Jonathan Allan
      4 hours ago











    • $begingroup$
      95 bytes (before the -3)
      $endgroup$
      – Chas Brown
      20 mins ago















    $begingroup$
    @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
    $endgroup$
    – Jonathan Allan
    4 hours ago





    $begingroup$
    @Ryan Schaefer can I remove three or does my use of exec mean I cannot? I can see going either way - I don't reuse A, X, or I but the code wont work without them. (Maybe I even get to remove 3.5?!)
    $endgroup$
    – Jonathan Allan
    4 hours ago













    $begingroup$
    95 bytes (before the -3)
    $endgroup$
    – Chas Brown
    20 mins ago




    $begingroup$
    95 bytes (before the -3)
    $endgroup$
    – Chas Brown
    20 mins ago











    0












    $begingroup$


    J, 67 bytes - 7 = 60



    t=.[
    f=.]
    n=.~
    a=.2 :'u v]'
    o=.2 :'[u v'
    x=.2 :'u~v u'
    i=.2 :'v u['


    Try it online!



    Worth noting:



    Higher order functions work differently in J than in a functional language. To create a new verb from 1 or 2 existing verbs, you need to use either an adverb (in the case of 1) or a conjunction (in the case of 2).



    Syntactically, adverbs come after a verb, and conjunctions go between them. Thus to "not" a verb f you do f n, and to "and" verbs f and g, you f a g.






    share|improve this answer











    $endgroup$



















      0












      $begingroup$


      J, 67 bytes - 7 = 60



      t=.[
      f=.]
      n=.~
      a=.2 :'u v]'
      o=.2 :'[u v'
      x=.2 :'u~v u'
      i=.2 :'v u['


      Try it online!



      Worth noting:



      Higher order functions work differently in J than in a functional language. To create a new verb from 1 or 2 existing verbs, you need to use either an adverb (in the case of 1) or a conjunction (in the case of 2).



      Syntactically, adverbs come after a verb, and conjunctions go between them. Thus to "not" a verb f you do f n, and to "and" verbs f and g, you f a g.






      share|improve this answer











      $endgroup$

















        0












        0








        0





        $begingroup$


        J, 67 bytes - 7 = 60



        t=.[
        f=.]
        n=.~
        a=.2 :'u v]'
        o=.2 :'[u v'
        x=.2 :'u~v u'
        i=.2 :'v u['


        Try it online!



        Worth noting:



        Higher order functions work differently in J than in a functional language. To create a new verb from 1 or 2 existing verbs, you need to use either an adverb (in the case of 1) or a conjunction (in the case of 2).



        Syntactically, adverbs come after a verb, and conjunctions go between them. Thus to "not" a verb f you do f n, and to "and" verbs f and g, you f a g.






        share|improve this answer











        $endgroup$




        J, 67 bytes - 7 = 60



        t=.[
        f=.]
        n=.~
        a=.2 :'u v]'
        o=.2 :'[u v'
        x=.2 :'u~v u'
        i=.2 :'v u['


        Try it online!



        Worth noting:



        Higher order functions work differently in J than in a functional language. To create a new verb from 1 or 2 existing verbs, you need to use either an adverb (in the case of 1) or a conjunction (in the case of 2).



        Syntactically, adverbs come after a verb, and conjunctions go between them. Thus to "not" a verb f you do f n, and to "and" verbs f and g, you f a g.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 57 mins ago

























        answered 1 hour ago









        JonahJonah

        4,4472 gold badges12 silver badges22 bronze badges




        4,4472 gold badges12 silver badges22 bronze badges























            Ryan Schaefer is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Ryan Schaefer is a new contributor. Be nice, and check out our Code of Conduct.












            Ryan Schaefer is a new contributor. Be nice, and check out our Code of Conduct.











            Ryan Schaefer is a new contributor. Be nice, and check out our Code of Conduct.














            If this is an answer to a challenge…



            • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


            • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
              Explanations of your answer make it more interesting to read and are very much encouraged.


            • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


            More generally…



            • …Please make sure to answer the question and provide sufficient detail.


            • …Avoid asking for help, clarification or responding to other answers (use comments instead).




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f190325%2fchurch-booleans%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單