off-topic

https://github.com/clojurians/community-development/blob/master/Code-of-Conduct.md Clojurians Slack Community Code of Conduct. Searchable message archives are at https://clojurians-log.clojureverse.org/
Felipe Reigosa 2021-01-11T12:55:19.097700Z

Hey guys, I should have shared this here a long time ago. I'm building a visual programming language/game entirely in clojure, what do you think? https://mockmechanics.com/ Using it I built a working piano, a combination lock, a bubble sort machine, even tetris, all without any code, you can see these machines and more on my YouTube channel. Here's the latest thing I was able to build inside it without using any code, a punched cards programmable 3d printer. Follow me on twitter if you want to keep up with what I'm doing next https://twitter.com/MockMechanics

👍 3
3
❤️ 4
Stefan 2021-01-11T13:07:48.098100Z

That looks quite interesting! FYI: I tried launching it using run.sh and both java11 and java14 and I immediately got:

2021-01-11 14:05:48.884 java[20675:254676] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1677.201/Foundation/Misc.subproj/NSUndoManager.m:363
2021-01-11 14:05:48.886 java[20675:254676] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2fe1db57 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff68ca95bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2fe46d08 +[NSException raise:format:arguments:] + 88
	3   Foundation                          0x00007fff32538ead -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   Foundation                          0x00007fff324755fe +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 440
	5   AppKit                              0x00007fff2d00265c -[NSApplication run] + 864
	6   libglfw.dylib                       0x000000010b6f2a85 libglfw.dylib + 68229
	7   libglfw.dylib                       0x000000010b6ec416 libglfw.dylib + 42006
	8   ???                                 0x0000000114071330 0x0 + 4630975280
	9   ???                                 0x000000011406b6d0 0x0 + 4630951632
)
libc++abi.dylib: terminating with uncaught exception of type NSException
./run.sh: line 3: 20675 Abort trap: 6           java -jar --illegal-access=deny program.jar

Felipe Reigosa 2021-01-11T13:15:45.098300Z

Thanks! Yeah, I know about that, macOs doesn't like me calling opengl stuff outside the main thread, I'll fix it soon, just didn't have the time yet.

👍 1
Idan Melamed 2021-01-11T13:44:34.098900Z

Looks amazing!

Felipe Reigosa 2021-01-11T13:47:28.099200Z

Thanks Idan, it's still early days, not sure where I'm going with this, maybe a minecraft like game, we'll see.

telekid 2021-01-11T19:40:37.103700Z

Does anyone know of any tools that allow you to enumerate the ordering states created by a set of asynchronous processes and some causality statements? e.g.

a causes b
a causes c
b causes d
c caused d

results in

a -> b -> c -> d -> d
a -> c -> b -> d -> d
...

telekid 2021-01-11T19:40:51.103900Z

I’m not even sure where to begin looking

telekid 2021-01-11T19:42:11.104700Z

my goal is to help me ensure I’m accounting for all ordering possibilities when thinking through changes to a distributed system

borkdude 2021-01-11T19:45:00.105300Z

@him This might just be a topological sort? This library can calculate it for you: https://github.com/stuartsierra/dependency

clyfe 2021-01-11T19:46:09.105700Z

end state, start state, state transitions sounds like a finite state machine (FSM) to me there are a number of FSM tools in clj that do various things; google "clojure fsm"

👍 1
clyfe 2021-01-11T19:47:02.106Z

although for your problem you could use graph algos

clyfe 2021-01-11T19:49:58.107Z

weary of state explosion, with nodes greater than 5 .. depending on edges

2021-01-11T19:50:57.107800Z

topological sorting is 1. Great 2. Not complicated enough to pull in a library for https://gist.github.com/hiredman/71b71e4e07e7666fe1b9def9a476c765#file-lrun-clj-L1-L10 and https://gist.github.com/hiredman/075b45eaeb01e4b526ce6f8854685487#file-ur-component-clj-L1-L10 both include the same topo function at the top which does the sorting

2021-01-11T19:52:19.108700Z

I guess "requires a DAG" should go on the list somewhere

2021-01-11T19:53:23.109500Z

I bet with some tinkering you could tweak that function to instead of returning a single ordering, return a set of all the possible orderings

telekid 2021-01-11T19:53:57.110100Z

> I bet with some tinkering you could tweak that function to instead of returning a single ordering, return a set of all the possible orderings Yeah was just gonna say, toposort misses on that requirement. But good idea, I’ll run with that.

telekid 2021-01-11T19:54:42.110500Z

I feel like I want 1% of the Bloom programming language 🙃

2021-01-11T19:56:51.111Z

depending on what you are doing https://github.com/jepsen-io/elle or https://github.com/jepsen-io/knossos might be of interest

👍 1
telekid 2021-01-11T19:58:29.111300Z

totally – I’m actually translating a sequence diagram into an FSM and want to make sure that the FSM correctly accounts for all possible event orderings implied by the diagram

phronmophobic 2021-01-11T20:14:57.112300Z

it seems like jepson should have some way to do that https://github.com/jepsen-io/jepsen

phronmophobic 2021-01-11T20:15:34.113Z

i just see someone else already suggested it

2021-01-11T20:37:12.113900Z

I don't know a library that already does this (maybe one of the ones suggested already does), but in terms of graph theory terminology you are asking to enumerate all possible topological sorted orders of an input graph.

2021-01-11T20:38:08.115Z

Finding one such topological sorted order is easy to do in linear time. Enumerating all possible ones can probably be done in linear time in the length of the output, but for N nodes the number of such topological orders can be as large as N! (for 0 edges/constraints).

telekid 2021-01-11T21:02:44.116300Z

Thanks @andy.fingerhut, I hadn’t considered that. Fortunately for me, N is small (~5), but still big enough (given N!) that mentally tracking possibilities is impossible.

telekid 2021-01-11T21:03:18.117Z

I guess this is one reason why designing correct distributed systems is hard…

2021-01-11T21:04:31.118Z

For N small enough, a perfectly quick hack approach is to generate all N! permutations, and remove any that violate one of the causality constraints.

telekid 2021-01-11T21:04:53.118200Z

oh that’s clever!

clyfe 2021-01-11T22:42:27.119300Z

My fist core logic program cc @him

(use 'clojure.core.logic)

(defne arco [x y]
  ([:a :b])
  ([:a :c])
  ([:c :d])
  ([:b :e])
  ([:c :e])
  ([:d :e]))

(defn patho [l]
  (conde
   [(== l [:e])]
   [(fresh [d x y]
      (firsto l x)
      (resto l d)
      (firsto d y)
      (arco x y)
      (patho d))]))

(run* [q]
  (firsto q :a)
  (patho q))
;; => ((:a :b :e) (:a :c :e) (:a :c :d :e))

🧠 1
telekid 2021-01-11T22:43:14.119600Z

whooaaaa! nice!