This file contains hidden or 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
| [09:50] == pbalduino [b3a45769@gateway/web/freenode/ip.179.164.87.105] has joined #clj-br | |
| [09:50] <pbalduino> mario-goulart: bom dia | |
| [09:51] <mario-goulart> Alô pbalduino. Bom dia. | |
| [09:56] == andrewhr [[email protected]] has joined #clj-br | |
| [09:56] == andreanastacio [[email protected]] has joined #clj-br | |
| [10:01] <mario-goulart> andreanastacio e andrewhr: vocês são a mesma pessoa? :-) | |
| [10:02] <andreanastacio> hehe nao | |
| [10:02] <andreanastacio> trabalhamos juntos | |
| [10:02] <mario-goulart> ! | |
| [10:02] <mario-goulart> Bacana. :-) |
This file contains hidden or 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
| ;annotation syntax | |
| (import [java.lang.annotation Retention RetentionPolicy Target ElementType] | |
| [javax.xml.ws WebServiceRef WebServiceRefs]) | |
| (definterface Foo (foo [])) | |
| ;annotation on type | |
| (deftype ^{Deprecated true | |
| Retention RetentionPolicy/RUNTIME | |
| javax.annotation.processing.SupportedOptions ["foo" "bar" "baz"] |
This file contains hidden or 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 better-count [lista] ; 1 | |
| (loop [lista lista ; 2 | |
| items 0] ; 3 | |
| (if (empty? lista) ; 4 | |
| items ; 5 | |
| (recur (rest lista) ; 6 | |
| (inc items))))) ; 7 | |
| ;; ---------------------------- | |
| ;; o jeito errado: |
This file contains hidden or 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
| (loop [fs [] | |
| nums (range 2 23)] | |
| (let [f (first nums)] | |
| (if (empty? nums) | |
| fs | |
| (recur (conj fs f) | |
| (filter #(not= 0 (mod % f)) nums))))) |
This file contains hidden or 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
| private void btnCalcular_Click(object sender, EventArgs e) | |
| { | |
| decimal[] notas = new decimal[4]; | |
| notas[0] = txtNota0.Value; | |
| notas[1] = txtNota1.Value; | |
| notas[2] = txtNota2.Value; | |
| notas[3] = txtNota3.Value; | |
| Array.Sort(notas); |
This file contains hidden or 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
| private void btnCalcular_Click(object sender, EventArgs e) | |
| { | |
| decimal[] notas = {txtNota0.Value, txtNota1.Value, txtNota2.Value, txtNota3.Value}; | |
| lblMenor.Text = notas.Min().ToString(); | |
| lblMaior.Text = notas.Max().ToString(); | |
| lblMedia.Text = notas.Average().ToString(); | |
| } |
This file contains hidden or 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
| private void btnCalcular_Click(object sender, EventArgs e) | |
| { | |
| decimal maior = 0; | |
| decimal menor = 99; | |
| if (txtNota0.Value < menor) menor = txtNota0.Value; | |
| if (txtNota1.Value < menor) menor = txtNota1.Value; | |
| if (txtNota2.Value < menor) menor = txtNota2.Value; | |
| if (txtNota3.Value < menor) menor = txtNota3.Value; |
This file contains hidden or 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
| private void btnCalcular_Click(object sender, EventArgs e) | |
| { | |
| // maior | |
| if (txtNota0.Value > txtNota1.Value && txtNota0.Value > txtNota2.Value && txtNota0.Value > txtNota3.Value) | |
| { | |
| lblMaior.Text = txtNota0.Value.ToString(); | |
| } | |
| else if (txtNota1.Value > txtNota0.Value && txtNota1.Value > txtNota2.Value && txtNota1.Value > txtNota3.Value) | |
| { | |
| lblMaior.Text = txtNota1.Value.ToString(); |
This file contains hidden or 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(localStorage["demo.isRunning"] !== "true") { | |
| alert("Let's write something on the local storage"); | |
| localStorage["demo.isRunning"] = true; | |
| localStorage["demo.value"] = "It works!"; | |
| window.location.reload(); | |
| } else { | |
| alert("Value of stored value is '" + localStorage["demo.value"] + "'"); |
This file contains hidden or 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
| ;; criei um arquivo chamado gen.clj | |
| (ns capitulo08.gen | |
| (:gen-class | |
| :name "capitulo08.Uia" | |
| :methods [[hello [] void]])) | |
| (defn -hello [this] | |
| (println "Olá!")) | |
| ;; agora no REPL: |