Skip to content

Instantly share code, notes, and snippets.

View gfreivasc's full-sized avatar

Gabriel Freitas Vasconcelos gfreivasc

View GitHub Profile
package com.gabrielfv.sandbox.triangle;
import java.util.Scanner;
public class Triangle {
/**
* Este programa deve "printar" na tela três tipos de triângulos
* cujo tamanho é definido pela entrada do usuário. Os tipos de
* triângulo são:
package com.gabrielfv.sandbox.rpn;
import java.util.Scanner;
import java.util.Stack;
/**
* Calculadora RPN interativa.
*
* RPN = Reverse Polish Notation, ou Notação Polonesa Inversa.
* (https://pt.wikipedia.org/wiki/Nota%C3%A7%C3%A3o_polonesa_inversa)
@gfreivasc
gfreivasc / rpn.c
Last active February 24, 2020 18:13
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/// --- STACK DEFINITION ---
typedef struct node_ {
int value;
struct node_* last;
} stack_node_t;
@gfreivasc
gfreivasc / rpn.clj
Last active February 27, 2020 19:37
(ns rpn
(:require [clojure.edn :as edn]))
(deftype Pair [f s])
(defn push' [top value]
(Pair. top value))
(defn empty'? [stack]
(= stack nil))