Re: [Chicken-users] List Combinations

2015-01-07 Thread cowan
Bahman Movaqar scripsit:

> For Touka, this project I'm working on, I need to calculate the
> combinations of any number of lists. So I wrote this piece of code:
> https://gist.github.com/bahmanm/468f724279c0f411030a
>
> I wonder if it's useful to others and if it is, should I initiate and
> egg for it or is there any relevant egg around that I can make a pull
> request to?

Check out the "combinatorics" egg.

-- 
John Cowan  http://www.ccil.org/~cowanco...@ccil.org
In politics, obedience and support are the same thing.  --Hannah Arendt



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


Re: [Chicken-users] Chicken Scheme's license

2015-01-07 Thread Stephen Eilert
On Tue, Jan 6, 2015 at 3:51 AM, Alexej Magura  wrote:

> Thanks, Matt.
>
>

Keep in mind that each egg is licensed separately, if that's important to
you.


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


Re: [Chicken-users] RecordType operations and parameter types

2015-01-07 Thread Kon Lovett

> On Jan 6, 2015, at 4:16 AM, Bahman Movaqar  wrote:
> 
> I have a record type, SOME-RT, and am implementing operations for it. As a 
> habit, I keep putting an 'assert' expression at the beginning of each 
> procedure.
> 
>   (define (some-rt-some-op param1)
> (assert (some-rt? param1) ...)
> 
> However, I doubt if I'm doing things the idiomatic way. Is this the approach 
> you seasoned CHICKEN'ers would take as well? TIA,

Yet another style using the http://wiki.call-cc.org/eggref/4/check-errors 
 egg:

(use type-checks)

; creates ‘check-some-rt’ & ‘error-some-rt’ functions
; see documentation for options
(define-check+error-type some-rt)

 (define (some-rt-some-op param1)
(check-some-rt ‘some-rt-some-op param1 ‘param1)
...)

;check fail will signal a SRFI 12 composite condition (exn type) with 
properties location=some-rt-some-op, arguments=(), & 
message=“bad param1 argument - not a some-rt”. The argument identifier is 
optional.
> -- 
> Bahman Movaqar
> 
> http://BahmanM.com  - https://twitter.com/bahman__m 
> 
> https://github.com/bahmanm  - 
> https://gist.github.com/bahmanm 
> PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.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] RecordType operations and parameter types

2015-01-07 Thread Bahman Movaqar
On 01/07/2015 06:50 PM, Alex Charlton wrote:
> Bahman Movaqar writes:
>
>> I have a record type, SOME-RT, and am implementing operations for it. As
>> a habit, I keep putting an 'assert' expression at the beginning of each
>> procedure.
>>
>>   (define (some-rt-some-op param1)
>> (assert (some-rt? param1) ...)
>>
>> However, I doubt if I'm doing things the idiomatic way. Is this the
>> approach you seasoned CHICKEN'ers would take as well? TIA,
> While I wouldn’t say assert is in any way a bad thing to use, Eiffel-style 
> contracts can be a nice solution to this type of problem. While I’ve never 
> used the dbc egg before, it seems to be the way to go for contracts in 
> CHICKEN:
>
> http://wiki.call-cc.org/eggref/4/dbc

Thanks Richard and Alex for your replies and hints. For now as a
beginner, to keep the complexity at a minimum, I'd go with the
traditional "assert".

-- 
Bahman Movaqar

http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)



signature.asc
Description: OpenPGP digital signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] RecordType operations and parameter types

2015-01-07 Thread Alex Charlton

Bahman Movaqar writes:

> I have a record type, SOME-RT, and am implementing operations for it. As
> a habit, I keep putting an 'assert' expression at the beginning of each
> procedure.
>
>   (define (some-rt-some-op param1)
> (assert (some-rt? param1) ...)
>
> However, I doubt if I'm doing things the idiomatic way. Is this the
> approach you seasoned CHICKEN'ers would take as well? TIA,

While I wouldn’t say assert is in any way a bad thing to use, Eiffel-style 
contracts can be a nice solution to this type of problem. While I’ve never used 
the dbc egg before, it seems to be the way to go for contracts in CHICKEN:

http://wiki.call-cc.org/eggref/4/dbc

-- 
Alex


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


Re: [Chicken-users] RecordType operations and parameter types

2015-01-07 Thread Richard

Hello Bahman,

You could use #sys##check-structure for this. That said, I don't think
there is much wrong with using an assert.

greetings,
Richard

Bahman Movaqar writes:

> I have a record type, SOME-RT, and am implementing operations for it. As
> a habit, I keep putting an 'assert' expression at the beginning of each
> procedure.
>
>   (define (some-rt-some-op param1)
> (assert (some-rt? param1) ...)
>
> However, I doubt if I'm doing things the idiomatic way. Is this the
> approach you seasoned CHICKEN'ers would take as well? TIA,

-- 

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