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] hash table questions

2012-11-23 Thread Peter Bex
On Thu, Nov 22, 2012 at 07:56:31PM -0500, Claude Marinier wrote:
 Greetings fellow Schemers,

Hello again,

 Having established in a previous post that using a u8vector as a key for a
 hash table is expected to work, I have some specific questions.
 
 I am still learning how to post questions properly. I hope this is clear
 and contains enough information.

Don't worry too much about it.  I just wanted to let you know so that
you don't get yelled at on other lists (some people can be even ruder
in their replies).

 By the way, how can I make the included code display properly? In Mozilla
 Firefox, it uses a proportional font.

You're probably using the gmail web interface... You can probably select
to use plain text instead of mail with markup somewhere.  It's
generally better to use a proper offline client; you'll have more control
over how exactly the mail gets sent.  It should be possible to do that
even with gmail.

 1) Is using a hash function other than the default worth the trouble?

No, the default should be fine.

 I define the hash table this way.
 
 (define IPv4-table
   (make-hash-table IPv4-addr= (make-fixnum-bounded-hash FNVAHash)))

I hadn't noticed you're using the hashes egg (you did mention that
in your previous mail.  I was just too confused to notice).  Did
you try using just srfi-69?  It's best to only use a separate egg if
you have specific requirements that the core doesn't address or if
the egg provides enough convenience to warrant the dependency.

Kon mentioned something about FNVAHash not hashing properly with
u8vectors.  The core srfi-69 implementation ought to do that fine.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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


Re: [Chicken-users] hash table questions

2012-11-23 Thread Дмитрий
By the way,

 You're probably using the gmail web interface... You can probably select
 to use plain text instead of mail with markup somewhere. It's
 generally better to use a proper offline client; you'll have more control
 over how exactly the mail gets sent.
If using an offline client is not an option (e.g. need to access mail from lots 
of different locations), you can still style your GMail with an user JavaScript 
using extensions like Greasemonkey for Firefox, BlackCanvas for Chrome or 
built-in functionality in Opera (for example, you could detect the letter is 
from this mailing list and change font to monospaced).

 -- 
Best regards,
Dmitry Kushnariov

___
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 Daniel Leslie
Thanks!

I appreciate the testing. WorksForMe usually doesn't cut the mustard, so
your feedback is quite welcome.

I fixed a few of the derps that was causing Marmalade to have issues; happy
hacking!

-Dan


On Fri, Nov 23, 2012 at 2:26 AM, Kristian Lein-Mathisen 
kristianl...@gmail.com wrote:


 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] using flymake with chicken

2012-11-23 Thread Peter Bex
On Fri, Nov 23, 2012 at 08:27:32PM +0100, Peter Bex wrote:
  Suggestions are welcome.
 
 Flymake doesn't have default key bindings for going to the next/prev error.
 Maybe the mode can set up something like M-n and M-p to step between
 errors?  Or does it make more sense to let the user do this so it can
 be customized consistently across languages that use flymake?

Also: is there a way to show the error message?  I found
flymake-display-err-menu-for-current-line, but that gives
an annoying popup with the message, which is cut off so you
can't read the most important parts.

Note that I'm not familiar with flymake itself, either.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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


