Just published a minimal example of compiling clojure code into a shared library targeting ios. https://github.com/phronmophobic/mobiletest
It's not super useful on its own, but I'd like to experiment to see how viable it would be to build an iOS app with clojure+native-image
@smith.adriane very cool!
@smith.adriane I wonder if it can be useful to hook up babashka.nrepl (which is a SCI-compatible nrepl server as a library) to this so you can then control your phone from a distance. Not sure if you can just open a server socket like that on an iphone
;; Connected to nREPL server - <nrepl://192.168.0.48:23456>
;; CIDER 1.1.0snapshot (package: 20210104.915)
: Could not resolve symbol: clojure.main/repl-requires user *cider-repl var/tmp:192.168.0.48:23456(clj)*:1:42
nil> (ns foo)
nil
foo>
foo> (+ 1 2)
3
foo> (defn neighbours [[x y]]
(for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])]
[(+ dx x) (+ dy y)]))
#<SciVar@4debf57b:
#object[sci.impl.fns$fun$arity_1__4162 0x75ad55f0 "sci.impl.fns$fun$arity_1__4162@75ad55f0"]>
foo> (defn step [cells]
(set (for [[loc n] (frequencies (mapcat neighbours cells))
:when (or (= n 3) (and (= n 2) (cells loc)))]
loc)))
#<SciVar@413be9d6:
#object[sci.impl.fns$fun$arity_1__4162 0x24fac9c7 "sci.impl.fns$fun$arity_1__4162@24fac9c7"]>
foo> (def board #{[1 0] [1 1] [1 2]})
#<SciVar@bfa3b74: #{[1 0] [1 1] [1 2]}>
foo> (take 5 (iterate step board))
(#{[1 0] [1 1] [1 2]}
#{[1 1] [2 1] [0 1]}
#{[1 0] [1 1] [1 2]}
#{[1 1] [2 1] [0 1]}
#{[1 0] [1 1] [1 2]})
😮 ^^ sci nrepl running on my iPhoneok, all I need to do is use https://developer.apple.com/tutorials/data/documentation/technologies.json?language=objc to generate some interop code
Wow!