This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Person = { | |
firstName: string, | |
lastName: string, | |
age: number | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
print("Hello World!"); | |
var notifier = TestNotifier(); | |
var listener1 = () { | |
print("Inside listener 1"); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Spoj code : COINS | |
(defun memoize (fn) | |
(let ((cache (make-hash-table :test #'equal))) | |
#'(lambda (&rest args) | |
(multiple-value-bind | |
(result exists) | |
(gethash args cache) | |
(if exists | |
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global N 12) | |
(fn place-ok? [a n c] | |
(var ok? true) | |
(var i 1) | |
(while (and ok? (< i n)) | |
(set ok? (not (or (= (. a i) c) | |
(= (- (. a i) i) (- c n)) | |
(= (+ (. a i) i) (+ c n))))) | |
(set i (+ 1 i))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import srfi-18) | |
(import (chicken format)) | |
(import (chicken random)) | |
;; Compute fib(n) | |
(define (fib n) | |
(if (< n 2) n (+ (fib (- n 1)) (fib (- n 2))))) | |
;; Compute and print all fib until n, yield after each fib computation | |
(define (fib-seq n) |