[Chicken-users] undefined reference to `C_numbers_toplevel'

2012-11-23 Thread Miguel Fernandez
Hey everyone,

I'm just starting out in Scheme, and trying to compile a small snippet that 
uses complex numbers. The code is as follows:

(use numbers)

(begin
  (display 3+3i)
  (newline)
)

I installed the `numbers` egg with `chicken-install`, load it with `use`, and 
when I run it (as a script) through the interpreter `csi` it works perfectly. 
Unfortunately, when I try to compile it with:

csc -uses numbers main.scm

I get the following error:

main.o: In function `C_toplevel':
main.c:(.text+0x1c2): undefined reference to `C_numbers_toplevel'
collect2: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: gcc main.o 
-o main -L/usr/local/lib -Wl,-R/usr/local/lib -lchicken -lm -ldl

*Versions and specs:*
-  csc 4.8.0 (rev 0db1908) manually compiled
-  chicken-install 4.8.0
-  numbers 2.8.1
- Fedora Linux 16 

As far as I know, I haven't touched anything in the distribution either. 

Anyone have any ideas why this is happening? If you need more info, I'd be more 
than happy to give it!

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


Re: [Chicken-users] hash table questions

2012-11-23 Thread Kevin Wortman
Hi,

This may or may not be helpful, but I'll add that, if it were me, I'd
represent an IP address as a list of four fixnums rather than a u8vector.
Then the default hash function will work out of the box, and many of your
functions can be written more concisely. E.g.

(define IPv4-addr= equal?)

(define (IPv4-address-string a)
  (string-intersperse (map number-string a) .))

It's true that a u8vector will be a bit more space-efficient, but IMO it's
wise to refrain from that level of optimization unless and until it's the
only way to deal with an observed bottleneck.

Regards,
Kevin Wortman



On Thu, Nov 22, 2012 at 4:56 PM, Claude Marinier claudem...@gmail.comwrote:

 Greetings fellow Schemers,

 Having established in a previous post that using a u8vector as a key for a
 hash table is expected to work, I have some specific questions.

 I am still learning how to post questions properly. I hope this is clear
 and contains enough information.

 By the way, how can I make the included code display properly? In Mozilla
 Firefox, it uses a proportional font.


 1) Is using a hash function other than the default worth the trouble?

 I define the hash table this way.

 (define IPv4-table
   (make-hash-table IPv4-addr= (make-fixnum-bounded-hash FNVAHash)))

 (declare (inline IPv4-addr=))
 (define IPv4-addr=
   (lambda (addr1 addr2)
 (and (= (u8vector-ref addr1 0) (u8vector-ref addr2 0))
  (= (u8vector-ref addr1 1) (u8vector-ref addr2 1))
  (= (u8vector-ref addr1 2) (u8vector-ref addr2 2))
  (= (u8vector-ref addr1 3) (u8vector-ref addr2 3)

 Would it be simpler, as effective, and almost as efficient to use the
 default?

 P.S. Is this the correct way to specific an alternate hash function?


 2) Is this the correct way to add new records to the table and update
 existing records?

 (define update-IPv4-counters
   (lambda (addr direction proto tokens)
 (let ((IP-record (hash-table-ref/default IPv4-table addr #f)))
   (cond
 ((not (vector? IP-record))
   ; addr is not in the table, this is a new entry
   (hash-table-set! IPv4-table addr
 (update-IP-record (make-IP-record) direction proto tokens)))
 (else
   ; addr is in the table, increment packets and add bytes
   (hash-table-set! IPv4-table addr
 (update-IP-record IP-record direction proto tokens)))

 Note that an IP record is a seven elements vector (i.e. created with
 make-vector).

 If I understand SRFI-69 correctly, hash-table-set! will replace a record
 with the same key. Is this correct? There cannot be duplicate keys, right?


 3) This is how I dump the hash table.

 (define dump-data
   (lambda ()

 (let*  ((outport (open-output-file (make-dump-file-name)))
 (dump-IPv4-record (lambda (address IP-record)
 (write-with-indent (IPv4-address-string address) 1
 outport)
 (dump-IP-protocols IP-record 1 outport

   (write-with-indent IPv4 0 outport)
   (hash-table-for-each IPv4-table dump-IPv4-record)

   ...

 (define IPv4-address-string
   (lambda (addr)
 (string-append
   (number-string (u8vector-ref addr 0)) .
   (number-string (u8vector-ref addr 1)) .
   (number-string (u8vector-ref addr 2)) .
   (number-string (u8vector-ref addr 3

 This code displays two records with the same key and different data. This
 has happened more than once. I have kept the output files.

 If I call hash-table-set! with the same address as another record but in a
 different format (say a vector instead of a u8vector), would it choke or
 would it just create a new record without complaining? This would look like
 duplicate keys but they would be different.

 I assume that hash-table-for-each will present each key / record pair once
 and do so in some arbitrary order.

 Can I assume that dump-IPv4-record, when it calls IPv4-address-string,
 will choke on a key which is not a u8vector?



 I am looking for the mistake I made which is producing the illusion of a
 duplicate key in the hash table. I believe that confirming my assumptions
 is a good starting point.

 I hope this sort of question is not abusing the list members.

 Thank you for your patience.

 --
 Claude Marinier


 ___
 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] undefined reference to `C_numbers_toplevel'

