Interact with JVM-based plain Clojure from ClojureCLR

2016-02-03 Thread ϖ
Hello all,

I've been using core.logic for some code and I haven't read it's
ported on ClojureCLR. However, I would like to use that code as game
logic and to rely on Unity game engine for the graphical part. That
means I have to use Unity and Clojure together: it can be done through
Arcadia[1]… which uses ClojureCLR. I could get rid of core.logic but I
feel more like trying to let it run on a JVM-based REPL and talk with
the graphical part through its CLR-based REPL.

Then my question is: how to get two REPL talk to each other? More
specifically, the ClojureCLR REPL needs to send commands to the
JVM-based REPL and retrieve results.

I would greatly appreciate any help :-)

Link: [1] https://github.com/arcadia-unity/clojure-clr/tree/unity

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use plain Clojure functions in core.logic?

2016-01-27 Thread ϖ
Well, FYI I've figured out you just need to project the variables you
want. Sorry for double-posting.

However I've got no idea about how optimum this is. So please don't
hesitate if you think about any more clever way to use functions in
core.logic :-)

胡軒

```clojure
(let [depart-state  {:a {:a 1  :c 4} ;; b2 missing
 :b {:a 2 :b 3 :c 6}
 :c 3}
  arrival-state {:a {:a 1 :b 2 :c 4}
 :b {:a 2 :b 3 :c 6}
 :c 3}
  modifier (fn [basic x y value]
 (assoc-in basic [x y] value))]
  (run* [_1 _2 _3]
(membero _1 [:a :b])
(membero _2 [:a :b])
(membero _3 (range 4))
(project [_1 _2 _3]
 (clojure.core.logic/== arrival-state
(modifier depart-state _1 _2 _3)
```

On 27/01/2016, 良ϖ <p.de.bois...@gmail.com> wrote:
> Hi everybody,
>
> I have defined a plain Clojure function which has a specific logic
> inside. It outputs a mutated state given an initial state and some
> other arguments. Basically, we could say it is like: (defn modifier
> [basic x y value] (assoc-in basic [x y] value))
>
> I want core.logic to deal with it in order to find the correct
> parameters for this function to output the result I want. Do I have to
> rewrite it as defne or defnc? methinks it would be a burden (just try
> to express assoc-in in pure logic) >< so I'd like to find another way.
> Maybe I could use the (for ) list comprehension but I feel like
> core.logic has a more clever approach.
>
> I have a gist with minimal working code sample here:
> https://gist.github.com/piotr-yuxuan/fa0cfdc63a26b667c3f3
>
> Will appreciate any help I would be given! :-) Thanks a lot in advance!
>
> 胡雨軒
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use plain Clojure functions in core.logic?

2016-01-26 Thread ϖ
Hi everybody,

I have defined a plain Clojure function which has a specific logic
inside. It outputs a mutated state given an initial state and some
other arguments. Basically, we could say it is like: (defn modifier
[basic x y value] (assoc-in basic [x y] value))

I want core.logic to deal with it in order to find the correct
parameters for this function to output the result I want. Do I have to
rewrite it as defne or defnc? methinks it would be a burden (just try
to express assoc-in in pure logic) >< so I'd like to find another way.
Maybe I could use the (for ) list comprehension but I feel like
core.logic has a more clever approach.

I have a gist with minimal working code sample here:
https://gist.github.com/piotr-yuxuan/fa0cfdc63a26b667c3f3

Will appreciate any help I would be given! :-) Thanks a lot in advance!

胡雨軒

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Parsing Unicode character with Clojure

2015-08-09 Thread ϖ
I've come on some trouble when parsing an Unicode character with
Clojure. I know it's likely to be a problem related to Java and not
Clojure itself but I'm looking for a Clojurish solution so that's why
I'm posting it here. FYI, I have a GNU / Linux OS on the top on which
I use emacs 24 in cunjunction with CIDER 0.10.0snapshot (package:
20150710.1304), Java 1.8.0_51, Clojure 1.6.0 and nREPL 0.2.6.

