Skip to content

Instantly share code, notes, and snippets.

View network_delay.py
class Solution:
def networkDelayTime(self, edges, N, K):
"""
:type times: List[List[int]]
:type N: int
:type K: int
:rtype: int
"""
edges.sort(key=lambda e: e[2])
# print(edges)
View the-basics.md

the basics

Here is an intro to the basics in leema. The format will show some code, then explain the concepts used in that code. See what you think!

making a palindrome

This is a function that takes a string and returns it as a palindrome.

View setup.md

setup

The setup for leema is still pretty manual, but is only 3 steps.

dependencies

  • C/C++ standard libraries
  • flex
  • nosetests (optional until you want to run tests)
View foo.diff
diff --git a/T/prefab.lma b/T/prefab.lma
index ad970e2..efb8d8f 100644
--- a/T/prefab.lma
+++ b/T/prefab.lma
@@ -18,28 +18,28 @@ macro fail(ft, msg) ->
macro refail(f) ->
return f
--
View leema-at-rc.md

Leema at Recurse Center

the past six weeks

I've spent the past six weeks working on Leema full time at a place called Recurse Center. It's been a great opportunity and I've made a lot of progress.

the next six weeks

@mdg
mdg / curry_syntax.md
Last active Sep 20, 2018
rough draft of a blog post to go on leema.org
View curry_syntax.md

currying vs. default parameters

I didn't set out to implement currying. I was trying to implement closures but it seemed like it would be easier to implement closures if I added currying first.

But I didn't set out to implement closures either. I originally wanted to implement asynchronous expressions and futures but they too seemed easier to implement if I already had closures.

View fn_parens.ex
use Dogma.RuleBuilder
defrule Dogma.Rule.FnParens, [] do
@moduledoc """
A rule that enforces using parens in a fn that takes parens
"""
@fn_pattern ~r/fn(\s*)(\(|->)?/
def test(rule, script) do
script.processed_lines
View american-words.txt
color
flavor
humor
labor
center
fiber
liter
theater
analyze
defense
View american-words.txt
color
flavor
humor
labor
center
fiber
liter
theater
analyse
defense
View -
docker0 Link encap:Ethernet HWaddr 02:42:46:54:e0:ff
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
enp0s31f6 Link encap:Ethernet HWaddr 54:ee:75:9a:dd:8e
UP BROADCAST MULTICAST MTU:1500 Metric:1