2012-11-23 Thread Peter Bex
On Fri, Nov 23, 2012 at 12:27:29PM -0800, Miguel Fernandez wrote:
 Hey everyone,

Hello Miguel!

 I'm just starting out in Scheme, and trying to compile a small snippet that 
 uses complex numbers. The code is as follows:
 
 (use numbers)
 
 (begin
   (display 3+3i)
   (newline)
 )
 
 I installed the `numbers` egg with `chicken-install`, load it with `use`, and 
 when I run it (as a script) through the interpreter `csi` it works perfectly. 
 Unfortunately, when I try to compile it with:
 
 csc -uses numbers main.scm

Hm, I think uses is for old-style units.  Normally you'd just compile
the program and it should work.  Because numbers has special syntax that
extends the basic reader you'll need to use csc -X numbers-syntax main.scm

See also the docs: http://wiki.call-cc.org/eggref/4/numbers#compiled-code

 I get the following error:
 
 main.o: In function `C_toplevel':
 main.c:(.text+0x1c2): undefined reference to `C_numbers_toplevel'
 collect2: ld returned 1 exit status

I'm not sure why that happens.  I guess it's caused by the uses switch
which assumes you're statically linking?

Hope this helps,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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


Re: [Chicken-users] using flymake with chicken

2012-11-23 Thread Daniel Leslie
Oh excellent!

You may be able to remove the need for the shell script by running
something like:

(shell-command-to-string (format csi -SAv \%s\ || true option-or-filename))

Thanks,
-Dan


