The Binary Lambda Calculus (BLC) is a minimal, pure functional programming language invented by John Tromp in 2004 [1] based on a binary encoding of the untyped lambda calculus in De Bruijn index notation.
<?xml version="1.0" encoding="UTF-8"?> | |
<csv-inputs xmlns="http://axelor.com/xml/ns/data-import" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://axelor.com/xml/ns/data-import http://axelor.com/xml/ns/data-import/data-import_5.4.xsd"> | |
<!-- IMPORT DU PACKAGE 'AUTH' --> | |
<input file="auth_permission.csv" separator=";" type="com.axelor.auth.db.Permission" | |
search="self.name = :name"/> |
BEGIN { | |
int visited[node_t]; | |
int visit(node_t n, edge_t e) { | |
if (visited[n] == 0) { | |
visited[n] = 1; | |
for (e = fstin(n); e; e = nxtin(e)) { | |
visit(e.tail, NULL); | |
} |
;;; The Y Combinator explained in scheme. | |
;;; with credits to: | |
;;; https://mvanier.livejournal.com/2897.html | |
;;; Status: WIP | |
(define fibonacci | |
(lambda (n) | |
(cond ((= n 0) 0) | |
((= n 1) 1) | |
(else (+ (fibonacci (- n 1)) (fibonacci (- n 2))))))) |
#lang racket | |
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler | |
;; see https://rain-1.github.io/scheme for more. | |
(require data/queue) | |
;; closure conversion for lambda calculus | |
;; | |
;; the input language is: |
;nyquist plug-in | |
;version 1 | |
;type process | |
;name "Subliminal..." | |
;action "Subliminal..." | |
;control carrier "Carrier" real "Hz" 17500 14000 20000 | |
(setf carrier (max 14000 (min carrier 20000))) | |
;; We have two Nyquist frequencies, carrier/2 and *sound-srate*/2. |
Stephen Toub, Microsoft February 2012 Original
Keeping API calls decoupled from React components keeps your views pure and without side-effects! This makes it easier to test your views without having to worry about API calls. You can test your API separately from your views.
Before I dive any deeper, here are some assumptions: You are using React to render your views (HTML). You are using Redux, or something similar to handle state. Myself, I actually use Preact and Atom instead of React and Redux -- They are both much smaller and their source codes are easy to understand, which I favour. The APIs are basically the same. And, I'm also assuming you rely heavily on Redux/Atom and not on React's setState
method.
If you're coming from MVC, then you know your views should be simple and without complex logic. Instead, you would use the Controller to load remote data and do any normalization. But where is the Controller when using React and Redux? There isn't really a controller, but that