This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-18
Channels
- # admin-announcements (1)
- # beginners (4)
- # boot (18)
- # cider (4)
- # cljsrn (17)
- # clojure (77)
- # clojure-austin (6)
- # clojure-greece (6)
- # clojure-spec (81)
- # clojure-uk (6)
- # clojurescript (32)
- # code-art (2)
- # core-async (12)
- # cursive (1)
- # datomic (1)
- # emacs (15)
- # funcool (1)
- # hoplon (108)
- # om (9)
- # onyx (83)
- # planck (1)
- # re-frame (3)
- # reagent (4)
- # specter (6)
- # spirituality-ethics (4)
- # yada (9)
After programming in clojure for a while I'm starting to get the feeling taht I should only use macros as a last resort
what do we mean by special forms? ->>
? and yeah I'd say macros generally should be a last resort or used with a specific intention in mind
but your question was is there any use case for macros that are impossible to do with functions. now you're saying but not special forms, and defining special forms as anything that can't be done with functions. bit circular?
you could also write (if (isThisTrue) (fn [_] (this)) (fn [_] (orThat))
if you don't care about overhead or boilerplate
i can't remember the name of the paper, but early in Lisp's history it was showed that a set of special forms exists that together form a turing complete system
sure, iirc all you need is the lambda special form. y combinator or something like that
I don't think anything can do things turing machines can't do? isn't that what turing completeness means?
but basically, turing machines can't tell you whether a process will finish before it finishes
it may be possible to compute the prime factorization of a large number with two large factors
An influential mathematician of the early 20th century, David Hilbert, published his famous list of 23 problems in mathematics. The problems were unsolved at that time and were the kinds of problems whose solutions would lead to the advancement of mathematics. Later he posed another challenge which is famously known as Entscheidungsproblem (Decision problem). These problems of Hilbert had promoted vigorous investigation into the theory of computability. The two computing models that came out of that time were Alonzo Church’s Lambda Calculus and Alan Turing’s Turing Machine. Hilbert’s Decision problem asks if is it possible to devise an algorithm to solve any problem. Alan Turing answered NO to the problem. Of course, saying no is not enough. You have to prove it. Turing created an abstract computation model called Turing Machine as part of his proof.
but most of the security on the internet relies on the fact that actually computing it is too intensive to do practically
its possible to design a program using only turing complete semantics that takes another program as input and does useful things with it
but if you try to do anything involved, you will have to simulate a turing machine within a turing machine
turing machines can compute anything that is computable, but that doesn't mean they are practical for every computable problem
for instance, turing machines were based on tape memory and sequential access, but we use random access memory
so what i'm saying is that macros may or may not cover a use case in which the turing model of computation is theoretically sufficient but in practice is not pragmatic
@bcbradley: Tangential but back when I was on the ANSI C++ Standards, one of the German reps posited that templates were Turing Complete at compile time, i.e., you could write a program using templates that didn't actually compile but would compute any result and display it somehow in the compilation error messages. He showed some pretty impressive computation examples -- none of which compiled but all produced the results as part of their error messages. Be careful what you wish for!
I have a leiningen project with a file in the resources
folder and would like to access a file inside it. My code works well in development mode, but not in the uberjar. I spent a couple hours scouring the Internet and am giving up now.
I realise that directly accessing it with a relative path doesn’t work, because the path changes when the uberjar gets generated. Instead
should be used. However in the uberjar this returns an URI, not a path.
My current code looks like this, could someone please point me to a resource to get this to work(yeah, great pun^^):
(io/as-file (.getPath (io/resource "img/logo.png")))
I could slurp
the path returned, however, the framework I’m using wants to have a File.
Btw, the file actually is bundled in the jar, I checked^^You cannot create a java.io.File that points to a file inside the uberjar
you will need to either not use java.io.File or copy the file from the uberjar to a temp folder
@danlebrero: The latter was my only solution. Now I know that it’s the right one. Thank you very much, the help and peace of mind is much appreciated!
@munen my pleasure
how do I construct data literal #uuid "4cb5fd0b-c362-4785-bdbc-4c8707f52dea" programatically given a string
tagged-literal
You can use tagged-literal to create a TaggedLiteral instance
But uuids are just java.util.UUID instances with a special print form
So you could also just make one of those
Why did tagged-literal not work ?
I don't know, when I pretty print the result it looks good, but it's not composing with om.next/from-history, perhaps there's something else going on
(defn from-history [uuid]
(pprint (tagged-literal 'uuid uuid))
(om.next/from-history
(:reconciler @admin.core/app)
(tagged-literal 'uuid uuid)))
outputs on the REPL
#uuid "4cb5fd0b-c362-4785-bdbc-4c8707f52dea"
null
of course
(om.next/from-history (:reconciler @admin.core/app) #uuid "4cb5fd0b-c362-4785-bdbc-4c8707f52dea")
works a expected though (doesn't return NULL)(defn from-history [uuid-str]
(om.next/from-history
(:reconciler @admin.core/app)
(uuid uuid-str)))
Hello to everyone, when calling (sh "ping" "-t 5" "http://google.com”) I get result after 5 second (I'm on mac, so -t is timeout), is there a way to get results line by line as they come in like in real shell?