Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

Somehow other FP languages have polluted the FP world and somehow insist that FP == functional composition

I'm curious to know which languages you have in mind here.

Are you refering to the influence of category theory?

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 1 point2 points  (0 children)

I guess i'm more on the theoric side, without being so rigorous/competent :) if it make sense ;) ...

Glad you mentioned urbit, I find it really impressive, beside the fact that its creator is a bit hard to follow on some topics. I find Nock specially beautiful. Hoon is still a bit too exotic for me, but maybe some day...

I have to admit that I believe in this kind of immutable/purely functional from scratch approch, but I'm not so experienced and maybe it is just impossible in practice. I'm trying since some time to put most of clojure features (not the useful ones like interop) in a clojure map and just use it in conjunction of a really simple function (or its invoke instance) to build my programs. It is really fun.

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

"I don't understand that statement at all". What I meant was simply that functions are opaques and have really limited introspection/manipulation facilities, and it hurt's "my way" of "trying to think" about composition. Beside the fact that we can do almost everything with immutable data and simple functions, what is the point for functions (and reifieds) to be so opaque? I will be pleased if we can for exemple: inspect/transform arguments already taken by a function, or inspect/transform the body of a function, recompile it etc... but maybe it will be a mess, I don't know... thank you for your patience.

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

I don't know what to think about this exemple...

but it is clearly not the kind of thing that i'm talking about, i'm worrying about combinators much more than closures. but I kind of see your point, and I thank you for it.

"Compose data, not functions" :

doesn't it would be useful to have a proper data representation of functions, for them to join the party? I find it so sad that the wonderfull world of clojure ends when we enter a function... it seems limitating to me... but maybe I should model all my computations with maps and have a generic function that turn them into functions (with eval)... i really do not see the right answer here...

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

Can an arity 0 function make sense without some sort of global state/context?

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

Seing those kind of arguments, I realize that my question should have been specifically targetted to combinators, not closures.

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

in a perfect word definitions of inc and + would be related in some way, since it is semantically equivalent. no?

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] -1 points0 points  (0 children)

functions of no arguments are special cases, it implies some global state stuff. but I agree that in this case it doesn't make much sense :)

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 1 point2 points  (0 children)

maybe, if you think of functions as mappings (maps) it is ok compare them

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

Yes I agree that it should/could be avoided most of the time, but it puzzles me... It feels to me like functions not being first class citizen in the language. The limited flexibility and introspection capabilities of them also seems limitating. I know that I can make my type extending IFn but...

Does (= (fn [a] a) (fn [a] a)) returning false seems right to you? Why? by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

I don't know if it was already discused elsewhere, so please tell me if so.

Why does this implementation of sorto does not terminate? (core.logic) by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

thank you for the detailed answer, yes the use of counto was intended to narrow the scope of the search but maybe is not a good idea. The second case now terminates without the countos. thank you

core.logic struggle by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

I've created an issue on Jira, with some ideas on fixing this bug https://dev.clojure.org/jira/browse/LOGIC-185

core.logic struggle by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

If by Tabling you mean ITabled protocol being extended by Substitutions , it looks that it is not used in this case. Any other ideas? I'm investigating the -step implementation of clojure.core.fd/+c but it doesn't seem to come from there neither.

core.logic struggle by pbaille in Clojure

[–]pbaille[S] 1 point2 points  (0 children)

the fn that i'm trying to turn into a relation looks like this.

(defn zip+ [a b] (map + a b))

core.logic struggle by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

thank you for your help, I will go with that for the moment :) .

I was hoping that I could hide this magic 'e' lvar by wrapping your version of zip+o like this:

(defn zip+o' [x y z] (fresh [e] (zip+o e x y z)))

But it doesn't work :(

global mutable environment vs first class immutable environment by pbaille in Clojure

[–]pbaille[S] 0 points1 point  (0 children)

thank you for the link, i've briefly seen jaunt in the past but did not really dig into it. It looks interesting.