Skip to content

Instantly share code, notes, and snippets.

View jeremyheiler's full-sized avatar

Jeremy Heiler jeremyheiler

View GitHub Profile
USING: kernel math math.functions sequences ;
IN: euler1
: euler1 ( x -- y )
iota [ dup [ 3 divisor? ] [ 5 divisor? ] bi or [ drop 0 ] unless ] map-sum ;
IN: scratchpad 1 0 >
--- Data stack:
t
IN: scratchpad [ "true" ] [ "false" ] if
--- Data stack:
"true"
IN: scratchpad
As found in "Thinking Forth": http://thinking-forth.sourceforge.net/
"Simplicity is the primary measurement recommended for evaluating
alternative designs relative to reduced debugging and modification
time. Simplicity can be enhanced by dividing the system into sepa-
rate pieces in such a way that pieces can be considered, implemented,
fixed and changed with minimal consideration or effect on the other
pieces of the system."
W. P. Stevens,
: fib ( a b -- x y ) [ + ] keep swap ;
! My goal was to implement this with produce.
1 1
[ dup 4000000 < ] [ fib dup ] produce
2nip ! Remove the workspace
dup length 1 - swap remove-nth ! Remove the extra value
[ dup odd? [ drop 0 ] when ]
map-sum
StackOverflowError
java.util.regex.Pattern$GroupHead.match (Pattern.java:4556)
java.util.regex.Pattern$Loop.match (Pattern.java:4683)
java.util.regex.Pattern$GroupTail.match (Pattern.java:4615)
java.util.regex.Pattern$GroupTail.match (Pattern.java:4615)
java.util.regex.Pattern$BranchConn.match (Pattern.java:4466)
java.util.regex.Pattern$CharProperty.match (Pattern.java:3694)
java.util.regex.Pattern$Branch.match (Pattern.java:4502)
java.util.regex.Pattern$GroupHead.match (Pattern.java:4556)
java.util.regex.Pattern$Neg.match (Pattern.java:4997)
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int main(int argc, char** argv)
{
puts("JL 0.0.1");
puts("Press C-c to exit\n");
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
int
main(int argc, char** argv)
{
puts("JL 0.0.1");
import clojure.java.api.Clojure;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class NreplContextListener implements ServletContextListener {
private Object server;
public NreplContextListener() {
Clojure.var("clojure.core", "require").invoke(Clojure.read("clojure.tools.nrepl.server"));
mvn archetype:generate -DgroupId=io.github.jeremyheiler -DartifactId=irc -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
user> (def m {:a {:b 2 :c 3} :b {:d 4 :e 5} :c {:f 6}})
#'user/m
user> (reduce (fn [m k] (update-in m [k] (comp vec keys))) m (keys m))
{:c [:f], :b [:e :d], :a [:c :b]}