[Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?

2012-02-29 Thread Kristian Lein-Mathisen
Hi guys!

Reading the chicken docs on foreign, you'll find:

Structs cannot be directly passed as arguments to foreign functions, nor
 can they be result values. (
 http://api.call-cc.org/doc/foreign/types#def:struct)


Pointers to structs are supported, but not structs-by-value. I am wondering
if there are technical reason why this is the case, or if it's simply a
missing feature. If it simply hasn't been implemented, I will see if I
can make this feature.


Thank you,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?

2012-02-29 Thread Kristian Lein-Mathisen
Thanks to both of you for some valuable insight! I didn't realize
de-referencing on the c-side would be that simple, nor that
structs-by-value would actually be pointers anyway.

However, my problem is still not entirely solved. I am trying to interface
to the physics engines Box2D and Chipmunk, which are quite big. They both
use struct-by-value extensively. Small structs like

struct b2Vec2 {float x,y};


are passed around virtually everywhere.

When I use `chicken-bind` on my stripped-down version of Box2D.h, it
generates foreign-lambda's that return struct-by-value without complaint.
When I compile, it fails like the docs say:

Error: illegal foreign return type `b2Vec2'


Since struct-by-value is so central in both of these libraries, manually
writing wrapper-code would take too long. I am unsure of where to go from
here, but I suppose my options are:

- Modify `foreign` to support struct-by-value
- Modify `chicken-bind` to automatically write wrapper-code for
struct-by-value
- Write a script that re-parses the generated scheme-binding and inserts
the wrappers

Any thoughts on how to pursue this?
Thanks!
K.

On Wed, Feb 29, 2012 at 3:26 PM, Alaric Snell-Pym
ala...@snell-pym.org.ukwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 02/29/2012 01:29 PM, Thomas Chust wrote:

  Last but not least, passing structures as pointers makes memory
  management for them explicit and that is a good thing in this case
  because there is simply no way the FFI could automatically figure out
  how the optimal memory management strategy for structures passed by
  value should look like. For example, whether such a structure can be
  allocated as an atomic block of memory or not is impossible to answer
  without knowing what the functions producing and consuming instances of
  the structure actually do.

 I slightly disagree here. A structure passed or returned by value is
 just shoved on the stack, maybe in registers if it's a small structure.
 There's no extra memory management required; merely some extra copying
 to copy from the Chicken-side foreign-type pointer into the appropriate
 bit of stack or registers, or back again for returned values.

 But, indeed, it's easy to do that in C as your distim demonstration
 shows; return values are only slightly harder as you'll need to allocate
 a struct and copy the result in, then return that pointer.

 ABS

 - --
 Alaric Snell-Pym
 http://www.snell-pym.org.uk/alaric/
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAk9ONY8ACgkQRgz/WHNxCGpVFQCdFmrrkp6RhMkQQNIaRtElcQUw
 At8An3tuScsj6vKNCi/CQDVVTeRR1ZHE
 =foQX
 -END PGP SIGNATURE-

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] foreign: Why is passing structs as arguments and return-types not supported?

2012-03-04 Thread Kristian Lein-Mathisen
Hi guys,

I'd like to give a short status-update on the issue. Based on the feedback
on this thread and #chicken, the original plan was to patch up chicken-core
to support struct-by-val argument- and return-type passing.

This turned out to be very complex indeed. It's unclear of how to represent
these structs on the scheme-side. The easiest solution would be to
represent the struct with a blob. One problem here though is that it can't
be used on the scheme-side itself. This would give the struct-by-value
feature questionable usefulness.

On the other hand, the ideal struct representation on the scheme-side
should be some sort of record with slots corresponding to the struct
fields. That in turn requires giving the struct definition to chicken,
where the blob would otherwise only need the size. This involves complexity
levels I cannot pinpoint, but it's probably the reason this feature isn't
there in the first place!

I am therefore going to give plan B an attempt: modify chicken-bind instead
of chicken-core, and let it generate foreign struct-by-value wrappers.

Wish me luck fellas, and thanks for everyone's support on #chicken!
K.

On Wed, Feb 29, 2012 at 5:44 PM, Moritz Heidkamp mor...@twoticketsplease.de
 wrote:

 Kristian Lein-Mathisen kristianl...@gmail.com writes:

  Any thoughts on how to pursue this?

 Another option would be to create a module which re-exports all
 `foreign' syntax wrapped with support for structs-by-value. Then just
 import your wrapper module instead of `foreign' in the code generated by
 `chicken-bind'.

 Moritz

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Making stack-allocated Chicken-managed objects from C

2012-03-06 Thread Kristian Lein-Mathisen
Hi guys!

I would like to get a deeper understanding of Chicken's GC and its
stack-allocation feature. I've numbered by questions, feel free to answer
just one or two of them!

I have been poking into the chicken-bind egg and I'd like to modify it
slightly for my libraries' (Box2D, Chipmunk) heavy use of structs.

Chicken-bind will generate helper utils for making C-structs inside
Chicken. Please take a peek at

http://paste.call-cc.org/paste?id=d8e38d5afb7daff73c5957e91dff21c6ee02d415

My C-snipped in foreign-primitive that's doing the stack-allocation is
heavily inspired by
http://wiki.call-cc.org/allocating-c-structures-under-control-of-the-chicken-gc.
However, I've been getting feedback about this approach about it not being
completely safe because it can't guarantee the stack won't overflow. From
what I can make out of the docs, foreign-primitive automatically does a
minor GC and we should be safe.

1. Is this method completely safe? If not, why is that the case? If not,
how can you create blobs on the stack from C safely?

2. So let's say that we drop C_alloc for being unsafe. Could C_alloc be
replaced with C_malloc and at least we'd get the struct/blob automatically
garbage-collected by Chicken? Or are scheme-objects reserved for
stack-allocated pointers?

3. When C-code returns a new scheme-object, does Chicken treat it like any
other scheme-object created from within Chicken? (Along with GC and all the
rest of it)

4. And just for clarity, is there any difference between

C_bytes *ab = C_alloc( .. size ..) ; vs.
C_bytes ab [ .. size ... ];  ?

5. And finally, how fast is stack-allocation/C_alloc compared to
heap-allocation/C_malloc? (I'm interested in very small structs here!)



And for reference, an easier approach probably goes something like this,
where the blob is created in Chicken-land:

(*define* %make-point (foreign-primitive void
 (((c-pointer (struct point)) dest) (float x) (float y))
#ENDdest-x = x;dest-y = y;C_return();END))

(define (make-point x y)
(let ((loc (location (make-blob %get struct-size somehow%
   (%make-point loc x y)
loc))


This is what I'm looking for, but I'd love to see make-blob lowered into C
so that there is less overhead in creating structs (I'm a performance
junkie).  I've looked at runtime.c's C_allocate_vector and I must admit
don't understand much!

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] chicken-bind: working with structs

2012-05-24 Thread Kristian Lein-Mathisen
Hi guys!

I've been looking at chicken-bind's way of working with C-structs for a
while now, and I'm in the works of something I think will be useful. I want
to have chicken-bind generate code for struct-by-values. Thanks to all who
helped me out in this tricky process!

*Allocating memory for new structs*
Chicken-bind needs to allocate structs:
1. In its make-struct construct
2. When a function returns a struct by value
3. When a struct has a struct field (aka nested structs, effectively a
struct-by-value return type)

I have decided to use make-blob to allocate memory in all cases because
it's easy and seems to have very good performance. I haven't looked at the
code, but I believe make-blob allocates on the stack whenever it can.

I have made a new version of chicken-bind's make-struct which now uses
make-blob, replacing the old C_malloc. Please take a peek at
https://github.com/kristianlm/chicken-bind/commit/f7dde10bdb40aa00ae776f23570aa1001ddde26d.
I like the set-point! naming convention but I'm open to suggestions of
course.

*Struct-by-value return type =? locative*
You typically have code like this:
struct point {float x,y};
float distance (point *a, point *b);

To use distance, you wanna do something like:
(distance (make-point 1 2) (make-point 2 3))

This means that all struct-bindings should return types compatible with
pointers so they can be used seamlessly on the other functions. The only
way I have found to achieve this is to return locatives. It's not ideal
because you lose type information at runtime. Any ideas on how to keep this
without forcing the user to convert? Do tagged locatives exist, like tagged
pointers?

*Struct by value return types*

This is my proposal:
$ echo struct point getPoint(); | chicken-bind  - -o -
(begin
  (begin
(begin
  (define getPoint/overwrite!
(foreign-lambda*
  void
  (((c-pointer (struct point)) dest))
  *dest=(getPoint());))
  (define (getPoint)
(let ((dest (location
  (make-blob (foreign-value sizeof(struct point)
int)
  (getPoint/overwrite! dest)
  dest)

I wish to export the overwrite-version (and set-point! above) because I
assume it can be useful in tight loops where you only need to allocate
once. Any objections? And what might be a better name than /overwrite!?

*Compatibility*
The new patches should not change any behavior except that make-struct
now returns a locative instead of a c-pointer.

Looking forward to hear your thoughts and get this patch out there!
Kris
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] patch for chicken-bind

2012-06-25 Thread Kristian Lein-Mathisen
Hi guys!

It's me again, still going on about struct-by-value in
chicken-bindhttp://wiki.call-cc.org/eggref/4/bind.
This time I think I may have
codehttps://github.com/kristianlm/chicken-bind worthy
of entering the official repo. The patches add three new features:

   1. Struct-by-value in arguments
   2. Struct-by-value return types
   3. Nested structs (practically same as 2)

Functions on the Scheme-side interface all functions using pointers or
locatives, regardless of their original signature.

You can have a look at my 10 commits that make up the patch on
githubhttps://github.com/kristianlm/chicken-bind/commits/. I
tried to be descriptive in my commit messages. Please let me know of your
thoughts and concerns. If nothing pops up, I'll pass it on Felix
(chicken-bind maintainer) for review.

*Motivation*
While most C libraries pass structs by reference, both physics engines I've
come across, Chipmunk and Box2D, pass small structs like 2d-vectors around
by value everywhere. This patch made my life easier.

*Code samples*
Let's walk through the new foreign-lambda snippets that it generates. I use
the point struct in my examples, pretend it's some 2d/3d vector of
floats. First, let's look at passing a struct by reference:

*1. Struct arguments*
[klm@kth chicken-bind]$ echo float length(struct point*) | chicken-bind -
-o -
(begin
  (begin
(define length
  (foreign-lambda float length (c-pointer (struct point))
*
*
Nothing's changed there, my patch will kick in when you pass structs by
value. The patch checks if any arguments are non-pointer struct arguments,
and if there are any, it wraps the call in a foreign-lambda* with all
struct-by-val arguments to c-pointer variant which are dereferenced in C:

[klm@kth chicken-bind]$ echo float length(struct point) | chicken-bind -
-o -
(begin
  (begin
(define length
  (foreign-lambda*
float
(((c-pointer (struct point)) a0))
C_return(length(*a0));

*2. Struct return-types*
Struct return-types are a little trickier and are split into two functions.
One will call the original function, storing the result in a additional
destination operand. The other will allocate memory to use as this
destination and calls the first:

[klm@kth chicken-bind]$ echo struct point intersection(struct line*,
struct line) | chicken-bind  - -o -
(begin
  (begin
(begin
  (define intersection/overwrite!
(foreign-lambda*
  void
  (((c-pointer (struct point)) dest)
   ((c-pointer (struct line)) a0)
   ((c-pointer (struct line)) a1))
  *dest=(intersection(a0,*a1));))
  (define (intersection a0 a1)
(let ((dest (location
  (make-blob (foreign-value sizeof(struct point)
int)
  (intersection/overwrite! dest a0 a1)
  dest)

As shown above, you can mix and match struct value-passing and
pointer-passing in the arguments.

*3. Nested structs*
Nested structs face the same problem as struct return-types, but
unfortunately I haven't looked into uniting the codebase. However, it
follows the same destination-method as above:

[klm@kth chicken-bind]$ echo struct circle { struct point origin; float
radius ; } | chicken-bind - -o -
(begin
  (define circle-origin
(lambda (s)
  (let ((blob (location
(make-blob (foreign-value sizeof(struct point) int
(copy-struct!
  (foreign-lambda*
void
(((c-pointer (struct point)) _dest)
 ((c-pointer (struct circle)) s))
*_dest = s-origin;)))
(copy-struct! blob s)
blob)))
  (define circle-radius
(foreign-lambda*
  float
  (((c-pointer (struct circle)) s))
  return(s-radius);))
  (define make-circle
(foreign-lambda*
  (c-pointer (struct circle))
  (((c-pointer (struct point)) origin) (float radius))
  struct circle *tmp_ = (struct circle *)C_malloc(sizeof(struct
circle));\ntmp_-origin = *origin;\n\ntmp_-radius =
radius;\n\nC_return(tmp_);)))


*Caveats*
Struct-by-value return types and nested-struct getters return locatives.
This is nice because it will be like any other scheme-object and doesn't
need to be explicitly freed. Be careful though, locatives will be moved
around by the GC and thus pointers to it are not permanent.

A also added a small
test-suitehttps://github.com/kristianlm/chicken-bind/blob/master/tests/struct-passing-tests.scmfor
these features.

Cheers fellow Chickeners,
- Kris
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] patch for chicken-bind

2012-06-26 Thread Kristian Lein-Mathisen
Hi Jim,

I really appreciate you looking over this!

However, I think that it may be more practical to return locatives because
they are interchangeable with c-pointers. This makes them easier to pass
around with other parts of the foreign-code.

If we remove (locative ...) and use scheme-pointer, nested struct getters
and struct return-types in scheme would return blobs instead of locatives.
Let's check out this (untested) example of what I think would be typical
usage:

(bind 
struct point  { float x, y; };
struct circle { struct point origin; float radius; };
float distance(struct point, struct point);)

(define c1 (make-circle (make-point 10 10) 0.5))
(define c2 (make-circle (make-point 1 1) 0.2))

;; circle-origin is a nested-struct getter.
;; if it returns blobs, we must do:
(distance (make-locative (circle-origin c1)) (make-locative (circle-origin
c2)))
;; if it returns locative:
(distance (circle-origin c1) (circle-origin c2))

I was not aware of the performance penalty introduced by (locative blob).
Would it be beneficial to return the locative of the blob as a last step,
and use scheme-pointer in the intermediate, destination-operand, step?

Thank you,
K.



On Mon, Jun 25, 2012 at 10:18 PM, Jim Ursetto zbignie...@gmail.com wrote:

 Tip: if you use scheme-pointer instead of c-pointer, you can omit the
 locative).  E.g. (make-blob size) instead of (location (make-blob size)).
  This will be faster.

 On Jun 25, 2012, at 5:27 PM, Kristian Lein-Mathisen wrote:


 Hi guys!

 It's me again, still going on about struct-by-value in 
 chicken-bindhttp://wiki.call-cc.org/eggref/4/bind.
 This time I think I may have codehttps://github.com/kristianlm/chicken-bind 
 worthy
 of entering the official repo. The patches add three new features:

1. Struct-by-value in arguments
2. Struct-by-value return types
3. Nested structs (practically same as 2)

 Functions on the Scheme-side interface all functions using pointers or
 locatives, regardless of their original signature.

 You can have a look at my 10 commits that make up the patch on 
 githubhttps://github.com/kristianlm/chicken-bind/commits/. I
 tried to be descriptive in my commit messages. Please let me know of your
 thoughts and concerns. If nothing pops up, I'll pass it on Felix
 (chicken-bind maintainer) for review.

 *Motivation*
 While most C libraries pass structs by reference, both physics engines
 I've come across, Chipmunk and Box2D, pass small structs like 2d-vectors
 around by value everywhere. This patch made my life easier.

 *Code samples*
 Let's walk through the new foreign-lambda snippets that it generates. I
 use the point struct in my examples, pretend it's some 2d/3d vector of
 floats. First, let's look at passing a struct by reference:

 *1. Struct arguments*
 [klm@kth chicken-bind]$ echo float length(struct point*) | chicken-bind
 - -o -
 (begin
   (begin
 (define length
   (foreign-lambda float length (c-pointer (struct point))
 *
 *
 Nothing's changed there, my patch will kick in when you pass structs by
 value. The patch checks if any arguments are non-pointer struct arguments,
 and if there are any, it wraps the call in a foreign-lambda* with all
 struct-by-val arguments to c-pointer variant which are dereferenced in C:

 [klm@kth chicken-bind]$ echo float length(struct point) | chicken-bind
 - -o -
 (begin
   (begin
 (define length
   (foreign-lambda*
 float
 (((c-pointer (struct point)) a0))
 C_return(length(*a0));

 *2. Struct return-types*
 Struct return-types are a little trickier and are split into two
 functions. One will call the original function, storing the result in a
 additional destination operand. The other will allocate memory to use as
 this destination and calls the first:

 [klm@kth chicken-bind]$ echo struct point intersection(struct line*,
 struct line) | chicken-bind  - -o -
 (begin
   (begin
 (begin
   (define intersection/overwrite!
 (foreign-lambda*
   void
   (((c-pointer (struct point)) dest)
((c-pointer (struct line)) a0)
((c-pointer (struct line)) a1))
   *dest=(intersection(a0,*a1));))
   (define (intersection a0 a1)
 (let ((dest (location
   (make-blob (foreign-value sizeof(struct point)
 int)
   (intersection/overwrite! dest a0 a1)
   dest)

 As shown above, you can mix and match struct value-passing and
 pointer-passing in the arguments.

 *3. Nested structs*
 Nested structs face the same problem as struct return-types, but
 unfortunately I haven't looked into uniting the codebase. However, it
 follows the same destination-method as above:

 [klm@kth chicken-bind]$ echo struct circle { struct point origin; float
 radius ; } | chicken-bind - -o -
 (begin
   (define circle-origin
 (lambda (s)
   (let ((blob (location
 (make-blob (foreign-value sizeof(struct point)
 int
 (copy-struct

[Chicken-users] a new egg: chickmunk

2012-07-25 Thread Kristian Lein-Mathisen
Hi guys,

I just though I'd let you know I've created an egg that binds Chicken to
the Chipmunk 2D physics library. It's almost complete and is available on
github https://github.com/kristianlm/chickmunk.

Chickmunk https://github.com/kristianlm/chickmunk should provide bindings
to all C functions, so all parts of Chipmunk
http://chipmunk-physics.net/(bodies, shapes, constraints) should be
accessible. It also adds:

   - properties: shape-properties, shape-properties-set!, body-properties
   etc
   - lambda callbacks on query-point, query-segment and for-each-body/shape
   - nodes: space-nodes and nodes-space

;; Create a new Chipmunk space with a circle and a line-segment
(define space
  (nodes-space
`(space ()
(body ()
  (circle (radius 0.1)))
(body ((static 1))
  (segment (endpoints ((-1 -1)
   ( 1 -1


Unfortunately, I won't be able to work on this anymore due to my work
situation. If there is interest in releasing this incomplete egg to the
repository, please let me know!

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] a new egg: chickmunk

2012-07-26 Thread Kristian Lein-Mathisen
Hey Shawn,

Physics engines are definitely fun to play around with! If you wanna
quickly see what they can do, both Box2D and Chipmunk have interactive
demos along with their source code.

I had prior experience with Box2D and I actually started out trying to
create Chicken bindings for it. I wanted things to be as automatic as
possible, so I went for chicken-bind and tinyclos. It quickly turned out to
be a little cumbersome so I switched to Chipmunk. The interface was easier
to bind to. However, we loose a couple fancy features like
bulletshttp://www.box2d.org/manual.html#_Toc258082973
.

K.

On Thu, Jul 26, 2012 at 5:41 AM, Shawn Rutledge
shawn.t.rutle...@gmail.comwrote:

 Cool!

 I haven't done any messing around with physics engines, so don't know
 much about them but I'm curious if there's a reason you went with
 Chipmunk instead of Box2D?

 On 26 July 2012 00:46, Kristian Lein-Mathisen kristianl...@gmail.com
 wrote:
 
  Hi guys,
 
  I just though I'd let you know I've created an egg that binds Chicken to
 the
  Chipmunk 2D physics library. It's almost complete and is available on
  github.
 
  Chickmunk should provide bindings to all C functions, so all parts of
  Chipmunk (bodies, shapes, constraints) should be accessible. It also
 adds:
 
  properties: shape-properties, shape-properties-set!, body-properties etc
  lambda callbacks on query-point, query-segment and for-each-body/shape
  nodes: space-nodes and nodes-space
 
  ;; Create a new Chipmunk space with a circle and a line-segment
  (define space
(nodes-space
  `(space ()
  (body ()
(circle (radius 0.1)))
  (body ((static 1))
(segment (endpoints ((-1 -1)
 ( 1 -1
 
 
  Unfortunately, I won't be able to work on this anymore due to my work
  situation. If there is interest in releasing this incomplete egg to the
  repository, please let me know!
 
  K.
 
  ___
  Chicken-users mailing list
  Chicken-users@nongnu.org
  https://lists.nongnu.org/mailman/listinfo/chicken-users
 

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] a new egg: chickmunk

2012-07-26 Thread Kristian Lein-Mathisen
Great, I will add some of the tools I've been using
to the repo. They're incomplete as well, but they
may help getting you started.

K.

On Thu, Jul 26, 2012 at 12:23 AM, Christian Kellermann
ck...@pestilenz.orgwrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [120726 01:19]:
  Hi guys,
 
  I just though I'd let you know I've created an egg that binds Chicken to
  the Chipmunk 2D physics library. It's almost complete and is available on
  github https://github.com/kristianlm/chickmunk.
 
  Chickmunk https://github.com/kristianlm/chickmunk should provide
 bindings
  to all C functions, so all parts of Chipmunk
  http://chipmunk-physics.net/(bodies, shapes, constraints) should be
  accessible. It also adds:
 
 - properties: shape-properties, shape-properties-set!, body-properties
 etc
 - lambda callbacks on query-point, query-segment and
 for-each-body/shape
 - nodes: space-nodes and nodes-space
 
  ;; Create a new Chipmunk space with a circle and a line-segment
  (define space
(nodes-space
  `(space ()
  (body ()
(circle (radius 0.1)))
  (body ((static 1))
(segment (endpoints ((-1 -1)
 ( 1 -1
 
 
  Unfortunately, I won't be able to work on this anymore due to my work
  situation. If there is interest in releasing this incomplete egg to the
  repository, please let me know!

 This is awesome! I will definitely play with it. This could be an
 ingredient for some interesting doodle puzzle games!

 Cheers,

 Christian

 --
 9 out of 10 voices in my head say, that I am crazy,
 one is humming.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Building Chicken Scheme for Android

2012-10-01 Thread Kristian Lein-Mathisen
Hi guys,

I just thought I'd point out I've started a build-system for getting
Chicken Scheme runtime running on Android. You can take a peek here:
https://github.com/kristianlm/chicken-android.

Note that it only builds the runtime system (you generally don't have a C
compiler on your Android device).

I did not plug into Chicken's existing build system because the Android NDK
build-system is tricky, and the general recommendation is to stick with
'ndk-build' rather than patching up existing makefiles. Additionally, it
makes it easier to embedd the Chicken into existing Android projects.

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Building Chicken Scheme for Android

2012-10-02 Thread Kristian Lein-Mathisen
Hi Alan,

That's interesting. I'm not sure I understand though, how useful having an
on-device compiler environment would be.

Whenever you distribute your apps, binaries are all bundled in, so you
don't need it for your end-users. And during development, you're in front
of your computer which cross-compiles significantly faster than your phone.

This is, of course, if you're actually planning on writing an app. If you
wanna just goof around on your command-line and try different system calls
or talk to your phone kernel, maybe you're right.

If you just compile a C file an run it on your phone, you can check out how
the csi binaryhttps://github.com/kristianlm/chicken-android/blob/master/csi.mk
is
built. The building
sectionhttps://github.com/kristianlm/chicken-android#building
describes
how you can place this on your phone and run (I don't recall if this
actually requires root access). This is with the ndk still.

TinyCC for ARM sounds like fun, but for compatibility, I'd stick with the
official NDK!

Cheers,
K.

On Mon, Oct 1, 2012 at 4:15 PM, Alan Post alanp...@sunflowerriver.orgwrote:

 Off topic, but I've played with several mobile devices and none of
 them have ever really 'stuck.'  I wind up back on my laptop happier
 than I was when I wandered away.

 After enough of these experiences, I came to realize that not having
 a C compiler+native development environment was the common
 denominator in my negative experiences.

 Now I've been seeing more and more android stuff, and wondering
 whether one of these devices is going to fall in my lap, so I ask:
 can you get a C compiler and native development environment on these
 devices?

 What does that look like compared to what you've got here?

 Thank you,

 -Alan

 On Mon, Oct 01, 2012 at 03:10:29PM +0200, Kristian Lein-Mathisen wrote:
 Hi guys,
 I just thought I'd point out I've started a build-system for getting
 Chicken Scheme runtime running on Android. You can take a peek
 here:**[1]https://github.com/kristianlm/chicken-android.
 Note that it only builds the runtime system (you generally don't have
 a C
 compiler on your Android device).
 I did not plug into Chicken's existing build system because the
 Android
 NDK build-system is tricky, and the general recommendation is to stick
 with 'ndk-build' rather than patching up existing makefiles.
 Additionally,
 it makes it easier to embedd the Chicken into existing Android
 projects.
 K.
 
  References
 
 Visible links
 1. https://github.com/kristianlm/chicken-android

  ___
  Chicken-users mailing list
  Chicken-users@nongnu.org
  https://lists.nongnu.org/mailman/listinfo/chicken-users


 --
 .i ma'a lo bradi cu penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken and Cocos2Dx on Google Play!

2012-11-02 Thread Kristian Lein-Mathisen
Hi Jason,

and thanks for testing this. I'm really glad it seems to be working!

I'm happy to see others trying to go in a similar direction. Developing
with a REPL on the real hardware is so incredebly rewarding!
I've put out the code out on here https://github.com/Adellica/cocoscheme for
you guys to look at. But like mentioned before, it's a complete mess. I
would probably need a day to get it to build from scratch myself!

Note that it depends on chicken-bind from my github account, the official
version 1.0 won't work.

If you don't want to mess around with actually building it, you can peek at
the Scheme source-code. You can edit parts of that and send it to the REPL.
In particular, the *update* global may be of interest there.

Cheers and have a good weekend all!
K.

On Fri, Nov 2, 2012 at 6:26 PM, Jason Ripley ripley.ja...@gmail.com wrote:

  If you have an Android phone, it'd appreciate if you took the time to
 check
  it out. I am particularly interested if the app won't start at all, and
  perhaps what framerate you're getting (very bottom-left). I know there
 is a
  memory leak somewhere (thanks Alaric!), but otherwise I hope things
 should
  be running fairly smoothly.

 Hi Kris,

 I ran your app on my android devices, and it ran fine on all of them.
 Here are the frame rates:

 HTC EVO 3D - 48 fps
 Kindle Fire (1st gen)  - 52 fps
 Motorola Droid (1st gen) - 25 fps

 I just started looking at cocos2d-x for cross platform development,
 and would be very interested to see the code for this application
 (messy or not).  Also, I have a macbook, and a couple of old ipod
 touches, so I could possibly see how/if it runs on them.

 Thanks,
 Jason

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken and Cocos2Dx on Google Play!

2012-11-04 Thread Kristian Lein-Mathisen
Thanks a bunch for the encouraging feedback! I wonder where this project
might end up.

Shawn:
The bottom-left numbers read (from top to bottom): number of drawn
primitives, seconds per frame, frames per second.

For example, if you evaluate
;; Add a gentle but slippery slope
(space-add space
  `(body ((static 1))
(segment (friction 0.1)
(endpoints ((250 500)
(800 550))

You should see the primitives go up from 48 to 49.

K.

On Sat, Nov 3, 2012 at 10:18 PM, Shawn Rutledge
shawn.t.rutle...@gmail.comwrote:

 That's cool!  I tried it on my Galaxy Note (1st gen) and FPS is jumping
 around a lot, even when nothing is moving, usually between 50 and 60fps,
 and sometimes hitting peaks of more than 60 and sometimes really low
 values.  What is the top of those 3 numbers in the lower-left?  Mine says
 48 and stays the same.


 On 2 November 2012 15:20, Kristian Lein-Mathisen 
 kristianl...@gmail.comwrote:


 Dear Chickeners,


 I have been playing around with Chicken, Chipmunk and Cocos2Dx for a
 while, and I've finally got a demo up and running on Android. I've
 published it on Google Play in the Libraries and Demos category so you
 guys can test it!

 Check it out: Scheme REPL with 
 Cocos2Dxhttps://play.google.com/store/apps/details?id=com.adellica.cocoscheme

 The demo features a truck which you can drive back and forth, clumb up
 hills and fall down. Not very exciting, but I do actually catch myself
 playing it when I don't know what I should be coding on! The cool part is
 that there's a Chicken REPL behind the scenes.  You can connect to the REPL
 directly from your laptop if your phone is on the same WiFi, or use USB.
 Try Settings-Wireless Networks-Wifi Settings- [Menu]-Advanced when
 looking for you phone's IP.

 With netcat (or Emacs, with nc [ip] [port] as your Scheme interpreter),
 you could try:

 $ nc [phone ip] [port]
 Alternatively, you could use USB with adb and forward:
 $ adb forward tcp:1234 tcp:1234
 $ nc localhost 1234
 Once you see the REPL prompt @, you can play around:

 ;; 'import' chipmunk https://github.com/kristianlm/chickmunk bindings
 (use chickmunk https://github.com/kristianlm/chickmunk)
 ;; where is the player?
 (body-get-pos truck)

 ;; redefine game-loop to pause game unless you're touching the screen
 (define (*update*)
   (if *touch-down* (space-step space (/ 1 120
 ;; now let's give the truck a gentle push
 (body-set-ang-vel wf -20)
 ;; now touch the screen to watch it drift off
 ;; restart the app to revert your changes
 (exit)

 ;; You can also manipulate the physics-world:
 ;; Drop a ball from the sky
 (space-add space
   `(body ((pos (320 700)))
 (circle (density 0.001)
 (friction 1)
 (radius 10
 ;; Add a gentle but slippery slope
 (space-add space
   `(body ((static 1))
 (segment (friction 0.1)
 (endpoints ((250 500)
 (800 550))

 ;; type this to see the touch-down state:
 *touch-down*
 ;; it should be #f when your finger is off the screen, and
 touch-coordinates otherwise. evaluate it while holding the screen to try it
 out!



 If you have an Android phone, it'd appreciate if you took the time to
 check it out. I am particularly interested if the app won't start at all,
 and perhaps what framerate you're getting (very bottom-left). I know there
 is a memory leak somewhere (thanks Alaric!), but otherwise I hope things
 should be running fairly smoothly.

 Cheers!
 Kris

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users



___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] struggling with macros

2012-11-11 Thread Kristian Lein-Mathisen
Hi Răzvan,

Just as a side-note: It may be a good idea to play around with your
implementation as a normal function, and them wrap that in a macro once
it's up on its feet. That way you can isolate problems with your
implementation and problems with the macros.

This approach is taken by the bind egg (see
bind.scmhttp://bugs.call-cc.org/browser/release/4/bind/trunk/bind.scmand
bind-translator.scmhttp://bugs.call-cc.org/browser/release/4/bind/trunk/bind-translator.scm).
It could for example be setup like this:

- js-transformer.scm
;; define a function js-transformer that does this:
;;(js-transformer 123) = 123
;;(js-transformer 123) = \123\
;;(js-transformer '(1 2 3)) = 1(2, 3) ;; note the quote!

- js.scm
;; import js-transformer into syntax env
(begin-for-syntax (include js-transformer.scm)) ;; or (import-for-syntax
js-transformer.scm) if you have a module (I think)

;; define a macro that uses js-transformer at expansion-time
(define-syntax js
  (ir-macro-transformer
(lambda (expr inject compare)
(js-transform (cdr expr)


K.


On Sun, Nov 11, 2012 at 1:23 PM, Răzvan Rotaru razvan.rot...@gmail.comwrote:

 Hi,

 I'm trying to write a simple javascript DSL, and got stuck in the macros
 :). (I'm coming from lisp macros)  Take for example this one:

 (define-syntax js
   (ir-macro-transformer
 (lambda (expr inject compare)
   (let ((body (cdr expr)) (next (cadr expr)))
   (printf next=~a~n next)
 (cond
   [(string? next) (string-append \ next \)]
   [(number? next) (number-string next)]
   [(null? next) ]
   [(list? next) `(string-append (js ,(car next)) (  ))]
   )


 It is supposed to handle numbers and function calls, without building the
 parameter list in the function calls.

 CSI (js 1)
 next=1
 1
 CSI (js (1 2 3))
 next=(1 2 3)
 next=1
 1()


 However, when trying to build the parameter list I get and error which I
 don't understand:

 (define-syntax js
   (ir-macro-transformer
 (lambda (expr inject compare)
   (let ((body (cdr expr)) (next (cadr expr)))
   (printf next=~a~n next)
 (cond
   [(string? next) (string-append \ next \)]
   [(number? next) (number-string next)]
   [(null? next) ]
   [(list? next) `(string-append (js ,(car next)) ( (apply
 string-append (map js ,(cdr next))) ))]
   )

 CSI (js (1 2 3))
 next=(1 2 3)
 next=1
 Error: unbound variable: js
 [ inspect ]

 Restarts:
   0: [ABORT] Return to SLIME's top level

 Backtrace:
   0: eval   [ more... ] (map248 js245 (2 3))
   1: eval   [ more... ] (apply247 string-append246 (map248 js245 (2 3)))
   2: eval   [ more... ] (string-append246 (js245 1) ( (apply247
 string-append246 (map248 js245 (2 3))) ))
   3: syntax (2 3)
   4: syntax (map248 js245 (2 3))
   5: syntax (apply247 string-append246 (map248 js245 (2 3)))
   6: eval   [ more... ] (number-string next)
   7: eval   [ more... ] (number? next)
   8: eval   [ more... ] (printf next=~a~n next)
   9: eval   [ more... ] (cadr expr)
  10: eval   [ more... ] (cdr expr)
  11: syntax (js245 1)
  12: syntax (string-append246 (js245 1) ( (apply247
 string-append246 (map248 js245 (2 3))) ))
  13: eval   [ more... ] (cdr next)
  14: eval   [ more... ] (##sys#list (##core#quote map) (##core#quote js)
 (cdr next))
  15: eval   [ more... ] (##sys#list (##core#quote apply) (##core#quote
 string-append) (##sys#list (##core#quote map) (##core#quote js) (cdr next)))

 So, my questions are:
 1/ Why is js not bound in the second example? I also tried to use
 letrec-syntax but with same result.
 2/ Are there other ways to achieve what I want?
 3/ I also tried to use syntax-rules, but from what I understood this is
 not possible, because you can't execute arbitrary expressions (in this case
 a cond) at macroexpansion time. Am I right here?

 Thanks,
 Răzvan

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken Scheme for mobile devices?

2012-11-15 Thread Kristian Lein-Mathisen
Helllo mobile Chickeners!

I'm so glad there is interest in running Chicken on mobile platforms. This
is what I've been working on for the past few months, starting
chicken-android https://github.com/kristianlm/chicken-android and
cocoscheme https://github.com/Adellica/cocoscheme. I only have experience
with Android, so I can't speak for other platforms.

My chicken-android project is intended to help embedding Chicken into your
Android app. It does this by providing GNU Makefiles so that you can
easily add Chicken as a dependency to your exisiting NDK module,
like 
thishttps://github.com/Adellica/cocoscheme/blob/master/proj.android/jni/Android.mk#L20.
I say easily because it's still a pain with paths and you'll never get a
sensible error message with the NDK build chain (e.g. you'll get cannot
find chicken.h instead of cannot find module path for chicken). It also
has an extra 
find-extensionhttps://github.com/kristianlm/chicken-android/blob/master/jni/find-extension.scmunit
which allows you to load other chicken modules like (use
matchable) by prefixing lib as is mandatory with the NDK.

But to answer your question Stephen, the NDK handles chicken-generated .c
files well. I've essentially done exactly what you did for iOS: add those
.c files to the
build-sourceshttps://github.com/kristianlm/chicken-android/blob/master/chicken.mk.
But I too want something prettier!

The cocoscheme project is a playable demo with a network repl available on
Google Play, I brought it up on this mailing list
herehttp://lists.nongnu.org/archive/html/chicken-users/2012-11/msg8.html.
I'm using Cocos2Dx http://www.cocos2d-x.org/. All my projects so far have
exclusively relied on OpenGL ES and other game-like frameworks to deal with
user-interaction, so I don't know about using Chicken for more general apps.

I have a few thoughts on problem (1) in Kevin's terminology: making it
build/run on a mobile platform. Problem (2), to create bindings, I think
should be a completely isolated (and bigger) project.

I think Stephen makes a very valid point: A separate csc for building
mobile components would be very tricky. It would have to hook up to NDK's
gcc and that's not pretty, nor officially supported (I think). However, a
csc-like tool that generates buildfiles for the different architectures is
something I think would work well like Stephen explains.

In my cocoscheme project, for example, I'm using a few eggs. There a lot of
copy-paste like you can see
herehttps://github.com/Adellica/cocoscheme/blob/master/proj.android/jni/Android.mk.
It should be possible to generate makefiles for this automatically, at
least for the most basic eggs. Maybe we could even look at the .setup file
for an egg and make a .mk file based on that. I suspect this could be
handled in a similar manner on iOS?

I would love to have a project.scm file describing dependencies etc
and have template- and build-files automatically built based on that. .c
files would be re-generated automatically when they are older than their
.scm owners so the ndk wouldn't recompile everything every time like it
does now. And it should place all messy build-files into a single directory
(maybe hidden) so I'm not constantly confused as to what to commit and what
to not. Here's my dream:

$ chicken-mobile new hello-world
$ cd hello-world
$ chicken-mobile build android  ant debug  adb install
bin/hello-world-debug.apk
$ chicken-mobile build ios  xcode-magically-install bin/hello-world.ipa

K.


On Thu, Nov 15, 2012 at 3:11 PM, Arne Eilermann eilerm...@lavabit.comwrote:

 Hi there,

 first of all I'd like to introduce myself, because this is my first
 posting on this list and it's kinda not mine at all. :-)
 The last years ruby was my everyday programming language and it still is.
 But my new job at bevuta and a few people around this company brought me to
 chicken, which I'm now learning.

 My company just chose me to be some kind of a chicken communication
 minion, so the rest of this mail is more like bevuta speaking to you.

 A few words on the company: The bevuta IT GmbH is a software company based
 in cologne, Germany. We are like 10 Geeks in an office to which Moritz
 Heidkamp – you may know him – in 2010 brought chicken. We did a few smaller
 project in chicken but now the first bigger one knocks on our door.

 This project involves the development of a framework to create cross
 platform GUI applications in chicken on Android and iOS. The bindings for
 JNI to access Android's API is mostly done. The next step will be doing
 something like that for iOS. With this bindings we want to create an
 abstraction layer to get a common interface.
 All of this is part of a bigger commercial and proprietary contract work,
 but the emerging framework shall be released to the community.

 We already got some experiences with chicken on mobile devices. In 2011 we
 did some OpenGL stuff on Android and iOS. Moritz was significantly involved
 in this. It was mostly experimenting, but it 

Re: [Chicken-users] Chicken Scheme for mobile devices?

2012-11-15 Thread Kristian Lein-Mathisen
Hi Shawn,

Kristian decided to use Chipmunk, which is a scene graph with an integrated
 physics engine, right?  That's maybe a different optimization than you need
 for doing basic 2D GUI applications, but I do wonder if it could work for
 that purpose too.


Actually, Chipmunk only provides the physics-engine aspect. I'm using
Cocos2Dx for the scene-graph-like features. But it is, like you say,
game-oriented and probably wouldn't work for general UI.

Would it be possible to look into the
bbhttp://wiki.call-cc.org/eggref/4/bbegg, which uses
FLTK http://www.fltk.org/? IIRC FLTK has an OpenGL backend.

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Much improved customized Emacs

2012-11-23 Thread Kristian Lein-Mathisen
Hi Dan,

This is great work!

I too work in constrained environments, mostly on mobile phones, so I'm
really looking forward to use your package. I had some problems installing
it through marmelade so I added a couple github issues.

K.


On Fri, Nov 23, 2012 at 3:40 AM, Daniel Leslie d...@ironoxide.ca wrote:

 I've released an Emacs package that encompasses the customizations I've
 made to the base scheme-mode. This is a heavy iteration on the work
 previously present on the wiki.

 It provides:
 - Syntax support for all presently installed modules, both bound symbols
 and macros.
 - Chicken-doc support where documentation exists (including a C-? binding
 to lookup the word-at-point).
 - Support for font-locking of the above.
 - Automatic loading of a defvar'd etag file, if you wish.
 - Auto-Complete and Font Locking of *prefixed* *symbols*; IE, if you
 imported Allegro with the prefix al: *then al:draw-triangle will have the
 draw-triangle portion correctly coloured and auto-completed*!

 Most importantly, and the itch that drove this endeavour, *this is all
 provided independent of a running REPL*.

 For those of us who tend to work on more unstable/low-level code that is
 prone to killing the REPL the higher-level functionality of the various
 scheme modes are frustratingly inconsistent at best. Now without the need
 for an active REPL we can enjoy full syntax highlighting, auto-completion
 and documentation.

 Now, there is one outstanding annoyance that I'd like to field the mailing
 list for suggestions on. At present, all symbols found via *
 ##sys#macro-environment* and *##sys#environment-symbols# *are given the
 font-lock-builtin-face.

 I'd like to know what's best not to include at all, and hear some
 suggestions on how best to divide up the rest. Right now it feels like that
 font-locking is a little *too* aggressive.

 And perhaps the one negative: in order to provide these features without
 the REPL a cache is built when scheme-mode is first loaded. I *highly* 
 recommend
 you run Emacs from a daemon if you use this extension, so as to avoid
 unnecessarily recaching.

 That, or you can customize the *chicken-ac-modules* variable to just load
 the 'chicken' module and there will be nary a hitch, though far less
 completions.

 Anyhow, further details are available on the wiki:
 https://wiki.call-cc.org/dans-custom-emacs

 Thanks,
 -Dan

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken Scheme for mobile devices?

2012-11-24 Thread Kristian Lein-Mathisen
Hi Arne,

That's a great idea. I'll be there, and I'm looking forward to the
discussion!

In the mean time, I've played around with a template-based build system for
Android: https://github.com/Adellica/chicken-mobile
It isn't complete yet, but I though I'd put it out there so you can have a
look and see how I'm thinking of easing the build-phase.

K.


On Tue, Nov 20, 2012 at 2:20 PM, Arne Eilermann eilerm...@lavabit.comwrote:

 Hey chicken users!


 On Thursday, 15. November 2012 at 19:56, Mario Domenech Goulart wrote:

  It looks that there are other people interested in getting Chicken
  running on mobile platforms. So, I think there are good chances we'll
  soon see some nice projects on that area.

 This is really great!
 I'd like to invite everybody who is interested to join a little discussion
 on this topic. We want to meet at monday (26th) at 17:30 UTC in
 #mobile-chicken on irc.f0o.de. The target is to coordinate our efforts.


 I'm looking forward.

 Greetings,
 Arne






 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Question about embedding Chicken scheme

2013-01-30 Thread Kristian Lein-Mathisen
I see Julian, so when you said you were looking for an embedded language
for doing quests that's exactly what you meant... :)

I'm curious how you end up splitting your data structures. Perhaps it's all
in C/C++ and then you access then from Scheme? There's an example of you
might do that, if you haven't found out already:
http://wiki.call-cc.org/Wrapping%20simple%20c%20structs

You can also use chicken-bind http://wiki.call-cc.org/eggref/4/bind to
familiarize yourself with foreign-lambda and friends. Chicken-bind has
almost a complete C/C++ parser and can produce foreign-lambdas:


$ echo struct player { int level, health; } | chicken-bind - -o -

;;; GENERATED BY CHICKEN-BIND FROM -

(begin
  (define player-level
(foreign-lambda*
  integer
  (((c-pointer (struct player)) s))
  return(s-level);))
  (define player-health
(foreign-lambda*
  integer
  (((c-pointer (struct player)) s))
  return(s-health);))
  (define make-player
(foreign-lambda*
  (c-pointer (struct player))
  ((integer level) (integer health))
  struct player *tmp_ =  (struct player *)C_malloc(sizeof(struct
player));\ntmp_-level = level;\ntmp_-health =
health;\nreturn(tmp_);;\n)))

;;; END OF FILE


If you don't have it already, you can do `chicken-install bind` and play
around. Note that `make-player` above leaks memory.

Best of luck!
K.


On Thu, Jan 24, 2013 at 1:25 AM, Julian Day jcd...@mail.usask.ca wrote:

 On 23/01/2013 6:09 PM, Kristian Lein-Mathisen wrote:

  Are you planning on using any established game-engines or libraries?
 What will probably become very interesting is where your C++-code ends
 and where your Scheme begins.


 Hi Kristian,

 The game is currently pure C and C++.  As for libraries, I currently use
 xerces (XML), curses (UI), Google Test, and boost/stl.  The game itself is
 currently in a playable state - the player can win or lose, there's a
 generated world to explore, etc., though it's currently pretty bare.

 My plan is to start with reasonably small scope, and use Scheme for the
 quest logic.  I'd like to have a number of optional side quests beyond the
 basic roguelike dive to the bottom of the dungeon.  I could do this in
 C++, but I see an opportunity to work in my favourite programming language,
 so I'm going to take it. :)

  So I have a crazy idea, how about writing all of it in Scheme? So
 instead of exposing a function to add a message to the UI, you can
 expose functions to draw the UI,  and do your game in Scheme. Then as
 you move along and things settle, you can port the slow/critical parts
 to faster C-code if you need to. Just a thought. There are several eggs
 http://wiki.call-cc.org/**chicken-projects/egg-index-4.**html#graphicshttp://wiki.call-cc.org/chicken-projects/egg-index-4.html#graphics
 for

 graphics available that might suit your drawing needs, like cairo or
 opengl.


 Much too late for that, I'm afraid!  The game itself is currently just
 under 2 MB of code, resource strings, and configuration details.  I'm quite
 happy with its current state.  I'd love to try Scheme as the main language
 for a game, but this project's much too far in for that.

 Julian


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Msgpack implementation for scheme (and some questions)

2013-01-30 Thread Kristian Lein-Mathisen
Hi Hugo,

Msgpack seems like an interesting project indeed. Thanks for making an egg
for it!

I'm quite a newbie myself, but I noticed the coops egg includes the module
implementation 
directlyhttp://bugs.call-cc.org/browser/release/4/coops/trunk/coops-module.scm,
so you don't have to declare two modules. Maybe that's easier in your case
too?

I also noticed you're using (let () ...). Is there a reason you're not
simply using (begin ...)?

I've been poking around the msgpack-repositories, they support a lot of
languages! It's real neat that Chicken Scheme now joins in on the fun too.
So, looking at the node.js
porthttps://github.com/msgpack/msgpack-node/tree/master/deps/msgpack,
it seems like they've created js-bindings to the official C library.
Perhaps this might be suitable for Chicken Scheme too? From what I can
tell, you are reimplementing most of the functionality from scratch, is
that correct?

Great work, great piece of software to keep handy!
K.


On Tue, Jan 29, 2013 at 1:18 AM, Ivan Raikov ivan.g.rai...@gmail.comwrote:

 Hi Hugo,

  Thanks for your work on msgpack, it seems like an interesting
 project. Unfortunately, machine floating point formats are complicated, so
 any related code will be complicated as well. I don't know much about the
 msgpack protocol, but if representing floating-point numbers as strings is
 an option, I encourage you to look at fpio (
 http://wiki.call-cc.org/eggref/4/fpio ), a BSD-licensed egg for
 converting  floating point numbers to strings and vice versa. endian-blob
 includes code from GDB, so it cannot be relicensed without approval from
 the GNU project.

   Ivan



 On Tue, Jan 29, 2013 at 5:53 AM, Hugo Arregui hugo.arre...@gmail.comwrote:

 Hi,

 Recently I wrote an implementation of msgpack[1], which can be found
 here[2]. This is my first full project in scheme, so I would
 appreciate any feedback (please, be destructive).

 A couple of points already has been mentioned:

 - Macros to reduce redundancy (I'm reading about them, so I'm
 expecting to fix this soon).
 - A non technical but important thing: I'm using endian-blob egg,
 which is licensed as gpl and it's incompatible with the project
 license, which is bsd.

 But, beside that, I have a few questions:

 1) To avoid the creation of very heavy structures in tests, i'm using
 a kind of mock[3], which overrides some procedures, and restores it
 later. Is this the right way to do it?.

 In fact, in the egg branch I tried to pack the project as an egg and
 I think this hack is not working.

 2) To access the procedures mentioned in (1), i'm using two modules:
 msgpack-imple which contains the whole project and it's used for the
 tests, and msgpack which import msgpack-imple and expose the real
 interface. Again, is this the right way to do it?

 3) To read/write float/double numbers (in ieee754) i'm using
 endian-blob egg (here[4]), it's there any alternative without
 implementing the full float/double-binary logic (which seems quite
 complicated)?

 Thanks,
 Hugo.

 [1] http://msgpack.org/
 [2] https://github.com/hugoArregui/msgpack-scheme
 [3]
 https://github.com/hugoArregui/msgpack-scheme/blob/master/tests/run.scm#L187
 [3]
 https://github.com/hugoArregui/msgpack-scheme/blob/master/msgpack-imple.scm#L131

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Segfault with large data-structures

2013-02-02 Thread Kristian Lein-Mathisen
I'm getting the same result here, when I run it through csc. When I run it
through csi, though, it never seems to finish - is the task that big? I had
to kill it after 2-3 hours.

[klm@kth ~]$ csi -version

CHICKEN
(c)2008-2012 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.8.1 (rev e5ed396)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2012-09-30 on kth (Linux)

[klm@kth ~]$ uname -a
Linux kth 3.7.5-1-ARCH #1 SMP PREEMPT Mon Jan 28 10:03:32 CET 2013 x86_64
GNU/Linux

K.



On Sat, Feb 2, 2013 at 9:40 PM, Jim Ursetto zbignie...@gmail.com wrote:

 What version of chicken, and if 4.8.0 for example could you try 4.7?

 On Feb 2, 2013, at 11:51, Arthur Maciel arthurmac...@gmail.com wrote:

  Hello! I don't know if it is related to Ivan's problem, but when I
 compile and run this code:
 
  (use srfi-69)
 
  (define NODES 25)
  (define EDGES 1000)
 
  (define graph (make-hash-table))
 
  (define (insert-edges)
(printf ~N Hash-tables - Inserting edges ~N)
(do ((n 1 (+ n 1))) ((= n NODES))
  (if (= (remainder n 5000) 0)
  (printf  ~S nodes inserted ~N n))
  (do ((e 2 (+ e 1))) ((= e (+ 1 EDGES)))
(hash-table-update!/default graph
n
(lambda (edges-list)
  (if (member e edges-list)
  edges-list
  (cons e edges-list)))
(list e)
 
  (time  (insert-edges))
 
  I get this:
 
   $ csc list-in-hash-table-partials.scm -o list-partials.scm
   $ ./list-partials.scm
 
   Hash-tables - Inserting edges
   5000 nodes inserted
   1 nodes inserted
   15000 nodes inserted
   2 nodes inserted
   25000 nodes inserted
   3 nodes inserted
   35000 nodes inserted
   4 nodes inserted
  Segmentation fault
 
 
  I tried to compile with -O2, -O -d2 and -O3. It doesn't make difference
 for me: it always present a segfault. Any hint on how to make it work?
 
  Thanks!
  Arthur
  ___
  Chicken-users mailing list
  Chicken-users@nongnu.org
  https://lists.nongnu.org/mailman/listinfo/chicken-users

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] some questions about easyffi and foreign code

2013-02-03 Thread Kristian Lein-Mathisen
Hey Hugo,

Yeah, that example wasn't working for me either. If you put (use easyffi)
at the top of the file though, it should work. Note that easyffi is
deprecated, use bind http://api.call-cc.org/doc/bind instead:

(use bind)
(bind* double modf(double x, ___out double *iptr);)
(let-values ([(frac int) (modf 33.44)])
(print frac   int))

I'm afraid I don't understand what Kon means either...

If 64-bit integers are all you need, perhaps you can use the foreign type
unsigned-integer64? I'm guessing the C compiler will handle that even if
you're on a 32bit system. I'm not sure how Chicken will handle integer64's
if you're on a 32bit system though.

If you want to continue using your multiword version, you could look into
the u32vector foreign type. It will give you a nice array on the C-side,
and a nice vector on the Chicken side:

(use srfi-4)
(define double-uint64
  (foreign-lambda* void ((double d) (u32vector _o))

uint32_t* ptr = (uint32_t*)d;
_o[0] = ptr[0];
_o[1] = ptr[1];
   ))

(define (double-byte-blob value)
  (let ((out (make-u32vector 2)))
(double-uint64 value out)
out))

(print (double-byte-blob 1.3) \n
   (double-byte-blob 0) \n
   (double-byte-blob 1) \n
   (double-byte-blob 100))

I don't know if this is a good approach, though. Maybe someone knows how
uint64_t foreign-types are handled on 32bit systems?

K.


On Sun, Feb 3, 2013 at 1:52 AM, Hugo Arregui hugo.arre...@gmail.com wrote:

 Hi again,

  1) ..
  $ csc -X easyffi test.scm -c++; ./test
 
  Error: unbound variable: foreign-parse
  Call history:
  foreign-parse
 
  I have no idea of what's going on.

 Could this be a problem in my installation?

 The example in the wiki is not working either:

 #!
 #ifndef CHICKEN
 #include math.h
 #endif

 double modf(double x, ___out double *iptr);
 #

 (let-values ([(frac int) (modf 33.44)])
 (print frac   int))

 //with the same error: unbound variable: foreign-parse

  2) Then I tried another approach:
 ..
  Error: bad argument type - not a pointer: 0

 I found a way to do this[1]. But, I found another problem: big int32
 are promoted to flonums, I know that this is an expected behaviour,
 but I have a doubt:

 In a message[2] Kon Lovett writes:

 Means you want to compile w/ generic-arithmetic  usual-integrations
 when using a foreign call.

 I suposse this is a compiler setting, but I don't now how to enable
 it. Also, I don't know what  usual-integrations means, could you
 provide more details please?

 Thanks again, and sorry for bothering you.
 Regards,
 Hugo

 [1] http://pastebin.com/XH5n3V72
 [2]
 http://lists.nongnu.org/archive/html/chicken-users/2007-05/msg00227.html

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Q] Is there any library for machine/statistical learning in Scheme(chicken scheme)?

2013-03-26 Thread Kristian Lein-Mathisen
Hi Sungjin,

It seems 
jeronimo-pellegrinihttp://wiki.call-cc.org/users/jeronimo-pellegrinihas
written some eggs with AI in mind. Perhaps some of those might be
useful? The octave http://wiki.call-cc.org/eggref/4/octave egg might also
be useful when you're analyzing your progress.

K.


On Tue, Mar 26, 2013 at 4:18 AM, Sungjin Chun chu...@gmail.com wrote:

 What I've found are (for chicken scheme):
 1. libsvm
 2. fann


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] new egg: glm

2013-04-15 Thread Kristian Lein-Mathisen
Dear Chickeners!

In my OpenGL and physics-simulation adventures I have fequently come across
the need for a small math library in Chicken. I spent some time looking at
the eggs out there, but some of them seemed a little overkill for my needs,
so I decided to roll my own.

I was looking for:
- binary compatible with C/OpenGL/GLSL data-storage (f32vectors and friends)
- simple to use and short naming/syntax
- can multiply/add etc vector/matrix
- includes some transformation helpers like translate, rotate and scale
- not a lot of dependencies

In C++ land, it seems like GLM math library is popular, and it matches the
criteria above (except language). A few days in, I've got a fairly
functional math util egg:

https://github.com/Adellica/chicken-glm

Feedback is very welcome! In particular, because of all the different types
(vec2, vec3, ivec2 etc), I wrote a template macro which does basic
substring substitution:

(template
 `((D 2 3 4))
 (define (make-vecD  fill) (make-f32vector D fill))
 (define (make-dvecD fill) (make-f64vector D fill))
 (define (make-ivecD fill) (make-s32vector D fill))
 (define (make-uvecD fill) (make-u32vector D fill))
 (define (make-bvecD fill) (make-u8vector D fill)))

That will expand the body three times, each time substituting D with 2~4.
This works quite nicely and saves me a lot of copy-paste, but I don't know
if it's in the Scheme spirit. Any thoughts?

Vectors use structures from srfi-4, and matrices get their own record
(storing column-count along with its srfi-4 vector).

Once chicken-glm stabelizes a little, I'd like to make it reachable from
chicken-install.
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: glm

2013-04-15 Thread Kristian Lein-Mathisen
I'm glad to hear, I hope this will come in handy.

I'll license it with whatever fits the Chicken model and community. Is that
BSD perhaps?

It still needs a bit of work though, let me know if there are any feature
requests and I'll see what I can do.

K.
On Apr 15, 2013 7:14 PM, Dan Leslie d...@ironoxide.ca wrote:

 Wild!

 I've looked at binding GLM a few times but shied away from the wall of
 templates. Your solution is a rather elegant hack, IMHO, leaving little to
 the clients of your bindings to fuss about.

 What's the license?

 -Dan

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: glm

2013-04-17 Thread Kristian Lein-Mathisen
Hi guys,

I decided to use a MIT license like Dan suggested. It's what GLM uses, and
it will probably make life easier if at some point we want to embed the GLM
sources into this egg (GLM is a header-only implementation).

It should be fairly stable now and hopefully usable, but please help me
test! I've tagged version 1.0 and made a release-info file:

https://github.com/Adellica/chicken-glm/raw/master/glm.release-info

I'd be glad to see this in the official egg-index!
Thanks,
K.


On Tue, Apr 16, 2013 at 12:03 AM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Mon, 15 Apr 2013 23:24:25 +0200 Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:

  I'll license it with whatever fits the Chicken model and community.
  Is that BSD perhaps?

 Yes.

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] usb egg v0.1.0 is released

2013-05-08 Thread Kristian Lein-Mathisen
Hello Aaron,

I can't believe nobody has commented on this yet - this is really cool! I
have no experience with libusb, but it seems this is how you'd start if
you're trying to make your own USB driver or investigating someone else's.

I hope I run into a problem where I need lolevel USB access like this :) a
usbrepl like this must be really handy.

Thanks for your contribution!
K.
On Apr 22, 2013 7:18 PM, Aaron Patterson tenderl...@ruby-lang.org wrote:

 Hi everyone!

 I laid my first egg, and I'm emailing here to inform you of its
 existence.  This egg wraps libusb and gives you a scheme API.  Here is
 the repository:

   https://github.com/tenderlove/chicken-usb

 My scheme is not fully hatched, and this code is not 100% complete (as
 noted in the README).

 Thanks everyone!

 

 --
 Aaron Patterson
 http://tenderlovemaking.com/

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Kristian Lein-Mathisen
I just though I'd mention srfi-4 http://api.call-cc.org/doc/srfi-4 as
well, which are much easier to interface with from C. If all your elements
are integers, for example, you might want to check out u32vector. Srfi-4
vectors use plain C float/int arrays and are possible as argument-types
from foreign-lambda and friends.

K.


On Wed, Jun 5, 2013 at 5:10 PM, pluijzer . pluij...@gmail.com wrote:

 Hello everybody,

 I was planning to use Chicken Scheme in a fashion more similar to Guile
 and Lua. i.e. passing Scheme Data Objects from Chicken to C and back using
 the C interface.

 I am a little confused though as how to have a C function return a Scheme
 List that is seen by the garbage collector.

 For example, is the code below correct, will the list be seen by the
 garbage collector? And if not, is there correct way to do this.

 #
 C_word give_12()
 {
   C_word *mem  = C_alloc(C_SIZEOF_LIST(2));
   C_word  list = C_list(mem, 2, C_fix(1), C_fix(2));
   return list;
 }
 #
 (print ((foreign-lambda scheme-object give_12)))

 Also there doesn't seem to be a C_listp predicate. Is this a concious
 omission?

 thank you in advance,
 Richard

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken C interface

2013-06-06 Thread Kristian Lein-Mathisen
On Thu, Jun 6, 2013 at 11:34 AM, Thomas Chust ch...@web.de wrote:

 On 2013-06-05 23:36, Felix wrote:
  From: Dan Leslie d...@ironoxide.ca
  [...]
  Basically, use C_alloc to allocate the memory required to host both
  the List structure and the data it is to contain, then use the C_list
  macro to patch it all together.
 
  Note that this code is not correct: C_alloc allocates on the C stack and
 the
  data will be invalid once the function returns (Sorry). If this works,
 then
  it is just coincidental!
  [...]

 Hello,

 when I first saw that code I thought that this must be incorrect, too.
 Then I checked the CHICKEN documentation for foreign-safe-lambda and read:

   This is similar to foreign-lambda, but also allows the called
function to call Scheme functions and allocate Scheme data-objects.

 Now I'm confused. Of course C_alloc allocates on the stack and of course
 this can likely break if a function just returns some pointer to stack
 allocated data. However C_return could magically copy the return value
 to the second generation heap or similar trickery to actually make
 foreign-safe-lambda and C_alloc interoperate correctly or one could
 perhaps use a special call ABI to prevent stack corruption upon return
 from a foreign-safe-lambda and salvage stack allocated objects. Is any
 such strategy actually implemented?


From what I understand, this is exactly what foreign-primitive does: wraps
C_return in a CPS, keeping the stack-allocation alive. I posted a question
on a similar topic a while back:
http://lists.gnu.org/archive/html/chicken-users/2012-03/msg00034.html

K.




 But maybe the documentation is just misleading and wanted to say
 something about temporary allocation for the lifetime of the function
 instead.

 Ciao,
 Thomas


 --
 When C++ is your hammer, every problem looks like your thumb.


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken C interface

2013-06-06 Thread Kristian Lein-Mathisen
I did not read your question properly, sorry! Thanks for the clarification,
I didn't know foreign-lambda were the one that had to do the
CPS-conversion. Does that mean there is a small performance overhead when
using foreign-lambda as opposed to just foreign-primitive?

K.


On Thu, Jun 6, 2013 at 11:59 AM, Thomas Chust ch...@web.de wrote:

 On 2013-06-06 11:46, Kristian Lein-Mathisen wrote:
  [...]
  From what I understand, this is exactly what foreign-primitive does:
  wraps C_return in a CPS, keeping the stack-allocation alive.
  [...]

 Hello,

 well, kind of.

 Since compiled CHICKEN code is fully CPS transformed you don't wrap
 something in a CPS context, you wrap anything that isn't natively in CPS
 with a function that calls it and passes the result to the values
 continuation.

 foreign-lambda and friends create such wrappers, foreign-primitive
 doesn't create a wrapper, it just expects the code to be in CPS style,
 which means that the code may never return at all. C_return is, in that
 case, just syntactic sugar for invoking the values continuation.

 Since the code in a foreign-primitive never returns, things allocated in
 the nursery (ie. on the stack) live on forever, or rather until the
 next minor garbage collection comes around, transfers anything that's
 still referenced into the second generation heap and throws away the
 nursery (ie. almost the entire stack).

 Therefore foreign-primitive can do allocation in the nursery, but
 foreign-lambda can't. However, foreign-lambda could still allocate
 directly in the second generation heap or transfer nursery-allocated
 values directly into the heap upon return before the stack context is
 destroyed. The question is whether such magic is present for
 foreign-safe-lambda, as the documentation may indicate, or whether that
 is not the case, as Felix has indicated with his earlier message :-)

 Ciao,
 Thomas


 --
 When C++ is your hammer, every problem looks like your thumb.


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] usb egg v0.1.0 is released

2013-06-06 Thread Kristian Lein-Mathisen
Hello Aaron,

We're just started looking at your chicken-usb egg. The API is much more
intuitive than Python'shttp://pyusb.sourceforge.net/docs/1.0/tutorial.html!


Might it be a good idea to define a record printer for #usb-device
records to include the vendor and product ids, and perhaps serial-number?
That way, we could quickly test like this:

$ csi -R usb -p '(usb-devices (usb-make-context))'
(#usb-device #usb-device #usb-device #usb-device)
;; I'd love to get
(#usb-device idVendor: 0x1234 idProduct: 0x3214 ...)

Cheers,
K.


On Wed, May 8, 2013 at 11:36 PM, Kristian Lein-Mathisen 
kristianl...@gmail.com wrote:


 Hello Aaron,

 I can't believe nobody has commented on this yet - this is really cool! I
 have no experience with libusb, but it seems this is how you'd start if
 you're trying to make your own USB driver or investigating someone else's.

 I hope I run into a problem where I need lolevel USB access like this :) a
 usbrepl like this must be really handy.

 Thanks for your contribution!
 K.
 On Apr 22, 2013 7:18 PM, Aaron Patterson tenderl...@ruby-lang.org
 wrote:

 Hi everyone!

 I laid my first egg, and I'm emailing here to inform you of its
 existence.  This egg wraps libusb and gives you a scheme API.  Here is
 the repository:

   https://github.com/tenderlove/chicken-usb

 My scheme is not fully hatched, and this code is not 100% complete (as
 noted in the README).

 Thanks everyone!

 

 --
 Aaron Patterson
 http://tenderlovemaking.com/

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] socket egg: socket-receive blocks?

2013-06-14 Thread Kristian Lein-Mathisen
Hi Chickeners!

I have come across a problem with multiple srfi-18 threads when tryping to
listen to UDP sockets:

(use socket)
(set! *socket* (socket af/inet sock/dgram ))
(set! (so-reuse-address? *socket*) #t)
(socket-bind *socket* (inet-address 0.0.0.0 5055))
;; (socket-receive ..) here blocks the prints below
;; after 1 s (about 10 hello's)
(thread-start! (lambda ()
 (thread-sleep! 1)
 (print receiving ...)
 (print (socket-receive *socket* 1024))
 (print done)))

(let loop ()
 (print hello from main-thread!)
 (thread-sleep! .1)
 (loop))

;; the hello's from the main thread continue after sending a udp packet:
;; $ echo test `date` | socat - UDP-DATAGRAM:127.0.0.1:5055,broadcast


The documentation for socket clearly states that socket-receive should not
block:

This call will block until data is available, but other threads can proceed.


What is wrong with my socket fd?

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] socket egg: socket-receive blocks?

2013-06-15 Thread Kristian Lein-Mathisen
Now my hello from main thread doesn't stop printing in my initial
example! Thanks a bunch, Jim!

K.


On Fri, Jun 14, 2013 at 11:58 PM, Jim Ursetto zbignie...@gmail.com wrote:

 Should be fixed in 0.2.3.  Let me know.

 Jim


 On Jun 14, 2013, at 3:24 PM, Jim Ursetto zbignie...@gmail.com wrote:

 Hi,

 It's a bug in the socket egg; nonblocking mode is only set during a
 socket-connect or socket-accept, which won't be called for UDP.

 Temporary workaround: (use posix) and then, after creating the socket, do
 either:

 (##sys#file-nonblocking! (socket-fileno *socket*))

 or equivalently

 (file-control fcntl/setfl (socket-fileno *socket*)
  (bitwise-ior (file-control fcntl/getfl (socket-fileno *socket*))
   open/nonblock))

 Neither workaround will work on Windows.

 Permanent fix: We should probably make all sockets nonblocking at creation
 time instead, since our machinery assumes nonblocking sockets.  We could
 expose the set-nonblocking operation to the user, but since TCP is always
 nonblocking, doing this only for UDP would be strange.  Thoughts?

 Jim

 On Jun 14, 2013, at 11:01 AM, Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:


 Hi Chickeners!

 I have come across a problem with multiple srfi-18 threads when tryping to
 listen to UDP sockets:

 (use socket)
 (set! *socket* (socket af/inet sock/dgram ))
 (set! (so-reuse-address? *socket*) #t)
 (socket-bind *socket* (inet-address 0.0.0.0 5055))
 ;; (socket-receive ..) here blocks the prints below
 ;; after 1 s (about 10 hello's)
 (thread-start! (lambda ()
  (thread-sleep! 1)
  (print receiving ...)
  (print (socket-receive *socket* 1024))
  (print done)))

 (let loop ()
  (print hello from main-thread!)
  (thread-sleep! .1)
  (loop))

 ;; the hello's from the main thread continue after sending a udp packet:
 ;; $ echo test `date` | socat - UDP-DATAGRAM:127.0.0.1:5055,broadcast


 The documentation for socket clearly states that socket-receive should not
 block:

 This call will block until data is available, but other threads can
 proceed.


 What is wrong with my socket fd?

 K.
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users




___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] parley improvements

2013-08-08 Thread Kristian Lein-Mathisen
Hello Christian,

Thanks for that, parley is really useful! I'm using parley for my everyday
Chickening. I just have a small comment regarding regarding the prompt.
When I do this:

[klm@kth ~]$ csi -q
#;1 (begin
   ;; each line produce
   ;; a '' mark
   (void))
#;2
#;2 ^D

Those '' prompts are really quite handy. However, when I run csi from
emacs as inferiour-scheme, it's not so useful because the '' end up on the
same line, and I don't care that there were multiple lines involved. In my
emacs buffer, if I evaluate the same sexp as above, I just get this:

#;1#;2

What I'd like to see is this:

#;1
#;2

So how about an option to turn those '' off, and perhaps place that
newline before each prompt? Maybe there is something to fix this already in
the docs, but I haven't found anything. This is my ~/.csirc:

;; -*- scheme -*-
(use parley)
(let ((old (current-input-port)))
  (current-input-port (make-parley-port old)))

Cheers,
K.


On Tue, Aug 6, 2013 at 3:10 PM, Christian Kellermann ck...@pestilenz.orgwrote:

 Hello Chicken users!

 This is a public service announcement for the parley egg:

 I will commence working on long outstanding bugs inthe parley module.
 To make things nice for everyone I would appreciate it if you could
 send me reports of odd behaviour and other wishlist items you have
 encountered when working with parley. I will first collect them and
 work them off in the usual robot fashion.

 Yours truly,

 Christian

 --
 In the world, there is nothing more submissive and weak than
 water. Yet for attacking that which is hard and strong, nothing can
 surpass it. --- Lao Tzu

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] parley improvements

2013-08-08 Thread Kristian Lein-Mathisen
Dumb terminal, that's a much better idea! It's working too, thanks a lot
Christian.


But I found another bug, I don't know where it was introduced:

[klm@kth parley]$ csi -q
#;1 (define
 x)

Error: unbound variable: definex

Call history:

syntax  (definex)
eval  (definex)--
#;1 ^D

K.




On Thu, Aug 8, 2013 at 8:55 PM, Christian Kellermann ck...@pestilenz.orgwrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [130808 18:23]:
  Hello Christian,
 
  Thanks for that, parley is really useful! I'm using parley for my
 everyday
  Chickening. I just have a small comment regarding regarding the prompt.
  When I do this:
 
  [klm@kth ~]$ csi -q
  #;1 (begin
 ;; each line produce
 ;; a '' mark
 (void))
  #;2
  #;2 ^D
 
  Those '' prompts are really quite handy. However, when I run csi from
  emacs as inferiour-scheme, it's not so useful because the '' end up on
 the
  same line, and I don't care that there were multiple lines involved. In
 my
  emacs buffer, if I evaluate the same sexp as above, I just get this:
 
  #;1#;2
 
  What I'd like to see is this:
 
  #;1
  #;2
 
  So how about an option to turn those '' off, and perhaps place that
  newline before each prompt? Maybe there is something to fix this already
 in
  the docs, but I haven't found anything. This is my ~/.csirc:
 
  ;; -*- scheme -*-
  (use parley)
  (let ((old (current-input-port)))
(current-input-port (make-parley-port old)))

 Can you please try HEAD from the bitbucket repo and see whether
 this fixes your issue?

 git clone https://bitbucket.org/ckeen/parley.git

 With this code, parley does nothing clever with the prompt when we
 have a dumb terminal, i.e. when stdin is not a tty.

 Thanks,

 Christian

 --
 In the world, there is nothing more submissive and weak than
 water. Yet for attacking that which is hard and strong, nothing can
 surpass it. --- Lao Tzu

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] parley improvements

2013-08-08 Thread Kristian Lein-Mathisen
Sorry, that email went off a little too quick. In the example I sent, I
start csi with parley in my csirc, and type (define, then hit enter, type
x). I would expect that to work, defining x as (void). This may be a better
illustration of the problem, however:

[klm@kth parley]$ csi -q
#;1 (begin 1
 2
 )
12

Now I'm getting 12, which should have been 2. It seems newlines are missing
as a separator somehow.
Cheers,
K.



On Thu, Aug 8, 2013 at 9:06 PM, Kristian Lein-Mathisen 
kristianl...@gmail.com wrote:

 Dumb terminal, that's a much better idea! It's working too, thanks a lot
 Christian.


 But I found another bug, I don't know where it was introduced:

 [klm@kth parley]$ csi -q
 #;1 (define
  x)

 Error: unbound variable: definex

 Call history:

 syntax  (definex)
 eval  (definex)--
 #;1 ^D

 K.




 On Thu, Aug 8, 2013 at 8:55 PM, Christian Kellermann 
 ck...@pestilenz.orgwrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [130808 18:23]:
  Hello Christian,
 
  Thanks for that, parley is really useful! I'm using parley for my
 everyday
  Chickening. I just have a small comment regarding regarding the prompt.
  When I do this:
 
  [klm@kth ~]$ csi -q
  #;1 (begin
 ;; each line produce
 ;; a '' mark
 (void))
  #;2
  #;2 ^D
 
  Those '' prompts are really quite handy. However, when I run csi from
  emacs as inferiour-scheme, it's not so useful because the '' end up on
 the
  same line, and I don't care that there were multiple lines involved. In
 my
  emacs buffer, if I evaluate the same sexp as above, I just get this:
 
  #;1#;2
 
  What I'd like to see is this:
 
  #;1
  #;2
 
  So how about an option to turn those '' off, and perhaps place that
  newline before each prompt? Maybe there is something to fix this
 already in
  the docs, but I haven't found anything. This is my ~/.csirc:
 
  ;; -*- scheme -*-
  (use parley)
  (let ((old (current-input-port)))
(current-input-port (make-parley-port old)))

 Can you please try HEAD from the bitbucket repo and see whether
 this fixes your issue?

 git clone https://bitbucket.org/ckeen/parley.git

 With this code, parley does nothing clever with the prompt when we
 have a dumb terminal, i.e. when stdin is not a tty.

 Thanks,

 Christian

 --
 In the world, there is nothing more submissive and weak than
 water. Yet for attacking that which is hard and strong, nothing can
 surpass it. --- Lao Tzu



___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] parley improvements

2013-08-08 Thread Kristian Lein-Mathisen
Sounds good to me, looking forward to the new parley-release!

Good job!
K.


On Thu, Aug 8, 2013 at 9:16 PM, Christian Kellermann ck...@pestilenz.orgwrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [130808 21:10]:
  Sorry, that email went off a little too quick. In the example I sent, I
  start csi with parley in my csirc, and type (define, then hit enter, type
  x). I would expect that to work, defining x as (void). This may be a
 better
  illustration of the problem, however:
 
  [klm@kth parley]$ csi -q
  #;1 (begin 1
   2
   )
  12

 Right, enter does not introduce a separator in the input string in
 this case, I guess it should.

 Thanks!

 Christian

 --
 In the world, there is nothing more submissive and weak than
 water. Yet for attacking that which is hard and strong, nothing can
 surpass it. --- Lao Tzu

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] (seemingly) random disconnects of zmq sockets

2013-08-25 Thread Kristian Lein-Mathisen
Hi Karsten,

It's a little hard to figure out why that socket all of a sudden just dies.
Perhaps you could make a smaller example where this bug is reproducable?

There is a branch where we're trying to update the bindings to work against
zmq version 3.2:
https://bitbucket.org/DerGuteMoritz/zmq/commits/branch/3.2

In this version, the glue-code has been simplified quite a lot and perhaps
that solves your problem. You could try against this zmq egg-version and
let us know if that helps!

K.


On Mon, Aug 19, 2013 at 10:20 PM, Karsten Gebbert karsten.gebb...@gmail.com
 wrote:

  Hi List,

 I'm having a strange problem with the zmq egg with the following program:

 http://paste.call-cc.org/paste?id=1c0c94e23600b68e8100d6c5913f58368c01f02c

 Basically, I have two sockets, one 'push for sending to a node.js process
 (with the zmq module compiled against 2.1 series, too) and one 'pull for
 getting data from the same node.js process. After a while of fiddling
 around, the CHICKEN process quits with this error:

 *Warning (#thread: thread4): in thread: (receive-message) Socket
 operation on non-socket: 88**
 **
 **Call history:**
 **
 **seq-ipc.scm:31: loop  **
 **seq-ipc.scm:29: with-input-from-string**
 **seq-ipc.scm:30: update-track  **
 **seq-ipc.scm:19: alist-ref **
 **seq-ipc.scm:20: alist-ref **
 **seq-ipc.scm:21: alist-ref **
 **seq-ipc.scm:21: alist-update! **
 **seq-ipc.scm:31: zmq#receive-message*--**
 **
 **Error: (send-message) Socket operation on non-socket: 88**
 **
 **Call history:**
 **
 **main.scm:32: modulo   **
 **main.scm:39: g224 **
 **main.scm:40: alist-ref**
 **main.scm:41: alist-ref**
 **main.scm:41: alist-ref **
 ****
 **main.scm:53: thread-sleep!**
 **main.scm:54: midi#bar-in-ms   **
 **main.scm:56: main-loop**
 **main.scm:32: midi#sixteenth-by-bpm**
 **main.scm:32: modulo   **
 **main.scm:34: midi#bar-in-ms   **
 **main.scm:36: number-string   **
 **main.scm:36: zmq#send-message   --**
 **
 *

 It seems as though the sockets have been disconnected as *errno* is 88,
 which grep tells me is defined as such:

 /usr/include/asm-generic/errno.h:61:#define ENOTSOCK88  /*
 Socket operation on non-socket */

 I wonder what could cause the sockets to magically close on me. Anyone an
 idea? I'd really appreciate any hints how to debug this best, it does seem
 a little intractable :/

 Cheers,

 Karstn

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Basic FFI Principle in Chicken

2013-09-07 Thread Kristian Lein-Mathisen
Hey Chris,

I though I'd mention the srfi-4 unit and it's u32vector. This may come in
handy for your particular struct. While make-blobs are great for allocating
managed memory for arbitrary structs, you can sometimes use make-s32vector,
for example, where the struct is basically an array like yours.

Note that this may not be a good idea if your struct members are just using
int because you wouldn't know if it's a s32vector or a s64vector. Also,
your foreign-type would go from (pointer (struct color)) to a
u32vectorwhich means you may have to cast it to a (struct
color*) in C. However, it does make extracting the individual
color-components much easier than having to work with raw blobs.

Because size of an int can generally be either 32 or 64-bit depending on
your architecture, the srfi-4 vectors are possible better suited for floats
and doubles where the sizes are all set. It's worth knowing about them
though.

Cheers,
K.


On Fri, Sep 6, 2013 at 12:23 PM, Chris Mueller ruunsm...@gmail.com wrote:

 On 06.09.2013 09:07, Peter Bex wrote:

 On Fri, Sep 06, 2013 at 08:52:08AM +0200, Chris Mueller wrote:

 Hope its not too basic for you. :)


 Never, user questions are what this mailing list is for!  I hope my
 answers make a little sense.


 Definitely! This is very helpful. I will immediately check and use this.

 Now it also makes sense for me what's one of the intensions behind blobs
 in the documentation/wiki. Never thought it can be used for
 memory allocation in C interfaces :)

 Thanks

 Chris


 __**_
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/**mailman/listinfo/chicken-usershttps://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Compiling with --std=c99 supported?

2013-09-08 Thread Kristian Lein-Mathisen
Hi there,

I came across something I think might be a bug. While I don't have a deep
understanding of what c99 and gnu99 really mean, I noted that this happens
on my 64bit system:

$ chicken -version
(c) 2008-2013, The Chicken Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.8.0.4 (stability/4.8.0) (rev 578619b)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2013-07-15 on aeryn.xorinia.dim (Darwin)
$ cat c99test.scm
(print hi)
$ # gnu99 works:
$ csc -C --std=gnu99 c99test.scm  ./c99test
hi
$ # c99 does not work:
$ csc -C --std=c99 c99test.scm  ./c99test
In file included from c99test.c:11:0:
/usr/include/chicken/chicken.h:1532:1: error: unknown type name ‘sigjmp_buf’
 C_varextern C_TLS sigjmp_buf C_restart;
 ^

Error: shell command terminated with non-zero exit status 256: gcc
c99test.c -o c99test.o -c  -fno-strict-aliasing -fwrapv
-DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer
--std=c99 -I/usr/include/chicken


Is chicken supposed to be compilable with c99?
Thanks,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Basic FFI Principle in Chicken

2013-09-08 Thread Kristian Lein-Mathisen
Ah, of course, John! I got them mixed up.

In that case Chris, I think your color struct might fit quite nicely into a
make-s32vector. I did not test the code below, but something like it might
work:


(define-foreign-type color* s32vector
  (lambda (a) (assert (= 4 (s32vector-length a))) a))

(define color s32vector)
(define (rgb-to-hsl color)
  (let ((return (make-s32vector 3)))
((foreign-lambda*
  void ((color input) (color output))
  rgb_to_hsl((struct color*)input, output[0], output[1],
output[2])) color return)
return))

(rgb-to-hsl (color 0 255 0 0)) ;; -- should in theory return a
   ;; 3-element s32vector with your hue,
   ;; sat and lum.


Note the cast from s32vector (int*) to struct color*.

Cheers,
K.


On Sat, Sep 7, 2013 at 4:33 PM, John Cowan co...@mercury.ccil.org wrote:

 Kristian Lein-Mathisen scripsit:

  Because size of an int can generally be either 32 or 64-bit depending
  on your architecture, the srfi-4 vectors are possible better suited
  for floats and doubles where the sizes are all set. It's worth knowing
  about them though.

 Actually, there are essentially no architectures on which int is
 anything but 32 bits: unless you have an ancient Cray running Unicos
 (modern ones run Linux), a (now-defunct) HAL Systems port of Solaris,
 or an IBM PC/AT, you don't have to worry about that.  What does vary is
 long, which is 32 bits on 32-bit systems and Win64, and 64 bits on
 non-Windows 64-bit systems.

 --
 John Cowanhttp://ccil.org/~cowanco...@ccil.org
 SAXParserFactory [is] a hideous, evil monstrosity of a class that should
 be hung, shot, beheaded, drawn and quartered, burned at the stake,
 buried in unconsecrated ground, dug up, cremated, and the ashes tossed
 in the Tiber while the complete cast of Wicked sings Ding dong, the
 witch is dead.  --Elliotte Rusty Harold on xml-dev

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Compiling with --std=c99 supported?

2013-09-08 Thread Kristian Lein-Mathisen
Ok, I will rewrite my C-code so I don't have to use either of those flags.
Thanks Peter!

K.


On Sun, Sep 8, 2013 at 11:59 PM, Peter Bex peter@xs4all.nl wrote:

 On Sun, Sep 08, 2013 at 11:52:01PM +0200, Kristian Lein-Mathisen wrote:
  Hi there,
 
  I came across something I think might be a bug. While I don't have a deep
  understanding of what c99 and gnu99 really mean, I noted that this
 happens
  on my 64bit system:
 
  $ csc -C --std=c99 c99test.scm  ./c99test
  In file included from c99test.c:11:0:
  /usr/include/chicken/chicken.h:1532:1: error: unknown type name
 ‘sigjmp_buf’
   C_varextern C_TLS sigjmp_buf C_restart;
   ^
 
  Error: shell command terminated with non-zero exit status 256: gcc
  c99test.c -o c99test.o -c  -fno-strict-aliasing -fwrapv
  -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer
  --std=c99 -I/usr/include/chicken
 
  Is chicken supposed to be compilable with c99?

 I'm afraid those options are like the retarded -ansi option, which
 utterly disables any POSIX extensions, accepting only vanilla ANSI C
 code.  And indeed, the docs for -ansi say in C mode, this is equivalent
 to --std=c90.

 IIRC, the way to make this work again is to selectively re-enable POSIX
 extensions by passing some flags like -DPOSIX and such.

 If you can, try to avoid these options unless you're prepared to dig
 deep into compatibility differences.

 Cheers,
 Peter
 --
 http://www.more-magic.net

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] We are looking for projects

2013-09-17 Thread Kristian Lein-Mathisen
I think that should be

https://github.com/chicken-mobile

K.


On Tue, Sep 17, 2013 at 1:54 PM, John Cowan co...@mercury.ccil.org wrote:

 Felix Winkelmann scripsit:

https://github.com/organizations/chicken-mobile

 This just redirects to https://github.com.

 --
 John Cowan   http://www.ccil.org/~cowanco...@ccil.org
 One of the oil men in heaven started a rumor of a gusher down in hell.  All
 the other oil men left in a hurry for hell.  As he gets to thinking about
 the rumor he had started he says to himself there might be something in
 it after all.  So he leaves for hell in a hurry.--Carl Sandburg

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Unix Scripting in Chicken

2013-10-12 Thread Kristian Lein-Mathisen
The wiki has a section on scripts at
http://wiki.call-cc.org/writing%20portable%20scripts which may come in
handy.

You could also have a look under writing scheme scripts on
http://wiki.call-cc.org/man/4/Using%20the%20interpreter .
However, I could not get the arguments to CSI on the shebang-line to work
on my system.

And like Matt said, people would probably be keen to have a look at the
specific problem that you're trying to solve!

K.
 On Oct 12, 2013 6:49 AM, Evan Hanson ev...@foldling.org wrote:

 Hi Danny,

 SCSH was made for just this, and Peter has ported much of it to
 CHICKEN -- have a look at the scsh-process egg:

 http://wiki.call-cc.org/eggref/4/scsh-process

 Evan

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Any hope for new zmq bindings to version 3.2 or even 4.0?

2013-11-25 Thread Kristian Lein-Mathisen
Hi Matt,

Moritz and I had some fun with zmq 3.2 in July. We didn't release our work,
with the reason slipping my mind right now. I think it should be fairy
stable, however. You can find it here:

https://bitbucket.org/DerGuteMoritz/zmq/commits/branch/3.2

K.


On Sun, Nov 24, 2013 at 1:34 AM, Matt Welland estifo...@gmail.com wrote:

 Hi,

 Is anyone (Moritz?) working on new bindings or porting the existing
 bindings for zmq to the newer versions?

 Thanks!
 --
 Matt
 -=-
 90% of the nations wealth is held by 2% of the people. Bummer to be in the
 majority...

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Playing with build utilities for Android

2014-01-02 Thread Kristian Lein-Mathisen
Hi folks,
and happy new year to all!

I have been playing around with some simple build utilities to get Chicken
onto my Android phone (again!).

The fine work https://github.com/chicken-mobile/android-chicken by Bevuta
allows us to build a cross-chicken which can cross-compile eggs and the
Chicken runtime. This is great, but I always spend a lot of time going from
there to getting a Chicken ecosystem running on my app, with eggs and a
repl. So I've played around with automating parts of that and integrating
it with ndk-build.

What I've accomplished so far is basically fewer manual steps when starting
a new Chicken app:

- autodetect package name and android platform when building cross-chicken
(no config-file editing which I always get wrong)
- provide an ndk module for chicken that your jni/main.c can depend on
- make the eggs and unit survive through installation (harder than you
think!)

I'm basing my work on Bevuta's Makefile, and created a new branch here:

https://github.com/chicken-mobile/android-chicken/tree/chicken.mk

I've also scrapped together a gist that should reproduce what I've done so
far. This tries to continue what https://wiki.call-cc.org/embeddingdescribes:

https://gist.github.com/kristianlm/822

I though I'd announce it here in case it turns out to be useful! I'd also
love to hear about similar efforts.
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Playing with build utilities for Android

2014-01-03 Thread Kristian Lein-Mathisen
Thanks for your feedback, Peter.


On Fri, Jan 3, 2014 at 8:30 AM, Peter Bex peter@xs4all.nl wrote:

 On Fri, Jan 03, 2014 at 01:44:41AM +0100, Kristian Lein-Mathisen wrote:
  Hi folks,
  and happy new year to all!
 
  I have been playing around with some simple build utilities to get
 Chicken
  onto my Android phone (again!).

 Hello Kristian,

 Very cool!  Thanks for your continued work in this area.  Hopefuly we
 can get a *convenient* Android build from all this.


Yes, it'd be great to have end up with a simple 3-step guide to get
something up and running. I was able to run the official SDL2 android app
with this. But since I am missing bindings for opengl-es and sdl2, I can't
do much besides exiting the app interactively. But I'm still excited
about that repl in the otherwise empty game-loop.



  The fine work https://github.com/chicken-mobile/android-chicken by
 Bevuta
  allows us to build a cross-chicken which can cross-compile eggs and the
  Chicken runtime.

 But it's not a true cross-compiler, is it?  As I understood it, the
 Android Makefile from Bevuta just cross-compiles CHICKEN itself,
 completely, rather than providing a working csc on the host platform
 which generates executables for the target platform.


If I understand your definition of true cross-compiler, then it is exactly
what Bevuta gaves us: An android-csc and android-chicken-install which will
compile scheme files and eggs for both the host (like x86) and the target
(like arm). So getting eggs into your app is pretty easy, provided that
your egg doesn't have native dependencies or something else that
android-linux-armeabi doesn't like. I have successfully installed:

acorn bitstring channel   clojurian
comparse  coops glm   intarweb   irregex
json  lazy-seq  matchable medea  miscmacros
sendfile  spiffytrie  uri-common uri-generic

But I haven't tried to produce an extensive list.


  This is great, but I always spend a lot of time going from
  there to getting a Chicken ecosystem running on my app, with eggs and a
  repl. So I've played around with automating parts of that and integrating
  it with ndk-build.

 I was hoping someone would do something like that.  It's the natural
 next step, and would simplify building for all these stupid different
 supported architectures.


Yes, but note that I haven't gotten around to that yet. It's just armeabi
for now, and we'll need 1 cross-chicken per such platform which isn't
great. So this still requires (probably many) manual steps.



  What I've accomplished so far is basically fewer manual steps when
 starting
  a new Chicken app:
 
  - autodetect package name and android platform when building
 cross-chicken
  (no config-file editing which I always get wrong)
  - provide an ndk module for chicken that your jni/main.c can depend on
  - make the eggs and unit survive through installation (harder than you
  think!)

 Have you considered simply filing a bugreport for the Android NDK?
 I think the requirement that all .so files must be prefixed with 'lib'
 is pretty bogus.  Hopefully if they do fix it this will be on the NDK
 side, and it could be used even for older devices.


I did not think of that! I will post on their groups and see why it's doing
that. Unfortunately, it's the on-device installer which doesn't extract
non-prefixed files. The libraries are in the apk-file but don't end up
under /data/data/package/lib like they should.

K.



 Thanks again!

 Cheers,
 Peter
 --
 http://www.more-magic.net

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cross-compiling eggs using feature-test

2014-01-15 Thread Kristian Lein-Mathisen
Hi Mario,

crypt.setuphttp://bugs.call-cc.org/browser/release/4/crypt/trunk/crypt.setuphas
some good ideas, thanks!

K.


On Tue, Jan 14, 2014 at 5:44 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Tue, 14 Jan 2014 17:30:04 +0100 Kristian Lein-Mathisen 
 krist...@adellica.com wrote:

  I'm having some trouble compiling the socket egg with my CHICKEN
  cross-compiler. I have a cross-compiler that compiles my eggs for my
  host architecture (x86) and then my target (android):
 
  [user ~]$ aosp-chicken-install socket
 
  # installing for host works:
 
  'host/linux-x86/chicken/bin/aosp-csi' -bnq -setup-mode -e 
  (require-library setup-api) -e (import setup-api) -e 
  (setup-error-handling) -e (extension-name-and-version '(\socket\
  \0.2.5\)) -e (host-extension #t) 'socket.setup'
  'host/linux-x86/chicken/bin/aosp-csc' -feature compiling-extension -
  setup-mode -host socket-features.scm
  ./socket-features  socket-config.scm
 
  # when it reaches target, it fails:
 
  'host/linux-x86/chicken/bin/aosp-csi' -bnq -e (require-library
  setup-api) -e (import setup-api) -e (setup-error-handling) -e 
  (extension-name-and-version '(\socket\ \0.2.5\)) -e 
  (destination-prefix
  \/home/klm/cube/aosp-new/out/target/product/tr1imx6/system/\) -e 
  (runtime-prefix \target/product/tr1imx6/system/\) 'socket.setup'
  'host/linux-x86/chicken/bin/aosp-csc' -feature compiling-extension
  socket-features.scm
  ./socket-features  socket-config.scm
  sh: ./socket-features: cannot execute binary file
 
  Error: shell command failed with nonzero exit status 32256:
 
  ./socket-features  socket-config.scm
 
  In socket.setup, we find these two lines:
 
  (compile socket-features.scm)
  (run (./socket-features  socket-config.scm))
 
  And I think this is the cause of the trouble: The host machine cannot
  execute the compiled target's binary executable to determine its
  features.
 
  Specifying (compile -host socket-features.scm) was tempting, but it
  incorrectly detects my target system to support SO_REUSEPORT which it
  does not.
 
  Are there any good ways to fix this? I have noted the feature-test egg
  uses this method in its documentation too.

 If I understand the problem correctly, eggs can't really try to detect
 target features when running on the host system.  When cross-compiling,
 I think you'll have to specify the features in advance (according to the
 target's profile) and skip the detection.

 The .setup from the crypt egg can be useful as an example.

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Chicken Spring Gathering in Norway

2014-01-30 Thread Kristian Lein-Mathisen
Hey folks!

It's my pleasure to announce that we've decided to host a Chicken gathering
in Norway for this coming spring. Hopefully we can find suitable dates so
that lots of people can come! Let's give doodle a spin around the month of
May:

http://doodle.com/34fh8n88hr4i7edn

Please add yourselves!

We haven't really planned anything specific, except the usual stuff:
- a couple very informal talks
- workshops so people can work on their favorite eggs
- check out the touristy spots of the city
- check out the less touristy spots of the city
- eat and drink beer

You're all very welcome to our beautiful
cityhttp://petuniablogg.blogspot.no/2009/07/abc-i-ord-og-bilder-21.html,
hope to see you there!

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] channel egg: hang on closed channel?

2014-02-26 Thread Kristian Lein-Mathisen
Hi folks!

I'm just starting to look at the channel egg and its nifty API. I've
encoutered some behaviour that I think is a little odd:

(let ((c (make-channel)))
  (close-channel c)
  (channel-receive c))

The code snippet above hangs forever. I would expect channel-receive to
return immediately with its default thunk (#f).

Is this intentional?
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken Spring Gathering in Norway

2014-02-26 Thread Kristian Lein-Mathisen
Hi folks!

It's exciting to see that 8 people have signed up for the CHICKEN gathering
already :D We've also managed to persuade Felix to join us! Time to settle
for dates: Everybody's free on the weekend of Friday 2nd May, so that's
what we went for. However, we decided to extend the event's duration:

Start: Wednesday, April 30th
End: Sunday, May 4th

That's when we've booked rooms at our Uni. Feel free to arrive on Friday
though, if you have a grumpy boss! But 1st of May may be a holiday in your
country, so don't give up too easily :)

We are hoping to attract some Scheme newcomers from the local student
community. Please contact us if you would like to have talks or if you know
someone who might!

I hope that more people still will sign up on the event wiki:
https://wiki.call-cc.org/event/chicken-spring-norway-2014
K.


On Thu, Jan 30, 2014 at 5:20 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 On Thu, 30 Jan 2014 17:05:25 +0100 Kristian Lein-Mathisen 
 krist...@adellica.com wrote:

  It's my pleasure to announce that we've decided to host a Chicken
  gathering in Norway for this coming spring. Hopefully we can find
  suitable dates so that lots of people can come! Let's give doodle a
  spin around the month of May:
 
  http://doodle.com/34fh8n88hr4i7edn
 
  Please add yourselves!
 
  We haven't really planned anything specific, except the usual stuff:
  - a couple very informal talks
  - workshops so people can work on their favorite eggs
  - check out the touristy spots of the city
  - check out the less touristy spots of the city
  - eat and drink beer
 
  You're all very welcome to our beautiful city, hope to see you there!

 Excellent news, Kristian!  Thanks for hosting the gathering.  I've added
 it to http://wiki.call-cc.org/events

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Why is it called Chicken?

2014-03-04 Thread Kristian Lein-Mathisen
Hi Daniel,

There's an interview with
Felixhttp://spin.atomicobject.com/2013/05/02/chicken-scheme-part-1/that
might answer your question:

*One last question: What inspired the names CHICKEN and SPOCK? Do they mean
 anything, aside from the bird and the well-known Star Trek character?*

 That question always comes up, sooner or later. ;-)

 I had a plastic toy of Feathers McGraw on my desk, the evil penguin
 (disguised as a chicken!) from the Wallace and Gromit movie, “The Wrong
 Trousers.” Looking for a preliminary working title for the compiler, I used
 the first thing that came to my mind that day. I’m somewhat superstitious
 about names for software projects, and things were progressing well, so I
 didn’t dare to change the name.


K.



On Tue, Mar 4, 2014 at 3:22 PM, Daniel Carrera dcarr...@gmail.com wrote:

 Perhaps a silly question, but I'm curious. Why is Chicken Scheme called
 Chicken?

 Cheers,
 Daniel.
 --
 When an engineer says that something can't be done, it's a code phrase
 that means it's not fun to do.

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] LevelDB bindings

2014-04-20 Thread Kristian Lein-Mathisen
Hey Caolan,

And welcome to the Chicken community! Your leveldb eggs seems pretty well
written, nice work! Not much to comment on, but I'll put down what I noted
as I quickly browsed through the code.

Have you looked at the bind egg? It may help you out with basic C++
bindings for things like class instantiation, methods and fields.

In your leveldb.setup file, you can use capital -j and leave out the module
name.

In you call-with-db definition, you could probably do the same with less
code using dynamic-wind.

And a quick note on naming conventions. I noted you've got things like
strings-slice, where the return value needs to be freed with delete-slice.
Since that's just private api, I'm sure you'll get away with it. I wonder
though, if there's a a way to indicate you need to be careful. Perhaps a %
prefix or * postfix might be suitable.

Or perhaps a call-with-slice convention that always deletes with
dynamic-wind might be suitable? I don't know its performance properties,
though.

Same for check-status, which deletes its argument with delete-status.
Perhaps a ! postfix, ie check-status!?

I hope I can get to play around with leveldb and thus egg at some point!
Thanks for your contribution!

K.
On Apr 20, 2014 3:00 PM, Caolan McMahon caolan.mcma...@gmail.com wrote:

 Hi all,

 I'm new to the list (and CHICKEN) *waves*

 I thought I'd have a go at writing an egg and put together some
 bindings to Google's LevelDB embedded key/value store. I've published
 it at https://github.com/caolan/chicken-leveldb

 Can someone please help me with getting it onto the egg index? I'd
 also appreciate any advice people have on coding style / egg layout
 etc. since I'm still getting the hang of this.

 Thanks,

 Caolan

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken Spring Gathering in Norway

2014-05-07 Thread Kristian Lein-Mathisen
Hi folks!

I would just like to thank everybody who attended the Viking CHICKEN
spring event last week for a wonderful time! Thanks to everyone for making
the event into what it became. Peder and I really enjoyed having such a
friendly and skilled (and opinionated!) bunch of programmers over. The
CHICKEN community is truly remarkable!

To everyone who couldn't attend, I hope you will be able to join us next
time! Which, hopefully, won't be in too long. Until then, guys!

K.


On Wed, Feb 26, 2014 at 6:39 PM, Kristian Lein-Mathisen 
krist...@adellica.com wrote:



 Hi folks!

 It's exciting to see that 8 people have signed up for the CHICKEN
 gathering already :D We've also managed to persuade Felix to join us! Time
 to settle for dates: Everybody's free on the weekend of Friday 2nd May, so
 that's what we went for. However, we decided to extend the event's duration:

 Start: Wednesday, April 30th
 End: Sunday, May 4th

 That's when we've booked rooms at our Uni. Feel free to arrive on Friday
 though, if you have a grumpy boss! But 1st of May may be a holiday in your
 country, so don't give up too easily :)

 We are hoping to attract some Scheme newcomers from the local student
 community. Please contact us if you would like to have talks or if you know
 someone who might!

 I hope that more people still will sign up on the event wiki:
 https://wiki.call-cc.org/event/chicken-spring-norway-2014
 K.


 On Thu, Jan 30, 2014 at 5:20 PM, Mario Domenech Goulart 
 mario.goul...@gmail.com wrote:

 On Thu, 30 Jan 2014 17:05:25 +0100 Kristian Lein-Mathisen 
 krist...@adellica.com wrote:

  It's my pleasure to announce that we've decided to host a Chicken
  gathering in Norway for this coming spring. Hopefully we can find
  suitable dates so that lots of people can come! Let's give doodle a
  spin around the month of May:
 
  http://doodle.com/34fh8n88hr4i7edn
 
  Please add yourselves!
 
  We haven't really planned anything specific, except the usual stuff:
  - a couple very informal talks
  - workshops so people can work on their favorite eggs
  - check out the touristy spots of the city
  - check out the less touristy spots of the city
  - eat and drink beer
 
  You're all very welcome to our beautiful city, hope to see you there!

 Excellent news, Kristian!  Thanks for hosting the gathering.  I've added
 it to http://wiki.call-cc.org/events

 Best wishes.
 Mario
 --
 http://parenteses.org/mario



___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] opengl-glew version 0.4.0

2014-05-12 Thread Kristian Lein-Mathisen
Exciting work, Alex!

I'm really looking forward to look into this. Hoping I'll have time to do
so now. And I'm glad the glm egg was useful, even with the documentation
lacking as it is. gl-math looks nice and lightweight, did you write
hypermath.c yourself?

Do you have some insight on how much work is needed to make the opengl-glew
egg compile for OpenGL ES?

K.


On Mon, May 12, 2014 at 12:53 AM, Alex Charlton
alex.n.charl...@gmail.comwrote:


 Hello all,

 I figured I’d announce this new version of my opengl-glew egg, as it
 contains significant new features./

 Aside from some minor improvements, version 0.4.0 adds two new modules:
 gl-math and gl-utils.

 gl-math provides functions primarily for manipulating matrices, much like
 those that are contained in the now deprecated GLU. The glm egg also
 provides similar functionality (and honestly, I probably wouldn’t have
 written gl-math if I had known that glm had camera and projection creation
 functions), but gl-math is more light-weight and fully documented. Not to
 put down glm in any way, though, as it was enormously useful in getting
 things going for me.

 gl-utils contains two main pieces of functionality at the moment: a helper
 for creating VAOs, and PLY loading. Having these tools makes loading and
 rendering models quite easy.

 For complete information, check out the docs:

 https://wiki.call-cc.org/eggref/4/opengl-glew

 --
 Alex


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] bug update-uri in uri-common

2014-05-13 Thread Kristian Lein-Mathisen
Hi guys,

I have come across som a bug or unintuitive behaviour in uri-common. The
port parameter is reset on update-uri. uri-generic works like expected:

csi -R uri-generic
#;1 (update-uri (make-uri port: 100) scheme: 'http)
#(URI scheme=http authority=#(URIAuth host=#f port=100) path=() query=#f
fragment=#f)

however, uri-common sets the port back to #f:

csi -R uri-common
#;1 (update-uri (make-uri port: 100) scheme: 'http)
#URI-common: scheme=http port=#f host=#f path=#f query=#f fragment=#f

I'm expecting to see port: 100 in the updated uri. A fairly simple
workaround is, of course, adding port: (uri-port original-uri) but I
thought I'd point this out.

Thanks,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bug update-uri in uri-common

2014-05-13 Thread Kristian Lein-Mathisen
Hmmm ... The scheme is changed, like you say, but the port is too, from 100
to #f, which is what I find surprising.

I cannot seem to find a way to update the uri without loosing the port.
What am doing wrong here?

K.
On May 13, 2014 1:48 PM, Peter Bex peter@xs4all.nl wrote:

 On Tue, May 13, 2014 at 01:38:16PM +0200, Kristian Lein-Mathisen wrote:
  Hi guys,
 
  I have come across som a bug or unintuitive behaviour in uri-common. The
  port parameter is reset on update-uri. uri-generic works like expected:
 
  csi -R uri-generic
  #;1 (update-uri (make-uri port: 100) scheme: 'http)
  #(URI scheme=http authority=#(URIAuth host=#f port=100) path=() query=#f
  fragment=#f)
 
  however, uri-common sets the port back to #f:
 
  csi -R uri-common
  #;1 (update-uri (make-uri port: 100) scheme: 'http)
  #URI-common: scheme=http port=#f host=#f path=#f query=#f fragment=#f
 
  I'm expecting to see port: 100 in the updated uri. A fairly simple
  workaround is, of course, adding port: (uri-port original-uri) but I
  thought I'd point this out.

 I don't remember exactly, but I think this is intended behaviour.
 This allows you to switch from http to https without also having to
 update the port to something else.

 Cheers,
 Peter
 --
 http://www.more-magic.net

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bug update-uri in uri-common

2014-05-13 Thread Kristian Lein-Mathisen
A, of course, now I understand what you were trying to tell me previously.
That makes sense. Thanks for clarifying, Peter.

In my particular use-case, I am changing to a custom scheme and this port
clear on scheme change feature made me scratch my head for a while (but
that happens quite often, so is no indicator if whether the api is
intuitive or not!). So if we were to vote, it'd put my two cents on not
modifying the port unless explicitly stated (if it's already #f it's still
work like you'd expect).

K.
On May 13, 2014 11:28 PM, Peter Bex peter@xs4all.nl wrote:

 On Tue, May 13, 2014 at 11:25:23PM +0200, Kristian Lein-Mathisen wrote:
  Hmmm ... The scheme is changed, like you say, but the port is too, from
 100
  to #f, which is what I find surprising.
 
  I cannot seem to find a way to update the uri without loosing the port.
  What am doing wrong here?

 Try updating it simultaneously.  This should work:

 (update-uri foo scheme: 'http port: 100)

 The idea is that you'd rarely want to switch to an entirely different
 protocol on the same port anyway, so the sane thing to do is reset it to
 the default.

 If this doesn't work either, it would be a bug.

 Cheers,
 Peter
 --
 http://www.more-magic.net

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] New egg: glls

2014-05-15 Thread Kristian Lein-Mathisen
Great work, Alex! You beat me to it ;)

Really looking forward to play around with this! It will be really
interesting to see what dynamic shaders can do for games or other visually
intensive application.

K.
On May 15, 2014 1:48 PM, Andy Bennett andy...@ashurst.eu.org wrote:

 Hi,

  I'm pleased to announce glls

 Wow! Nice. :-) Good work.





 Regards,
 @ndy

 --
 andy...@ashurst.eu.org
 http://www.ashurst.eu.org/
 0x7EBA75FF


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] New egg: physics

2014-05-16 Thread Kristian Lein-Mathisen
Welcome to the coop, Richard! And what an extensive first-egg, nice work!

I started the acorn https://github.com/kristianlm/acorn egg a while back,
but I just hammered on chipmunk.h until it worked. Then I added some
convenience functions (like nodeshttps://github.com/kristianlm/acorn#nodes),
but these were never fully complete. Your way is much better: the way of
the macro. Looking forward to have a look at it and use it for some of my
games and experiments!

Very thorough work, keep it up!
K.


On Fri, May 16, 2014 at 3:09 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 On Fri, 16 May 2014 02:02:01 + Mario Domenech Goulart 
 mario.goul...@gmail.com wrote:

  However, for local installations (i.e., cd egg-source-dir;
  chicken-install), egg versions will be set as unknown if they are
  not specified in .setup files.  chicken-setup is oblivious to VCS tags
  and tag directories -- only henrietta-cache and henrietta care about
  them.

 s/chicken-setup/chicken-install/.  Should muscle memory last for so
 long?  I'm getting worried about my sanity.

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] new egg: nrepl

2014-05-21 Thread Kristian Lein-Mathisen
Hi!

I've created a very simple egg that exposes a simple REPL over TCP
connections. I've called it nrepl. Naming conflicts with Clojure's
deprecated nrepl hopefully won't be a problem.

I'm thinking this may be handy enough for debugging that it might be part
of the official egg index. Have a look here:

https://github.com/Adellica/chicken-nrepl

Thanks!
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: nrepl

2014-05-22 Thread Kristian Lein-Mathisen
Thanks, Mario! I've added documentation on the
wikihttps://wiki.call-cc.org/eggref/4/nrepl
.

K.


On Wed, May 21, 2014 at 2:39 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Wed, 21 May 2014 14:26:37 +0200 Kristian Lein-Mathisen 
 krist...@adellica.com wrote:

  I've created a very simple egg that exposes a simple REPL over TCP
  connections. I've called it nrepl. Naming conflicts with Clojure's
  deprecated nrepl hopefully won't be a problem.
 
  I'm thinking this may be handy enough for debugging that it might be
  part of the official egg index. Have a look here:
 
  https://github.com/Adellica/chicken-nrepl

 Neat!  I've added it to the coop.

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: nrepl

2014-05-22 Thread Kristian Lein-Mathisen
Yes, indeed, the current implementation is very simple.

I've added your comments as issues on
githubhttps://github.com/Adellica/chicken-nrepl/issues.
I won't have to to look into it now, unfortunately.

K.


On Wed, May 21, 2014 at 2:38 PM, Alaric Snell-Pym
ala...@snell-pym.org.ukwrote:

 On 21/05/14 13:26, Kristian Lein-Mathisen wrote:
 
  Hi!
 
  I've created a very simple egg that exposes a simple REPL over TCP
  connections. I've called it nrepl. Naming conflicts with Clojure's
  deprecated nrepl hopefully won't be a problem.
 
  I'm thinking this may be handy enough for debugging that it might be
  part of the official egg index. Have a look here:
 
  https://github.com/Adellica/chicken-nrepl

 I like it. I've wanted one of these for ages, but never gotten around to
 writing my own.

 Feature request: parameterize what it uses for eval so people can
 supply special environments, sandbox, sanity-check the sexprs, log them,
 etc. with suitable wrapping procedures :-)

 TLS support, and an optional connection authentication parameterized
 procedure to handle a login process (given the tcp socket on
 current-input/output-port and able to return #t to continue or #f to
 close the connection and abort), would be the next feature request for
 use in less trusted environments!

 
  Thanks!
  K.
 

 Good work that man,

 ABS

 --
 Alaric Snell-Pym
 http://www.snell-pym.org.uk/alaric/


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: nrepl

2014-05-22 Thread Kristian Lein-Mathisen
Oh, of course, Cider is just for Emacs, thanks for the clarification!

K.


On Thu, May 22, 2014 at 4:57 PM, Stephen Gilardi scgila...@gmail.comwrote:


 On May 21, 2014, at 8:26 AM, Kristian Lein-Mathisen krist...@adellica.com
 wrote:

 I've created a very simple egg that exposes a simple REPL over TCP
 connections. I've called it nrepl. Naming conflicts with Clojure's
 deprecated nrepl hopefully won't be a problem.


 There’s probably little chance of someone confusing the two, but I don’t
 think that Clojure’s nrepl (https://github.com/clojure/tools.nrepl) is
 deprecated. It’s still maintained and widely used.

 There was an associated emacs package (nrepl.el) that’s been renamed and
 expanded as the “cider” package: https://github.com/clojure-emacs/cider .
 It uses tools.nrepl.

 Cheers,

 —Steve


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bug update-uri in uri-common

2014-05-28 Thread Kristian Lein-Mathisen
I realize I already put down my vote, but I'd like to promote my case after
some thought. I guess what we're trying to find out is what's more
troublesome and/or surprising:

1. having to set the port explicitly (to #f?) when you want to change the
scheme and its port
2. having to set the port explicitly back to its original value if you want
to change scheme but not its port

I don't think it's unreasonable to expect the user to realize he/she has to
change the port if he/she changes the port (as in 1.). That requires an
understanding of the relationship between scheme and port by the user.

I do, however, think it's more unreasonable to expect the user to realize
he/she has to change the port back to its original value if he wants to
change the scheme but not the port. In this case, you need to understand
the internals of uri-common. (You need to understand the scheme-port
relationship as well to make sense of the API). I also think it's
unfortunate that you cannot simply look at the keywords in update-uri and
know exactly which fields are modified by quick glance.

Thanks for considering the change :) my vote's on 1.
K.


On Fri, May 16, 2014 at 3:35 PM, Andy Bennett andy...@ashurst.eu.orgwrote:

 On Friday, 16 May 2014 14:28:51 BST, Andy Bennett wrote:

 Hi,

  If anyone on this mailinglist has strong opinions either way, please let
 yourselves be heard: now's the time to speak up.


 The existing behaviour seems reasonable as it only does it when setting
 scheme, not when setting other parts of the URI:

 -
 #;3 (update-uri (uri-reference http://localhost:8080/;) scheme: 'https)
 #URI-common: scheme=https port=#f host=localhost path=(/ ) query=()
 fragment=#f
 #;4 (update-uri (uri-reference http://localhost:8080/;) fragment:
 test)
 #URI-common: scheme=http port=8080 host=localhost path=(/ ) query=()
 fragment=test
 -




 Regards,
 @ndy

 --
 andy...@ashurst.eu.org
 http://www.ashurst.eu.org/
 0x7EBA75FF

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bug update-uri in uri-common

2014-06-10 Thread Kristian Lein-Mathisen
If we go for (b), we could also provide a normalize-uri-port which sets it
to #f if it's already equal to the default port of its scheme. And perhaps
an optional normalize? argument to the uri-string procedure?

K.


On Sun, Jun 8, 2014 at 8:16 PM, Evan Hanson ev...@foldling.org wrote:

 On 2014-06-08 11:14, Peter Bex wrote:
  On Sat, Jun 07, 2014 at 09:01:01PM -0400, John Cowan wrote:
   Peter Bex scripsit:
  
c) The port should not be reset, but the uri should be printed
 without
port if it's the default for this scheme.
  
   +1 for (c).
 
  hm, but if you really want to print http://foo:80/blabla, how
  should that work?

 In that case I don't think it's unreasonable to expect the user to
 define their own function to build a string from the URI's composite
 parts. We have to pick a default behavior one way or the other, and
 without the port seems like the better one to me.

 Regards,

 Evan

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bug update-uri in uri-common

2014-06-16 Thread Kristian Lein-Mathisen
Thank you Peter!

With some manual testing, it's working like expected here.

K.


On Sat, Jun 14, 2014 at 3:11 PM, Peter Bex peter@xs4all.nl wrote:

 On Sat, Jun 07, 2014 at 02:19:22PM +0200, Peter Bex wrote:
  So here's a new poll:
 
  a) The current behaviour of resetting port to #f if it's the default port
   for this scheme is ok.
  b) The port should not be reset, and the uri should be printed with an
  explicit port, even if it's the default for this scheme.
  c) The port should not be reset, but the uri should be printed without
  port if it's the default for this scheme.

 I have now implemented c), and tagged release 1.4.  Please give it a try!

 Kris, thanks for reporting this problem.  Thanks Andy, John and Evan
 for supplying valuable feedback.  Doing the right thing was tricky here.

 Cheers,
 Peter
 --
 http://www.more-magic.net

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] T-DOSE 2014?

2014-06-20 Thread Kristian Lein-Mathisen
Hello Peter,

Great initiative! Me and Peder would like to participate as well.

K.
On Jun 20, 2014 11:48 AM, Richard plui...@freeshell.de wrote:

 Hello Peter,

 I would be interested in volunteering for booth duty.

 greetings,
 Pluizer

 On 06/20/14 10:47, Peter Bex wrote:

 Hi all,

 I got an email from the T-DOSE organisation stating they're hoping we'll
 have a booth and/or presentations at this year's T-DOSE (held on the
 25 and 26th of October).  The CFP is here: http://www.t-dose.org/2014/cfp

 Last year I had to cancel our booth due to a lack of interest from the
 community (I just attended T-DOSE as a visitor).  If anybody else is
 interested in joining up for booth duty this year, I'll request a
 project booth for us.  Of course if people would like to talk about
 the awesomeness that is CHICKEN, that would be great too!

 Cheers,
 Peter



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Live programming with Chicken

2014-07-02 Thread Kristian Lein-Mathisen
Hi Pluizer,

I've tried to make a poll-based repl like you're talking about for the same
purpose. Have a look here and see if that helps:

https://github.com/Adellica/prepl

K.


On Wed, Jul 2, 2014 at 12:40 PM, Richard plui...@freeshell.de wrote:

 Hello, I wanted to do some live game programming with Chicken Scheme. I
 would like to adjust my game whilst it is running a game loop. I tried
 srfi-18 threads for this but found it to be too unwieldy. So I wondered if
 there is a way to process the repl inside the loop. An example of what I
 would like:

 (let loop ()
 (process-repl) ; - this
 (unless (do-game-stuff) (loop)))

 I could not find if anything like this exists. Does anybody know of a way?

 thanks,
 Pluizer

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Live programming with Chicken

2014-07-03 Thread Kristian Lein-Mathisen
That is strange, I've experienced alex's problem too - having to yield a
little to give the REPL some room.

Anyhow, for others who might come across this thread: alex's idea works
great, but you need to be careful with blocking IO on your REPL. If you
don't use parley http://api.call-cc.org/doc/parley or something similar,
chances are that your REPL srfi-18-thread will block your
srfi-18-game-thread while it's waiting for IO.

K.


On Wed, Jul 2, 2014 at 9:07 PM, John Cowan co...@mercury.ccil.org wrote:

 alex scripsit:

  I had some trouble with this last part at first: the original thread
  waited several seconds before evaluating my input. I think that the
  fix was nothing more than calling thread-yield! every loop
  iteration.

 If you are depending on thread-yield! for correctness rather than
 efficiency, you are doing something wrong (but I don't know what).
 SRFI 18 schedulers are not required to be fair in any way.

 --
 John Cowan  http://www.ccil.org/~cowanco...@ccil.org
 He that would foil me must use such weapons as I do, for I have not
 fed my readers with straw, neither will I be confuted with stubble.
 --Thomas Vaughan (1650)

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Chicken-hackers] CHICKEN in production

2014-09-30 Thread Kristian Lein-Mathisen
Cool! We'll be launching a product soon as well, with the heart of the
system running Chicken. We'll post it here in case anyone is interested.

Thanks for sharing!
K.
On Sep 30, 2014 12:22 PM, Felix Winkelmann felix.winkelm...@bevuta.com
wrote:

 From: r d...@bk.ru
 Subject: [Chicken-hackers] CHICKEN in production
 Date: Tue, 30 Sep 2014 01:07:43 +0400

  Hello
 
  happy to announce that we are in production with CHICKEN!
 
  Professional karaoke system AST-50 with CHICKEN driven firmware.
 
  http://www.art-system.ru/professionalnoe-karaoke/ast-50.html
 
  Feel free to ask Oleg Kolosov, Yaroslav Tsarko and me about wonderful
  and dangerous trip to the parentheses land.

 Yay! Thanks for sharing this with us.


 felix

 ___
 Chicken-hackers mailing list
 chicken-hack...@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-hackers

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] How to compile with openssl?

2014-10-07 Thread Kristian Lein-Mathisen
Hi Sascha,

which CHICKEN version are you using?

There is a bug in some older versions where you need to specify (use
chicken-syntax) for it work in compiled modules. Does that help?

K.

On Tue, Oct 7, 2014 at 2:25 PM, Arthur Maciel arthurmac...@gmail.com
wrote:

 Sascha, putting (use openssl) in your code makes any difference?

 Best wishes,
 Arthur


 2014-10-07 9:16 GMT-03:00 Sascha Ziemann cev...@gmail.com:



 2014-10-07 13:48 GMT+02:00 Peter Bex peter@xs4all.nl:


 You'll need to ensure that openssl is available to the application.
 Like the error message says, all you need to do is ensure that it's
 installed and it'll work.  If you're using -deploy, make sure that you
 add the egg to your application bundle.  If you're using a custom egg
 repository, ensure that openssl is in there.


 I run the interpreted and compiled version on the same system. How can
 the egg not being there for the compiled version, if it is there for the
 interpreted version?

 I tried strace on the interpreted and the compiled version. The funny
 thing is, that the compiled version opens libssl and after that reports the
 error that openssl is not available.

 $ strace ./domrobot 127.0.0.1 21|grep ssl
 stat64(/var/lib//chicken/6/openssl.so, {st_mode=S_IFREG|0755,
 st_size=251089, ...}) = 0
 stat64(/var/lib//chicken/6/openssl, 0xbff9239c) = -1 ENOENT (No such
 file or directory)
 stat64(/var/lib//chicken/6/openssl.so, {st_mode=S_IFREG|0755,
 st_size=251089, ...}) = 0
 open(/var/lib//chicken/6/openssl.so, O_RDONLY) = 3
 open(/usr/lib/i586/libssl.so.1.0.0, O_RDONLY) = -1 ENOENT (No such file
 or directory)
 open(/usr/lib/libssl.so.1.0.0, O_RDONLY) = -1 ENOENT (No such file or
 directory)
 open(/usr/lib/i586/libssl.so.1.0.0, O_RDONLY) = -1 ENOENT (No such file
 or directory)
 open(/usr/lib/libssl.so.1.0.0, O_RDONLY) = -1 ENOENT (No such file or
 directory)
 open(/usr/lib/i386-linux-gnu/i586/libssl.so.1.0.0, O_RDONLY) = 3
 write(2, (ssl-connect) Unable to connect ..., 94(ssl-connect) Unable to
 connect over HTTPS. To fix this, install the openssl egg and try again) = 94

 csi opens just the same lib:

 $ grep /usr/lib/i386-linux-gnu/i586/libssl.so.1.0.0 *.trace
 csc.trace:open(/usr/lib/i386-linux-gnu/i586/libssl.so.1.0.0, O_RDONLY)
 = 3
 csi.trace:open(/usr/lib/i386-linux-gnu/i586/libssl.so.1.0.0, O_RDONLY)
 = 4

 I do not think that my system installation is broken. I think csi and csc
 do different things with libssl.

 Regards,
 Sascha


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] new egg: bindings for nanomsg

2014-10-09 Thread Kristian Lein-Mathisen
Hi folks!

I've just played around with nanomsg which I really like. It fits really
nice into Chicken's inner workings, with it's new file-descriptors which
you can poll().

So I've started creating some bindings, and though it might be enough for
an egg. Please look over it and add it to the coop!

Thanks,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: bindings for nanomsg

2014-10-10 Thread Kristian Lein-Mathisen
Gosh, how silly of me. It was a long day yesterday.

Yes, Evan, please use that release-info file!

Thanks,
K.

On Fri, Oct 10, 2014 at 2:09 AM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Fri, 10 Oct 2014 01:29:08 +0200 Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:

  I've just played around with nanomsg which I really like. It fits
  really nice into Chicken's inner workings, with it's new
  file-descriptors which you can poll().
 
  So I've started creating some bindings, and though it might be enough
  for an egg. Please look over it and add it to the coop!

 Do you have an URI to share?

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
Hi folks!

I have lately been working on an egg for thread-safe message passing, and
this is my first attempt:

https://github.com/Adellica/chicken-gochan

I've decided to go with the relatively well-established channel-API of
GoLang since I don't really know what I'm doing. This implementation is
based on Alex Shinn's channel.scm from Chibi Scheme.

Please add it to the coop, and please try it out!

Cheers,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
Hi,

Sorry about that! Should be fixed now. Do I need to release a new version
of gochan?

I will fix nanomsg asap.
K.

On Wed, Oct 22, 2014 at 12:40 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Wed, 22 Oct 2014 11:04:42 +0200 Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:

  I have lately been working on an egg for thread-safe message passing,
  and this is my first attempt:
 
  https://github.com/Adellica/chicken-gochan
 
  I've decided to go with the relatively well-established channel-API of
  GoLang since I don't really know what I'm doing. This implementation
  is based on Alex Shinn's channel.scm from Chibi Scheme.
 
  Please add it to the coop, and please try it out!

 Cool.  Thanks for sharing your work.

 salmonella reports a couple of issues with gochan:

 - Missing egg category
 - Missing license
 - Test failure (missing dependency on test, at least)

 BTW, have you seen http://bugs.call-cc.org/ticket/1163 ?

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
 Just make sure the latest tag specified in .release-info points to a
 working state.


Fixed! For both nanomsg and gochan.

K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
I see. I wanted to be explicit about it having no other dependencies except
core ones. I'll do some rewording!

Thank you,
K.

On Wed, Oct 22, 2014 at 1:39 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 On Wed, 22 Oct 2014 11:38:37 + Mario Domenech Goulart 
 mario.goul...@gmail.com wrote:

  On Wed, 22 Oct 2014 13:22:18 +0200 Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:
 
  Just make sure the latest tag specified in .release-info points to
  a working state.
 
  Fixed! For both nanomsg and gochan.
 
  Excellent.  Thank you.

 Forgot the most important part: your egg has been added to the coop.
 Thanks again. :-)

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new egg: arrays

2014-10-28 Thread Kristian Lein-Mathisen
Hi Juergen!

Is it possible you've made the same mistake I did with my last
egg-announcement, forgetting to provide a URL for us?

K.
On Oct 28, 2014 5:03 PM, Juergen Lorenz j...@jugilo.de wrote:

 Hi all,
 I've just uploaded a new egg, arrays, which contains an implementation
 of functional arrays, which -- like vectors -- allow fast access to its
 stored items, but -- unlike vectors -- can shrink and grow as needed.
 As an application, an implementation of sets is provided.
 Please give the library a try.
 Best regards
 Juergen

 --

 Dr. Juergen Lorenz
 Flensburger Str. 12
 10557 Berlin

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] crypt egg: won't compile for Android

2014-11-02 Thread Kristian Lein-Mathisen
Hi all,

Android, I believe, like OpenBSD, has no libcrypt.so but still has support
for the crypt function. The crypt.setyp has already support for removing
the -lcrypt flag during compilation and injecting android into that seems
to do the trick:

diff --git a/crypt.setup b/crypt.setup
index eeaf1d5..9dac09a 100644
--- a/crypt.setup
+++ b/crypt.setup
@@ -28,2 +28,3 @@ EOF
 (openbsd #f)
+(android #f)
 (else #t)

Could someone fix this upstream if this patch is acceptable?
Thank you!
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] crypt egg: won't compile for Android

2014-11-02 Thread Kristian Lein-Mathisen
Perfect, thank you!

K.
On Nov 2, 2014 4:01 PM, Peter Bex peter@xs4all.nl wrote:

 On Sun, Nov 02, 2014 at 02:43:38PM +0100, Kristian Lein-Mathisen wrote:
  Hi all,
 
  Android, I believe, like OpenBSD, has no libcrypt.so but still has
 support
  for the crypt function. The crypt.setyp has already support for removing
  the -lcrypt flag during compilation and injecting android into that
 seems
  to do the trick:

 Hi Kris,

 Thanks for reporting this!  I've just released crypt 0.4.3 which
 includes the change.

 Cheers,
 Peter
 --
 http://www.more-magic.net

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Why there is no nil?

2014-12-17 Thread Kristian Lein-Mathisen
Hi Bahman,

I just thought I'd add that the only thing that evaluates to false in
Scheme is #f.

K.
On Dec 17, 2014 9:42 AM, Christian Kellermann ck...@pestilenz.org wrote:

 * Bahman Movaqar bah...@bahmanm.com [141217 09:35]:
  I'm curious to know why nil is not defined in CHICKEN and one has to
  use '() instead? TIA,
 
  PS: Or am I missing something ridiculously obvious!?

 This is scheme not lisp. nil is not defined in R5RS scheme.
 And I think it is not defined in R6RS or R7RS either.

 Kind regards,

 Christian

 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Happy Christmas

2014-12-29 Thread Kristian Lein-Mathisen
I'm a little late too!

I also want to wish everyone a wonderful vacation. And a happy new year
with many blessings!

K.
On Dec 29, 2014 9:15 PM, Pedro Melendez pmelen...@pevicom.com wrote:

 Is it too late to join to the Happy holidays sentiment?

 I hope you guys had (and/or are having) a great holiday season.

 Cheers,

 Pedro.

 On Mon, Dec 29, 2014 at 1:56 PM, Kevin Wortman kwort...@gmail.com wrote:

 Happy holidays from California, USA!

 Cheers,
 Kevin Wortman

 On Sat, Dec 27, 2014 at 1:06 AM, Karel Miklav ka...@lovetemple.net
 wrote:

 Happy holidays Felix, the rest of the Chicken team and everybody else on
 this list.

 Thank you for the good work!

 Karel

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users




 --
 T: +1 (416) - 357.5356
 Skype ID: pmelendezu



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Homepage design proposal

2015-01-23 Thread Kristian Lein-Mathisen
Yeah, that makes sense. I guess we're stuck with a server-side solution
unless we can get Chicken running on this little emulator
http://bellard.org/jslinux/. repl.it may be of inspiration!

Thanks,
K.

On Fri, Jan 23, 2015 at 1:08 PM, Yaroslav Tsarko eriktsa...@googlemail.com
wrote:

  Kristian,

 On 23.01.2015 14:34, Kristian Lein-Mathisen wrote:

  Has anybody played with the idea of compiling CHICKEN with emscripten
 http://emscripten.org/? That way, we could have a client-side REPL to
 experiment with on the homepage.


 As far as I could understand it, one does not simply compile CHICKEN using
 emscripten because of setjmp/longjmp (according to this page:
 http://kripken.github.io/emscripten-site/docs/porting/guidelines/portability_guidelines.html)
 without special porting.

 Thanks,
 Yaroslav

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-19 Thread Kristian Lein-Mathisen
Hi guys,

It's been way too long! I'm running CHICKEN 4.9.0.1 and the openssl-egg
segfaults at ssl-load-certificate-chain! and friends.

I have two patches/suggestions:
- remove home path expansion
- use the pathname-expand egg

I need either of these patches to make openssl not segfault on my system.
Any chance of fixing this upstream?

Thanks!
K.
From 8aeb5252f681d472816dc84e6f00f284ce8aa3c9 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen kristianl...@gmail.com
Date: Tue, 19 May 2015 13:22:22 +0200
Subject: [PATCH] bugfix: no home-path expansion

because `##sys#expand-home-path` was removed in something like
4.9.0.1. this variable is unbound and causes a segfault (OBS! no error
saying that ##sys#expand-home-path is not available)
---
 openssl.scm | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/openssl.scm b/openssl.scm
index db693fe..9e2d57a 100644
--- a/openssl.scm
+++ b/openssl.scm
@@ -42,8 +42,7 @@
##sys#current-thread
##sys#size
##sys#setslot
-   ##sys#check-string
-   ##sys#expand-home-path))
+   ##sys#check-string))
 
 (use srfi-18 tcp)
 
@@ -583,7 +582,7 @@ EOF
   (unless (eq?
 	   ((foreign-lambda
 	 int SSL_CTX_use_certificate_chain_file c-pointer c-string)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname))
+	(ssl-unwrap-context obj) pathname)
 	   1)
 (ssl-abort 'ssl-load-certificate-chain! #f pathname)))
 
@@ -602,7 +601,7 @@ EOF
 	   return(SSL_CTX_use_PrivateKey_file(
 	(SSL_CTX *)ctx, path, 
 	(asn1 ? SSL_FILETYPE_ASN1 : SSL_FILETYPE_PEM)));\n)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname)
+	(ssl-unwrap-context obj) pathname
 	rsa? asn1?)
 	   1)
 (ssl-abort 'ssl-load-private-key! #f pathname rsa? asn1?)))
@@ -626,8 +625,8 @@ EOF
 	   ((foreign-lambda
 	 int SSL_CTX_load_verify_locations c-pointer c-string c-string)
 	(ssl-unwrap-context obj)
-	(if pathname (##sys#expand-home-path pathname) #f)
-	(if dirname (##sys#expand-home-path dirname) #f))
+	(if pathname pathname #f)
+	(if dirname dirname #f))
 	   1)
 (ssl-abort 'ssl-load-verify-root-certificates! #f pathname dirname)))
 
@@ -636,8 +635,7 @@ EOF
   (##sys#check-string pathname)
   (ssl-clear-error)
   (cond
-   (((foreign-lambda c-pointer SSL_load_client_CA_file c-string)
- (##sys#expand-home-path pathname))
+   (((foreign-lambda c-pointer SSL_load_client_CA_file c-string) pathname)
 = (cut
 	(foreign-lambda
 	 void SSL_CTX_set_client_CA_list c-pointer c-pointer)
-- 
2.4.1

From 14254fa5a4e0d9d2084c309abc3cc128950f6919 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen kristianl...@gmail.com
Date: Tue, 19 May 2015 13:31:21 +0200
Subject: [PATCH] bugfix: migrates from ##sys#expand-home-path =
 pathname-expand

the ##sys#expand-home-path procedure was removed from core around
chicken 4.9.0.1, and put in a separate egg. let's use that egg (or not
expand at all?)

without this patch, ssl-load-certificate-chain! and friends will
segfault! it's trying to call an unbound procedure: ##sys#expand-home-path
---
 openssl.meta |  1 +
 openssl.scm  | 15 +++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/openssl.meta b/openssl.meta
index b27c8a2..5904c83 100644
--- a/openssl.meta
+++ b/openssl.meta
@@ -5,5 +5,6 @@
  (author Thomas Chust)
  (license BSD)
  (category net)
+ (depends pathname-expand)
  (doc-from-wiki)
  (files openssl.scm openssl.release-info openssl.meta openssl.setup))
diff --git a/openssl.scm b/openssl.scm
index db693fe..f7665d4 100644
--- a/openssl.scm
+++ b/openssl.scm
@@ -42,10 +42,9 @@
##sys#current-thread
##sys#size
##sys#setslot
-   ##sys#check-string
-   ##sys#expand-home-path))
+   ##sys#check-string))
 
-(use srfi-18 tcp)
+(use srfi-18 tcp pathname-expand)
 
 #
 #include errno.h
@@ -583,7 +582,7 @@ EOF
   (unless (eq?
 	   ((foreign-lambda
 	 int SSL_CTX_use_certificate_chain_file c-pointer c-string)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname))
+	(ssl-unwrap-context obj) (pathname-expand pathname))
 	   1)
 (ssl-abort 'ssl-load-certificate-chain! #f pathname)))
 
@@ -602,7 +601,7 @@ EOF
 	   return(SSL_CTX_use_PrivateKey_file(
 	(SSL_CTX *)ctx, path, 
 	(asn1 ? SSL_FILETYPE_ASN1 : SSL_FILETYPE_PEM)));\n)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname)
+	(ssl-unwrap-context obj) (pathname-expand pathname)
 	rsa? asn1?)
 	   1)
 (ssl-abort 'ssl-load-private-key! #f pathname rsa? asn1?)))
@@ -626,8 +625,8 @@ EOF
 	   ((foreign-lambda
 	 int SSL_CTX_load_verify_locations c-pointer c-string c-string)
 	(ssl-unwrap-context obj)
-	(if pathname (##sys#expand-home-path pathname) #f)
-	(if dirname (##sys#expand-home-path dirname) #f))
+	(if pathname (pathname-expand pathname) #f)
+	(if dirname (pathname-expand dirname) #f))
 	   1)
 (ssl-abort 'ssl-load-verify-root-certificates! #f

Re: [Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-21 Thread Kristian Lein-Mathisen
I see, that sounds sensible. Could you apply the no-home-path-expansion
patch and fix it upstream, so that openssl will work on 4.9.01?

K.

On Tue, May 19, 2015 at 3:23 PM, Thomas Chust ch...@web.de wrote:

 On 2015-05-19 13:35, Kristian Lein-Mathisen wrote:
  [...]
  It's been way too long! I'm running CHICKEN 4.9.0.1 and the openssl-egg
  segfaults at ssl-load-certificate-chain! and friends.
 
  I have two patches/suggestions:
  - remove home path expansion
  - use the pathname-expand egg
  [...]

 Hello,

 the only reason this functionality was included in the first place, was
 that CHICKEN's standard I/O procedures used to perform automatic home
 directory expansion, so I wanted the OpenSSL egg to behave similarly. If
 I'm not mistaken, the standard I/O procedures no longer do home
 directory expansion by default. I think it would make sense to also
 remove this functionality from the OpenSSL egg. If needed, one could
 always make use of the pathname-expand egg explicitly, which would make
 the intent clearer.

 Ciao,
 Thomas


 --
 When C++ is your hammer, every problem looks like your thumb.

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Interesting. I can't fint that tag:

$ git fetch origin 4.10.0rc1
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://code.call-cc.org/chicken-core
 * tag   4.10.0rc1  - FETCH_HEAD

$ cat .git/FETCH_HEAD
671a5eb3fa2cf29f7e9d7a877e22335fb503934atag '4.10.0rc1' of
git://code.call-cc.org/chicken-core
$ git log --oneline | grep 671a | wc
  0   0   0

Maybe something funny happened on the server-side? A commit that was
tagged, then a rebase? Should I make a local tag on commit
eacc846be7cf4026eb8e8f6eaa577082d826da2e
to be 4.10.0rc1?

Thanks,
K.

On Tue, Jun 9, 2015 at 9:35 AM, Peter Bex pe...@more-magic.net wrote:

 On Tue, Jun 09, 2015 at 09:24:34AM +0200, Kristian Lein-Mathisen wrote:
  Great work Moritz and the team! Looking forward to test this on our
  systems.

 Excellent!  I'd love to hear your feedback.

  We are building from the git repo, is there a tag/branch for 4.10.0?
  prerelease perhaps?

 Yes, there's the prerelease branch, and also a 4.10.0rc1 tag.
 I had to explicitly tell git to fetch the tag, because it didn't
 on a normal fetch/pull.  Why not?  Because it's git ;)

 Cheers,
 Peter

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Interesting! I didn't know about git fetch --tags, that worked. But yes,
it's not on a branch. We'll use this for our tests. Thanks everyone!

K.

On Tue, Jun 9, 2015 at 11:31 AM, Christian Kellermann ck...@pestilenz.org
wrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [150609 11:25]:
  Interesting. I can't fint that tag:

 How did you update? Git will only fetch tags from the server if you tell
 it to do so, for example git fetch --tags.

 The tag interestingly resides on a commit without a branch though, it
 sits on 671a5eb3fa2cf29f7e9d7a877e22335fb503934a.

 So I guess what happened is that Moritz created a tag, then moved the
 commit to some place else (which in essence is creating a new commit
 with its own hash). BUT as tags are just bookmarks to commit hashes this
 does not automatically adjust the tag.

 TL;DR the tag is worthless and needs to be reset by the author.

 As a workaround tag eacc846be7cf4026eb8e8f6eaa577082d826da2e as you
 proposed, Moritz should do that for the call-cc.org repo.

 Sorry,

 Christian


 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Great work Moritz and the team! Looking forward to test this on our
systems.

We are building from the git repo, is there a tag/branch for 4.10.0?
prerelease perhaps?

K.

On Sun, Jun 7, 2015 at 5:16 PM, Moritz Heidkamp mor...@twoticketsplease.de
wrote:

 Hello everyone,

 we are happy to announce the first release candidate of the upcoming
 CHICKEN 4.10.0. It is now available at this location:

 http://code.call-cc.org/dev-snapshots/2015/06/07/chicken-4.10.0rc1.tar.gz

 The SHA 256 sum of that tarball is

 b5cc7c2d270d11f56a52da1b78950ada27d9bce2496b8ba230542d104b5477f0

 The list of changes since version 4.9.0 is available here:

 http://code.call-cc.org/dev-snapshots/2015/06/07/NEWS

 Please give it a test and report your findings to the mailing list.

 Here's a suggested test procedure:

   $ make PLATFORM=platform PREFIX=some dir install check
   $ some dir/bin/chicken-install pastiche

 If you want to build CHICKEN with a compiler other than the default one,
 just use C_COMPILER=the compiler (e.g., C_COMPILER=clang) on the make
 invocation.

 Of course, feel free to explore other supported build options (see the
 README file for more information) and actually use CHICKEN 4.10.0rc1 for
 your software.

 If you can, please let us know the following information about the
 environment you tested the RC tarball on:

 Operating system: (e.g., FreeBSD 10.1, Debian 8, Windows 7 mingw-msys)
 Hardware platform: (e.g., x86, x86-64, PPC)
 C Compiler: (e.g., GCC 4.9.2, clang 3.6)
 Installation works?: yes or no
 Tests work?: yes or no
 Installation of eggs works?: yes or no

 Thanks in advance!

 The CHICKEN Team

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-21 Thread Kristian Lein-Mathisen
Obs! I'm on Version 4.9.1 (rev 30bb2f2), sorry for the confusion Thomas!

Thanks for getting it in there. I wonder what might break with this
upcoming change.
K.

On Thu, May 21, 2015 at 6:01 PM, Thomas Chust ch...@web.de wrote:

 On 2015-05-21 09:18, Kristian Lein-Mathisen wrote:
  I see, that sounds sensible. Could you apply the no-home-path-expansion
  patch and fix it upstream, so that openssl will work on 4.9.01?
  [...]

 Hello,

 I just checked and apparently the home path expansion stuff is still in
 place in released versions of chicken: My installation of CHICKEN reports

   Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)

 and it has ##sys#expand-home-path and does automatic home path expansion
 for standard I/O procedures such as open-input-file :-/

 There is commit 4f91e654f04254ba1039e327460e643fefbf5e36 in CHICKEN's
 Git repository that gets rid of this cruft, but it's not included in any
 released source tarball, as far as I can tell.

 I have removed the uses of ##sys#expand-home-path from the trunk version
 of the OpenSSL egg, but I think it doesn't make sense to tag a release
 at the moment.

 Ciao,
 Thomas


 --
 When C++ is your hammer, every problem looks like your thumb.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] New SDL2 eggs; help wanted

2015-11-08 Thread Kristian Lein-Mathisen
Hi John!

This is great! I would love to play around with this.

I tried to smack something together in the days when I was playing with
CHICKEN on Android. It's probably not very useful, but I though I'd mention
it anyhow: https://github.com/Adellica/chicken-sdl2/blob/master/sdl2.scm.
It's true what the readme says: it's very alpha.

K.

On Fri, Nov 6, 2015 at 3:10 AM, John Croisant  wrote:

> On 11/4/15 3:41 PM, Kooda wrote:
>
>> On Wed, Nov 04, 2015 at 01:35:13PM -0800, Dan Leslie wrote:
>>
>>> As a potential user and implementor of similar eggs (Allegro, SOIL, ..
>>> nanovg), I would provide fairly lean bindings first, then do any
>>> simplification or hand-holding as an additional module. It will save you
>>> time in the near term and provide flexibility to the users.
>>>
>>> -Dan
>>>
>> It seems to already be the case. There is a sdl-internals module used by
>> the public sdl2 module.
>>
>> Yes, the sdl2 egg is implemented as two modules, sdl2 and sdl2-internals.
> The sdl2-internals module is not considered part of the public API, and
> does not have the same stability guarantees. But, some parts of it are safe
> to use, which I have today written a guide to document:
>
>
> https://gitlab.com/chicken-sdl2/chicken-sdl2/blob/master/docs/using-sdl2-internals.md
>
> So, if anyone really needs to drop down to a lower level, the low-level
> bindings *do* exist. But I hope most people will not need (or want) to do
> that. If there are low-level operations that people need to perform, please
> submit a feature request so I can consider providing support for it to the
> sdl2 module. That said, the purpose of this egg is only to provide
> convenient access to SDL2's features. It is not a high-level game framework
> or engine. (But it would be a good foundation for someone to build a
> high-level game framework or engine on top of.)
>
> - John Croisant
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] new egg: chicken-cjson

2015-09-28 Thread Kristian Lein-Mathisen
Hi guys,

and thanks so much for a great weekend! It was nice to meet everyone again
and specially nice to meet the "new" guys coming from very far away! I hope
it won't be long till next time :)

I even managed to be a little productive this time, and am releasing a new
egg:
https://github.com/Adellica/chicken-cjson

I don't know how useful it is because you need to tweak things a lot to
gain any performance over medea's, for example, but I though it was pretty
straight-forward and wouldn't hurt to put it out in the wild. Please let me
know if you find you end up using it!

Cheers,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] This may be a bug in chickens hash tables - or my bad

2015-12-17 Thread Kristian Lein-Mathisen
I may be completely misunderstanding something here, but don't you have to
use equal? and not eq? for record structures?

K.

On Wed, Dec 16, 2015 at 10:09 PM, Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Ah, great to learn.
>
> a) You are right: Per SRFI-69 it is actually undefined.  Per chicken
> manual it returns the new value associated with key.
>
> As I've seen the latter (e.g. in the iup egg) actually being used, we
> might at least want to keep the behavior in chicken.
>
> b) But does not matter much.  I ran into this originally from
> hash-table-ref signaling a missing key.
>
> The attached, modified test case fails because it i) does not find the
> key object hence hash-table-fold'ing the tree to ii) find an association
> with the very key the lookup failed for before.
>
> My hypothesis (after lightly reading the srfi-69.scm source) that the
> eq?-hash procedure produces a different hash value for the lookup before
> and after the mutation.  Hence the lookup fails while walking the tree
> succeeds.
>
> /Jörg
>
> Am 16.12.2015 um 21:55 schrieb Peter Bex:
> > On Wed, Dec 16, 2015 at 09:47:31PM +0100, Jörg F. Wittenberger wrote:
> >> Hi,
> >>
> >> I always assumed that (make-hash-table eq?) would create a hash table
> >> usable with arbitrary chicken objects as keys.
> >>
> >> That is especially structures like objects created via define-record
> >> should be valid as keys.  That is: referencing the table using the very
> >> same object (comparing eq? to the key object of the insert operation)
> >> will succeed.
> >>
> >> However this fails for me.  At least after the key object was mutated
> >> between insert and reference time.
> >>
> >> See attached test case.
> >>
> >> Am I trying something illegal here?
> >>
> >> Thanks
> >>
> >> /Jörg
> >
> >> (use srfi-69)
> >>
> >> (define objtbl (make-hash-table eq?))
> >>
> >> (define (register! obj arg)
> >>   (hash-table-update! objtbl obj identity (lambda () (list obj arg
> >>
> >> (assert (eq? (register! 1 1) (register! 1 2)))
> >
> > I believe the return value of hash-table-update! is undefined.
> >
> > Cheers,
> > Peter
> >
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Any decent web development framework

2015-12-28 Thread Kristian Lein-Mathisen
The spiffy  egg will let you make
what you're looking for, but it doesn't provide the web-DSL that Sinatra
has. You could make your own DSL, though, depending on what you're trying
to do. I put together a small spiffy wrapper that works like this:

https://github.com/Adellica/reser/blob/master/example.scm

It's not in the coops, so chicken-install reser won't work (you'll have to
do clone and cd reser && chicken-install)
K.

On Mon, Dec 28, 2015 at 9:11 AM, 机械唯物主义 : linjunhalida <
linjunhal...@gmail.com> wrote:

> Looks like artanis is for guile and it needs to be compiled, not for
> Chicken.
> Is there any way to install it in Chicken?
>
> 2015-12-28 0:47 GMT+08:00 Dan Leslie :
> >
> > If you are desiring a monolithic web stack of the Rails sort, then what
> > you probably are looking for is GNU Artanis:
> >
> > http://web-artanis.com/index.html
> >
> > -Dan
> >
> > 机械唯物主义 : linjunhalida  writes:
> >
> >> Hi scheme users,
> >>
> >> I'm a rails programmer, and knows scheme long time ago but don't have
> >> chance to write scheme code in production level. I want to use scheme
> >> for website development but it turns out there is no decent framework
> >> for web development in chicken.
> >>
> >> Is there any recommendations? awful is not very useful.
> >> Any library same as Rails or Sinatra?
> >>
> >> Sinatra writes like this:
> >>
> >> (get "/" (lambda (request)  "hello")
> >> (get "/from/:id" (lambda (request) (sprintf "hello ~A" (request 'id
> >> (get "/page/:id" (lambda (request)
> >>   (let ((data ($query (from pages) (where (= id (request 'id))
> >> (render "templates/page" ('data data
> >>
> >> Thanks.
> >
>
>
>
> --
>
> Coder, Gamer, Reader.
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Hello! I'm new and need some pointers please ~

2015-11-29 Thread Kristian Lein-Mathisen
Hi Federico and welcome to the CHICKEN community!

I've just got a small note on your build setup. Most CHICKEN projects use a
.setup-file and then build with chicken-install. There should be a thousand
examples of setup-files (here's
 a small
one, and here's
 a
large one). Setup-files and chicken-install do tend to clobber your project
folder with binary files as well as installing things in /usr. If you can
live with that, it's nice in that it integrates in the other CHICKEN tools
(like cross-compiling and salmonella).

Cheers!
K.

On Sun, Nov 29, 2015 at 2:55 PM, Andy Bennett 
wrote:

> Hi Federico!
>
> > Hello there! I'm Federico, a.k.a gosukiwi.
> >
> > I'm a wen developer (JS, Ruby, PHP, etc) wanting to learn
> > Scheme/Lisp/functional programming. My first lisp dialect is CHICKEN.
>
> Welcome!
>
>
> > I decided to make a simple project using Scheme so I can get the hang of
> > it. I didn't use anything "crazy" like macros, just simple constructs.
> > (Oh btw, any recommended book on Scheme which I follow along using
> CHICKEN?)
> >
> > It would be awesome if you guys could take a look and let me know what
> > you think? The source code is
> > here: https://github.com/gosukiwi/chicken-brainfuck
> > It's an interactive brainfuck interpreter.
> >
> > Also, I have one question: What's a good site for CHICKEN Scheme
> > reference? A simple document with a list of all standard R5RS/CHICKEN
> > functions would be great. Currently, using the CHICKEN website is so
> > hard to stuff, and if I Google I get a lot of Racket/MIT Scheme
> > documentation, but very little for CHICKEN.
>
> The R5RS spec itself is actually pretty accessible.
> "Learn Scheme in Fixnum Days" is also quite good.
>
> There are some DuckDuckGo shortcuts (https://duckduckgo.com/ ) !csc and
> !csw which look up the search term in the Chicken Scheme Chickadee and
> Wiki respectively. Just type the short code and then your search term in
> to the search box at http://duckduckgo.com/ .
>
> Chickadee (http://api.call-cc.org/ ) allows you to search the APIs for
> CHICKEN and its Eggs.
>
>
> > For example, for web development we have http://devdocs.io/ which is
> > awesome for searching documentation.
> >
> > Thanks for your time ~
>
> No worries! Welcome to the community.
>
>
>
>
>
> Regards,
> @ndy
>
> --
> andy...@ashurst.eu.org
> http://www.ashurst.eu.org/
> 0290 DA75 E982 7D99 A51F  E46A 387A 7695 7EBA 75FF
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] extension loading in sqlite3 egg

2016-06-07 Thread Kristian Lein-Mathisen
Thank you very much, Thomas! Works great for my purposes. Any chance of
giving this a new tag for release?

K.

On Tue, May 24, 2016 at 11:26 PM, Thomas Chust <ch...@web.de> wrote:

> On 2016-05-24 11:25, Kristian Lein-Mathisen wrote:
> > [...]
> > In the sqlite3 command-line, this works fine. The solution was to enable
> > extension loading which is not allowed by default:
> > https://www.sqlite.org/c3ref/enable_load_extension.html
> >
> > However, this Sqlite3 function isn't available in the egg.
> > [...]
>
> Hello,
>
> I have added an enable-load-extension! procedure to the trunk version of
> the sqlite3 egg. In addition to what your patch did, I added some
> boilerplate error checking code, which can't hurt, and a feature flag to
> turn the procedure into a stub, in case someone wants to compile the egg
> with an old or otherwise restricted version of SQLite3.
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] big prime number

2016-01-25 Thread Kristian Lein-Mathisen
Yes, indeed! CHICKEN 5 is exciting :) Thanks again Peter, for your ongoing
efforts in pushing this forward!

K.

On Mon, Jan 25, 2016 at 1:49 AM, Dan Leslie  wrote:

>
> Peter Bex  writes:
>
> > Now, the good news is that I also ran the program under CHICKEN 5 and
> > it took just under 17 seconds to complete.  Most likely this is because
> > the whole thing can be done completely inline, without any CPS calls,
> > which means a lot less allocation, which in turn means a lot less
> > garbage collections need to be performed.  So again many thanks to Felix
> > for pushing me to make all operators have inlineable C functions!
>
> I am very much looking forward to Chicken 5.
>
> :D
>
> -Dan
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] A question regarding "hidden" eggs

2016-01-20 Thread Kristian Lein-Mathisen
Hi Jörg,

I think I may have bumped into similar needs now and again. I suppose one
way of solving this is to clone the henrietta-cache and run this on your
local server. However, I feel that's a little overkill if you just want a
work-in-progress egg to be available with any chicken-install.

I tried to set up my /usr/local/share/chicken/setup.defaults so that
chicken-install would first try my ~/prj/eggs/ folder, and then use the
server if that doesn't work. I never managed to set it up like that,
though, and I can't recall what went wrong. Would this approach solve your
problems though, Jörg?

K.

On Mon, Jan 18, 2016 at 2:22 PM, Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Am 18.01.2016 um 14:13 schrieb Christian Kellermann:
> > * Jörg F. Wittenberger  [160116 19:35]:
> >> Hi,
> >>
> >> I feel the need to have some space to stash away temporary glue code.
> >>
> >
> > Is this about code you want to be able to chicken-install but noone
> > else should see it?
>
> Precisely.
>
> >> Ideally the current version of it is always empty and not of interest to
> >> anyone.  As documentation always lags behind, it is empty with high
> >> probability.  However development is not ideal.
> >
> > I don't understand this.
>
> I have some code to be ripped out of context and made available as eggs.
>  This code is well tested and comes with dependencies to things I would
> ideally rather replace with code from other eggs.  For transition and
> backward compatibility, I want to import some things from the "hidden"
> code.
>
> So it's all deprecated code right from the beginning.
>
> >> Not listing as in being marked as "(hidden)" in the meta file is
> >> apparently what I want.
> >
> > That does not make sense to me, if people can install it but should
> > not use it, what is it good for?
>
> Sure use it.  But not only indirect.  It should be outright clear and
> obvious that nothing implemented there is supposed to stay and be
> supported in future versions.  Nothing will be documented for re-use.  I
> don't want anybody to build anything at it an then complain when I
> eventually got around to remove something.
>
> >
> > If it is some code that your published eggs rely on, it will be public
> > in a way. Listing it in an egg index or hide it then does not make a
> > lot of a difference to me.
> >
> > But maybe I misunderstand what you really want to get done.
> >
> > Cheers,
> >
> > Christian
> >
> >
> > --
> > May you be peaceful, may you live in safety, may you be free from
> > suffering, and may you live with ease.
> >
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Starting up spiffy for dynamic content

2016-03-09 Thread Kristian Lein-Mathisen
Hi Norman!

We've been using the vhost-map a lot in our systems too. I've put together
(so far an unofficial) egg that turns spiffy's current-request and
current-response into function arguments and return values respectively.
Maybe that could be useful for some code-samples, if not useful as a
dependency.

https://github.com/Adellica/reser


K.

On Wed, Mar 9, 2016 at 4:01 PM, Norman Gray  wrote:

>
> Peter, hello.
>
> On 8 Mar 2016, at 20:41, Peter Bex wrote:
>
> On Tue, Mar 08, 2016 at 02:48:00PM +, Norman Gray wrote:
>>
>
> So you mean including handlers like:
>>>
>>> (define (vhost-handler cont)
>>> (let ((uri (uri-path (request-uri (current-request)
>>>   (if (string=? (cadr uri) "wibble") ;; we want to handle URIs
>>> like /wibble/...
>>>   (send-response status: 'ok
>>>  body: (format "Good: request was ~S
>>> (vhost)" uri)
>>>  headers: '((content-type text/html)))
>>>   (cont
>>> (vhost-map `((".*" . ,vhost-handler)))
>>>
>>
>> That's how it was intended, yes.  I've added something similar to the
>> wiki with a link to slightly extended (but somewhat outdated) example
>> from a demonstration.
>>
>
> The new section 'A simple dynamic web page example' is perfect, in
> combination with the pointer to the spiffy+sxml example.
>
> I marginally adjusted the linked webserver.scm to use sxml-serializer
> rather than the full-blown sxml transform egg (was that the 'outdated' you
> meant).  I've attached the result.
>
> OK: that's a (very) nice design -- I'll do that.
>>>
>>> But may I suggest that vhost-map is not, perhaps, the best name for
>>> this structure, since the intended functionality is much more
>>> general than mapping vhosts.  As I mentioned, I guessed that might
>>> be a route to the solution, but based on the name, on the fact it's
>>> documented in a section called 'Virtual hosts', and since the
>>> example in that section is about handling virtual hosts, I got the
>>> impression that the author was firmly steering me away from more
>>> open-ended cleverness.  Caolan suggested that I'm not (thankfully)
>>> alone in misinterpreting this.
>>>
>>
>> Well, it is a mapping for which handler to use for which vhost.  That
>> is also the topmost place where dispatching happens for incoming
>> requests, so it's the place where you'd add custom handlers.
>>
>> I could add some intermediate parameter like "request-handler", which
>> then defaults to some procedure that handles the request like the
>> current implementation does (try to serve a file), but it would be
>> one more level of indirection which is basically just what "continue"
>> does now.
>>
>> Would that be sensible?
>>
>
> I don't think that would be necessary and would, as you say, be a further
> level of indirection.  Yesterday afternoon, I did put together a potential
> patch for spiffy.scm which may have the same idea (attached for interest),
> but the vhost-map (once one understands what it's intended for) seems to be
> completely general.
>
> Perhaps dispatch-handler-map, or handler-map, or something like
>>> that, would signal the intent more clearly, along with an example
>>> such as the above.
>>>
>>
>> Not sure that would be much clearer.  Also, it would break compatibility.
>>
>
> Indeed: it's not obvious what the best name is, though 'handle/host'
> seemed to push the right buttons for me.
>
> One would of course export a (define vhost-map fancy-new-name) for
> compatibility.
>
> Since the car of the alist is a host pattern,
>>> then perhaps the word 'host' should be in the name, but in that case
>>> perhaps handle/host might be suitable (and if anything's being
>>> changed, then it might be nice to have a clear catch-all host
>>> pattern, such as #t, or to permit the list elements to be a
>>> continuation thunk as well as a string-thunk pair).  Thus:
>>>
>>> (handle/host
>>> `(,my-general-handler
>>>  ("foo\\.bar\\.com" . ,(lambda (continue) ...))
>>>  (#t . ,my-catch-all-handler))
>>>
>>
>> I think that would only complicate things, and cause more confusion
>> as to the format of this list.
>>
>
> I agree.
>
> It's a wiki, feel free to improve the wording in places where it's
>> unclear.
>>
>
> There's nothing I can usefully add to the change you've made, but I'll
> bear the suggestion in mind for what I expect to be lots of future
> engagement with these docs.
>
> And thanks, Andy, for the pointer to uri-match (and for the mention of
> Knodium, which I intend to investigate further).
>
>
> All the best,
>
> Norman
>
>
> --
> Norman Gray  :  https://nxg.me.uk
> SUPA School of Physics and Astronomy, University of Glasgow, UK
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org

  1   2   >