On Fri, Nov 23, 2012 at 11:05 AM, Felix 
fe...@call-with-current-continuation.org wrote:

 Hello!


 Attached is a first go at flymake[1] support for Scheme code.
 It is derived from flymake-lua.el and very simple.

 Put chicken-flymake in your PATH, make it executable, load
 flymake-chicken.el
 into your emacs, open some .scm file and do

   M-x flymake-chicken-mode

 Now, lines containing scrutinizer warnings (and other errors that show
 a line number) are highlighted.

 I have not used this seriously yet, but it's sort of weirdly cool ...

 I have added the code to the git repository (see the scripts and misc
 subdirectories).

 Suggestions are welcome.


 cheers,
 felix

 [1] http://www.emacswiki.org/emacs/FlyMake

  flymake for CHICKEN

 ;; Taken from:
 ;; https://github.com/sroccaserra/emacs/blob/master/flymake-lua.el

 ;;
 ;; Flymake for Lua
 ;;
 ;; Usage:
 ;; (require 'flymake-lua)
 ;; (add-hook 'lua-mode-hook 'flymake-lua-load)
 ;;
 ;; Note: litterally stolen from Steve Purcell's Flymake Ruby.
 ;; See
 http://github.com/purcell/emacs.d/blob/master/site-lisp/flymake-ruby/flymake-ruby.el
 ;;

 (require 'flymake)

 (defgroup flymake-chicken nil
   Flymake Chicken Customizations)

 (defcustom flymake-chicken-program chicken-flymake
   How to invoke csc.
   :type 'file
   :group 'flymake-chicken)

 (defun flymake-create-temp-in-system-tempdir (filename prefix)
   (make-temp-file (or prefix flymake-chicken)))

 (defun flymake-chicken-init ()
   (list flymake-chicken-program
 (list (flymake-init-create-temp-buffer-copy
'flymake-create-temp-in-system-tempdir

 (defvar flymake-chicken-allowed-file-name-masks
   '((\\.scm\\' flymake-chicken-init)))

 (defvar flymake-chicken-err-line-patterns
   '(( *(\\(.+\\):\\([0-9]+\\)) *
  1 2)
 (\\(Error\\|Warning\\|Note\\): *(line \\([0-9.]*\\))
  nil 2)))

 ;(defvar flymake-lua-err-line-patterns
 ;  '((^.*luac[0-9.]*\\(.exe\\)?: *\\(.*\\):\\([0-9]+\\): \\(.*\\)$
 ;2 3 nil 4)))

 ;;;###autoload
 (defun flymake-chicken-mode ()
   (interactive)
   (when (and (not (null buffer-file-name)) (file-writable-p
 buffer-file-name))
 (set (make-local-variable 'flymake-allowed-file-name-masks)
 flymake-chicken-allowed-file-name-masks)
 (set (make-local-variable 'flymake-err-line-patterns)
 flymake-chicken-err-line-patterns)
 (flymake-mode t)))

 (provide 'flymake-chicken)

 #!/bin/sh
 #
 # usage: chicken-flymake OPTION-OR-FILENAME ...

 csc -SAv $@ || true

 ___
 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] hash table questions

2012-11-23 Thread Kon Lovett

On Nov 23, 2012, at 1:58 PM, Kevin Wortman kwort...@gmail.com wrote:

 Hi,
 
 This may or may not be helpful, but I'll add that, if it were me, I'd 
 represent an IP address as a list of four fixnums rather than a u8vector. 
 Then the default hash function will work out of the box, and many of your 
 functions can be written more concisely. E.g.
 
 (define IPv4-addr= equal?)
 
 (define (IPv4-address-string a)
   (string-intersperse (map number-string a) .))
 
 It's true that a u8vector will be a bit more space-efficient, but IMO it's 
 wise to refrain from that level of optimization unless and until it's the 
 only way to deal with an observed bottleneck.

Normally I wouldn't disagree with the basic idea here, although I would 
advocate a vector rather than list.

However the existing srfi-69 implementation doesn't follow a pair's references. 
(Also I think there is a bug where list? beats pair? in the type 
discrimination.)

But vectors (structures are treated as vectors) and vector-like objects do 
recurse into the contents, at least for 4 levels.

 
 Regards,
 Kevin Wortman
 
 
 
 On Thu, Nov 22, 2012 at 4:56 PM, Claude Marinier claudem...@gmail.com wrote:
 Greetings fellow Schemers,
 
 Having established in a previous post that using a u8vector as a key for a 
 hash table is expected to work, I have some specific questions.
 
 I am still learning how to post questions properly. I hope this is clear and 
 contains enough information.
 
 By the way, how can I make the included code display properly? In Mozilla 
 Firefox, it uses a proportional font.
 
 
 1) Is using a hash function other than the default worth the trouble?
 
 I define the hash table this way.
 
 (define IPv4-table
   (make-hash-table IPv4-addr= (make-fixnum-bounded-hash FNVAHash)))
 
 (declare (inline IPv4-addr=))
 (define IPv4-addr=
   (lambda (addr1 addr2)
 (and (= (u8vector-ref addr1 0) (u8vector-ref addr2 0))
  (= (u8vector-ref addr1 1) (u8vector-ref addr2 1))
  (= (u8vector-ref addr1 2) (u8vector-ref addr2 2))
  (= (u8vector-ref addr1 3) (u8vector-ref addr2 3)
 
 Would it be simpler, as effective, and almost as efficient to use the default?
 
 P.S. Is this the correct way to specific an alternate hash function?
 
 
 2) Is this the correct way to add new records to the table and update 
 existing records?
 
 (define update-IPv4-counters
   (lambda (addr direction proto tokens)
 (let ((IP-record (hash-table-ref/default IPv4-table addr #f)))
   (cond
 ((not (vector? IP-record))
   ; addr is not in the table, this is a new entry
   (hash-table-set! IPv4-table addr
 (update-IP-record (make-IP-record) direction proto tokens)))
 (else
   ; addr is in the table, increment packets and add bytes
   (hash-table-set! IPv4-table addr
 (update-IP-record IP-record direction proto tokens)))
 
 Note that an IP record is a seven elements vector (i.e. created with 
 make-vector).
 
 If I understand SRFI-69 correctly, hash-table-set! will replace a record with 
 the same key. Is this correct? There cannot be duplicate keys, right?
 
 
 3) This is how I dump the hash table.
 
 (define dump-data
   (lambda ()
 
 (let*  ((outport (open-output-file (make-dump-file-name)))
 (dump-IPv4-record (lambda (address IP-record)
 (write-with-indent (IPv4-address-string address) 1 outport)
 (dump-IP-protocols IP-record 1 outport
 
   (write-with-indent IPv4 0 outport)
   (hash-table-for-each IPv4-table dump-IPv4-record)
 
   ...
 
 (define IPv4-address-string
   (lambda (addr)
 (string-append
   (number-string (u8vector-ref addr 0)) .
   (number-string (u8vector-ref addr 1)) .
   (number-string (u8vector-ref addr 2)) .
   (number-string (u8vector-ref addr 3
 
 This code displays two records with the same key and different data. This has 
 happened more than once. I have kept the output files.
 
 If I call hash-table-set! with the same address as another record but in a 
 different format (say a vector instead of a u8vector), would it choke or 
 would it just create a new record without complaining? This would look like 
 duplicate keys but they would be different.
 
 I assume that hash-table-for-each will present each key / record pair once 
 and do so in some arbitrary order.
 
 Can I assume that dump-IPv4-record, when it calls IPv4-address-string, will 
 choke on a key which is not a u8vector?
 
 
 
 I am looking for the mistake I made which is producing the illusion of a 
 duplicate key in the hash table. I believe that confirming my assumptions is 
 a good starting point.
 
 I hope this sort of question is not abusing the list members.
 
 Thank you for your patience.
 
 -- 
 Claude Marinier
 
 
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users
 
 
 

Re: [Chicken-users] hash table questions

2012-11-23 Thread Peter Bex
On Fri, Nov 23, 2012 at 02:19:10PM -0800, Kon Lovett wrote:
 On Nov 23, 2012, at 1:58 PM, Kevin Wortman kwort...@gmail.com wrote:
  Hi,
  
  This may or may not be helpful, but I'll add that, if it were me, I'd 
  represent an IP address as a list of four fixnums rather than a u8vector. 
  Then the default hash function will work out of the box, and many of your 
  functions can be written more concisely. E.g.
  
  (define IPv4-addr= equal?)
  
  (define (IPv4-address-string a)
(string-intersperse (map number-string a) .))
  
  It's true that a u8vector will be a bit more space-efficient, but IMO it's 
  wise to refrain from that level of optimization unless and until it's the 
  only way to deal with an observed bottleneck.
 
 Normally I wouldn't disagree with the basic idea here, although I would 
 advocate a vector rather than list.
 
 However the existing srfi-69 implementation doesn't follow a pair's 
 references.

I'm not sure I understand correctly what you mean, but there's a
difference between eq?-hash and eqv?-hash versus equal?-hash: the latter
descends into lists recursively while the former two just look at the
pair directly.  This is expected behavior, if you think it doesn't do
this please provide an example where it goes wrong and file a bugreport.

 (Also I think there is a bug where list? beats pair? in the type 
 discrimination.)

Example + bugreport would be much appreciated here too.

 But vectors (structures are treated as vectors) and vector-like objects do 
 recurse into the contents, at least for 4 levels.

Same goes for lists.  I don't know why you think 4 levels are treated
specially, AFAIK they recur to any level.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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