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
(ns autores.core | |
(:require [clojure.pprint :as pp] | |
[net.cgrand.enlive-html :as en] | |
[clojure.string :as str]) | |
(:import [java.net URL])) | |
(defn- get-links [url] | |
(let [links (-> url | |
URL. | |
en/html-resource |
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
(ns grokpodcast.core | |
(:require [clojure.java.io :as io] | |
[clojure.pprint :as pp] | |
[clojure.string :as str] | |
[net.cgrand.enlive-html :as en]) | |
(:import [java.net URL])) | |
(def file-dir "~/Music/grokpodcast/") | |
(defn- get-archive [url] |
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
; If we list all the natural numbers below 10 that are multiples of 3 or 5, | |
; we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
; Find the sum of all the multiples of 3 or 5 below 1000. | |
(reduce + (filter #(or (= 0 (mod % 3)) | |
(= 0 (mod % 5))) | |
(range 1000))) |
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
#lang racket | |
; If we list all the natural numbers below 10 that are multiples of 3 or 5, | |
; we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
; Find the sum of all the multiples of 3 or 5 below 1000. | |
(foldl + 0 (filter (lambda (num) | |
(or (= 0 (remainder num 3)) | |
(= 0 (remainder num 5)))) |
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
class Cachorro | |
def nome(n) | |
@nome = n | |
end | |
def self.especie(n) | |
@@especie = n | |
end | |
def status |
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
(defmacro %w [& coll] | |
`(map str (quote ~coll))) | |
(%w 1 2 3 4) | |
; ("1" "2" "3" "4") | |
(%w a b c d) | |
; ("a" "b" "c" "d") | |
(%w + - * /) |
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
(ns capitulo03.core) | |
(defn ola-mundo [] (println "Olá mundo!")) | |
; public final class capitulo03.core$ola_mundo extends clojure.lang.AFunction { | |
; public static final clojure.lang.Var const__0; | |
; | |
; public static {}; | |
; Code: | |
; 0: ldc #11 // String clojure.core |
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
function memoize(fun) { | |
var mem = {}; | |
return function() { | |
var args = arguments.toString(); | |
if(mem[args] == undefined) { | |
mem[args] = fun.apply(this, arguments); | |
} | |
return mem[args]; | |
} | |
} |
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
......... ... | |
mov %edx,%edi | |
jmp 0x40143b <__mingw_CRTStartup+699> | |
mov %edx,%ebx | |
jmp 0x40128b <__mingw_CRTStartup+267> | |
mov %edx,%eax | |
nop | |
jmp 0x40134b <__mingw_CRTStartup+459> | |
mov %edx,%ebx | |
jmp 0x4014dc <__mingw_CRTStartup+860> |
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
(defn fatorial [n] | |
{:pre [(> n 0)]} | |
(if (< n 2) 1 | |
(* n (fatorial (dec n))))) | |
(fatorial 3) | |
; 6 | |
(fatorial -2) | |
; AssertionError Assert failed: (> n 0) |
OlderNewer