About: Functional Programming   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

This is a simple example about using functions as parameters. function reduce(f: function(Number,Number):Number, list: Number[], nilArg: Number):Number { if( list == [] ) then nilArg else f( list[0], reduce(f, list[x|indexof x > 0], nilArg)) } function sum( x: Number, y: Number ): Number { x + y } function product( x: Number, y: Number ): Number {x * y } def list : Number[] = [1,2,3,4]; function p( s: String ) { println( s ); } p("# sum : {reduce(sum,list,0)}"); p("# product : {reduce(product,list,1)}");

AttributesValues
rdfs:label
  • Functional Programming
  • Functional programming
rdfs:comment
  • This is a simple example about using functions as parameters. function reduce(f: function(Number,Number):Number, list: Number[], nilArg: Number):Number { if( list == [] ) then nilArg else f( list[0], reduce(f, list[x|indexof x > 0], nilArg)) } function sum( x: Number, y: Number ): Number { x + y } function product( x: Number, y: Number ): Number {x * y } def list : Number[] = [1,2,3,4]; function p( s: String ) { println( s ); } p("# sum : {reduce(sum,list,0)}"); p("# product : {reduce(product,list,1)}");
  • 2 курса лекций по функциональному программированию * Александр Кубенский * Евгений Кирпичёв Category theory foundations
sameAs
dcterms:subject
dbkwik:encyclopedi...iPageUsesTemplate
dbkwik:nupedia/pro...iPageUsesTemplate
abstract
  • This is a simple example about using functions as parameters. function reduce(f: function(Number,Number):Number, list: Number[], nilArg: Number):Number { if( list == [] ) then nilArg else f( list[0], reduce(f, list[x|indexof x > 0], nilArg)) } function sum( x: Number, y: Number ): Number { x + y } function product( x: Number, y: Number ): Number {x * y } def list : Number[] = [1,2,3,4]; function p( s: String ) { println( s ); } p("# sum : {reduce(sum,list,0)}"); p("# product : {reduce(product,list,1)}");
  • 2 курса лекций по функциональному программированию * Александр Кубенский * Евгений Кирпичёв Category theory foundations
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software