Skip to content

Instantly share code, notes, and snippets.

View oscarcpozas's full-sized avatar
🦕
Esta bailongo

Oscar Caballero oscarcpozas

🦕
Esta bailongo
View GitHub Profile
@oscarcpozas
oscarcpozas / Cons.rs
Last active February 8, 2023 16:48
Linked list heap-allocated inspired on LISP lang
pub struct Cons<T> {
pub value: T,
pub next: Option<Box<Cons<T>>>,
pub index: usize,
}
impl <T> Cons<T> {
pub fn new(value: T) -> Cons<T> {
Cons { value, next: None, index: 0, }
}
@oscarcpozas
oscarcpozas / go-shebang-story.md
Created December 13, 2020 20:32 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

class MyStatelesWidgetExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Logic here!
}
}
@oscarcpozas
oscarcpozas / Factorial.java
Created January 16, 2017 17:45
Resuelto 02
import java.io.*;
public class Factorial {
public static void main(String[] args) throws IOException {
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
int num;
int factorial = 1;