The first character of the Unicode block CJK Unified Ideographs
Extension B is  (hope you can properly read it, get a Chinese font
otherwise). Emacs perfectly deals with it but in gedit, it's like this
character would have the glyph you see (something like ㄛ but more
angular) plus a negative space. In emacs it's displayed properly but
when it comes to be evaluated, the behaviour is weird:

``` Clojure
華文.core (clojure.string/split aa #\)
; = [a a]
華文.core (clojure.string/split aa #\u2)
[aa]
華文.core (clojure.string/split aa #[\u2-\u2a6df]) ; it spans
over Extension B
; = [ ]
```

Moreover:

``` Clojure
華文.core \u2
; = IllegalArgumentException Invalid unicode character: \u2
clojure.lang.LispReader.readUnicodeChar
華文.core (int \)
; = RuntimeException Unsupported character: \
clojure.lang.Util.runtimeException (Util.java:221)
華文.core (format %04x (int \u3403))
; = 3403
華文.core (format %04x (int \u2))
; = IllegalArgumentException Invalid unicode character: \u2
clojure.lang.LispReader.readUnicodeChar
```

Finally here is a very annoying side-effect, just like an overflow:
from 2 it overlaps values from 0, so the whole legacy ASCII would
be contained is this block.

``` Clojure
華文.core (clojure.string/split cabac #[\u2-\u2a6df])
; = []
華文.core (clojure.string/split cabac #[a-b])
; = []
```

Then I don't really know how I could handle this character. I've
picked haphazardly some characters and it seems to be the same mess
above \u :/

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core logic

2013-06-19 Thread ϖ
Hello Josh, I would be glad you share your code :)

Piotr


2013/6/18 David Nolen dnolen.li...@gmail.com

 This is a variant of the Zebra/Einstein Puzzle. You can probably Google
 for miniKanren core.logic zebra and find a solution if you get stuck ;)

 David


 On Tue, Jun 18, 2013 at 7:57 AM, Josh Kamau joshnet2...@gmail.com wrote:

 Hi ;

 I am trying to learn clojure core.logic. I have gone through some
 documentation on github by David Nolen.  I am now trying to solve this
 problem:  Anyone willing to do some practice can try and share the
 solution.

  *SOLVE THIS PROBLEM.*

 *The Diplomats at Muthaiga Estate*

 The facts essential to solving the problem - which can indeed be solved
 by combining deduction, analysis, and sheer persistence - are as follows.
 Givens

1.

There are five houses, each of a different colour and inhabited by
people of different nationalities, with different pets, drinks, and
pastimes.
2.

The English live in the Red house.
3.

The Spaniards own the Dog.
4.

Coffee is drunk in the Green house.
5.

The Ukrainians drink Tea.
6.

The Green house is immediately to the right (your right) of the Ivory
house.
7.

The Chess players own Snails.
8.

Scrabble is played in the Yellow house.
9.

Milk is drunk in the Middle house.
10.

The Norwegians live in the First house on the Left.
11.

People who play Cribbage live in the house next to the people who own
a pet Fox.
12.

Scrabble is played in the house next to the house where the Horse is
kept.
13.

The Bridge players drink Orange Juice.
14.

The Japanese play Monopoly.
15.

The Norwegians live next to the Blue house.





  *ANSWER THE FOLLOWING QUESTIONS*.

 Who drinks water? And who owns the Zebra?

 1. The WATER drinkers are:

1.

*English http://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
2.

*Spaniardshttp://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
3.

*Norwegianshttp://www.brocku.ca/sdc/leadership/water_answer_page_1.php
*
4.

*Japanesehttp://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
5.

I Give UP!! *Tell Me Who Drinks The 
 Waterhttp://www.brocku.ca/sdc/leadership/water_answer_page_1.php
*

  2. Who owns the Zebra?

1.

*English http://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
2.

*Spaniardshttp://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
3.

*Norwegianshttp://www.brocku.ca/sdc/leadership/water_answer_page_1.php
*
4.

*Japanesehttp://www.brocku.ca/sdc/leadership/water_answer_page_2.php
*
5.

I Give UP!!! *Tell Me Who Drinks The Water And Who Owns The 
 Zebrahttp://www.brocku.ca/sdc/leadership/both_answers.php
*

  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.