Skip to content

Instantly share code, notes, and snippets.

View celsojr's full-sized avatar
🏠
Working from home

Celso Jr celsojr

🏠
Working from home
View GitHub Profile
/**
* Programa em Java para contar as ocorrências de cada letra em uma frase.
*
* @author Celso Jr
* @version Imperativa
*
*/
import java.io.*;
open System
let (<->) x y = 2 * x + y = 1
let a = [ -1..5 ];; let b = [ -3..8 ];;
let axb = a |> List.collect (fun c -> b |> List.map (fun d -> c,d))
|> List.choose (fun (a,b) ->
match (a,b) with
| x when a <-> b -> Some(a,b)
| _ -> None)
@celsojr
celsojr / Factorial_Functional.fs
Last active November 19, 2023 11:37
F# Tail Recursive Factorial in a functional programming approach
(*--------------------------------------------------------------------------------------------
* Copyright (c) 2017 Celso Junior, [email protected]. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* F# Tail Recursive Factorial in a functional programming approach.
* Also using the CPS technique (Continuation Passing Style).
* Ref.: https://en.wikipedia.org/wiki/Continuation-passing_style
* --------------------------------------------------------------------------------------------*)
[<TailCall>]
let fac1 x =
// F# calculating the factorial in imperative approach programming.
let Fact n =
let mutable x = n
let mutable y = 1
while x > 0 do
y <- y * x
x <- (x - 1)
y
for i in 0 .. 10 do
@celsojr
celsojr / MapaFilaBanco.cs
Last active June 20, 2016 02:05
Exemplo da atividade MAPA com a liguagem csharp
/*
* ////////////////////////// MAPA FILA BANCO C# //////////////////////////////
* Atividade MAPA desenvolvida para ajudar os amigos da faculdade UniCesumar
* Trata-se de uma simples implementação de um atendimento de uma fila de
* banco utilizando os recursos da linguagem c# 6
*
* Copyright(c) 2016 Celso Junior, [email protected]
*
* Licensed under MIT-style license:
*
@celsojr
celsojr / mapa_fila_banco.c
Last active June 17, 2016 08:49
Código criado para ajudar os amigos da faculdade de Engenharia de Software da UniCesumar que estão no outro módulo mais avançado na atividade MAPA. Link para a explicação em vídeo: https://youtu.be/JilpPJsmaOU
/*
* ////////////////////////// MAPA FILA BANCO //////////////////////////////
* Atividade MAPA desenvolvida para ajudar os amigos da faculdade UniCesumar
* Trata-se de uma simples implementação de um atendimento de uma fila
* de banco utilizando os recursos da fila encadeada da linguagem c
*
* Copyright(c) 2016 Celso Junior, [email protected]
*
* Licensed under MIT-style license:
*