delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/10/17/17:56:17

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.8.0 04/21/2012 (debian 1:2.8.0~rc1-2) with nmh-1.5
X-Exmh-Isig-CompType: repl
X-Exmh-Isig-Folder: inbox
From: karl AT aspodata DOT se
To: geda-user AT delorie DOT com
Subject: Re: [geda-user] A lesson from gnet-makefile
In-reply-to: <20151016213030.GC2813@localhost.localdomain>
References: <1042003D-82E2-40F0-AB60-8186580C46AD AT noqsi DOT com> <201510121905 DOT t9CJ5T9W026297 AT envy DOT delorie DOT com> <CAM2RGhTMnybSnYgnNhVZGA6PTvyJu+=Kzd5LX2HMqxT1F4LoRg AT mail DOT gmail DOT com> <88EA58F5-2B23-498A-9E5B-84054976DBED AT noqsi DOT com> <CAM2RGhTPPtqmWVa3=Kf-PeN+WS5Tn4J+D0Ri6R_4OrQOk+LFKQ AT mail DOT gmail DOT com> <4D3CD563-D8EE-4B2A-975A-AC2B573960FF AT noqsi DOT com> <CAM2RGhT8WzhwvzFx3Rfv8vN-f=i1=uWuLF+48VygSRtfdzdo-A AT mail DOT gmail DOT com> <20151016213030 DOT GC2813 AT localhost DOT localdomain>
Comments: In-reply-to "Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
message dated "Sat, 17 Oct 2015 00:30:30 +0300."
Mime-Version: 1.0
Message-Id: <20151017215428.7E79B8104E54@turkos.aspodata.se>
Date: Sat, 17 Oct 2015 23:54:28 +0200 (CEST)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Vladimir 
> On Tue, Oct 13, 2015 at 02:02:53PM -0400, Evan Foss (evanfoss AT gmail DOT com)
> [via geda-user AT delorie DOT com] wrote:
...
> > I understand that but I would really like to go back and do more of
> > this in C. The final parsing of the net attributes into xyz output
> > format should be in scheme. Although I could be wrong.
> Do it the way you like it. I hope, if we'll have algorithms we need,
> we'll be able to express them in the language we want.
> 
> I can only note that Scheme is a hi-level language wrt C and sometimes
> (not always) it's better to express things in it rather than in C.
> 
> For example, the following code from gsymcheck
> 
> ------------------------8<--------------------------
> SCM_DEFINE (...)
> {
> TOPLEVEL* pr_current = edascm_c_current_toplevel ();
>   GList *iter;
>   PAGE *p_current;
>   SCM page_s;
>   SCM return_status = scm_from_int (0);
> 
>  /* C code to check all symbols */
> 
>   for ( iter = geda_list_get_glist( pr_current->pages );
>         iter != NULL;
>         iter = g_list_next( iter ) ) {
> 
>     p_current = (PAGE *)iter->data;
>     page_s = edascm_from_page (p_current);
> 
>     return_status = scm_sum (return_status, check_symbol (page_s));
>   }
> 
>   return return_status;
> }
> ------------------------>8--------------------------
>
> can be replaced just with
> 
> ------------------------8<--------------------------
> (apply + (map check-symbol (active-pages)))
> ------------------------>8--------------------------
> 
> in guile module (I'm just working on this)

I consider that an unfair comparison. The the c code have to convert
the data which is in scheme so it has to do a fair amaount of 
conversions to please the scheme part of geda, hence it looks messy.

If you like you could write a map-lookalike in c and possibly the
same for apply, but the coder obviously didn't bother. If you want
elegance, you can do that to a degree in c also.

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019