From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: How to count the number of occurrences of a character in a string? Date: Wed, 14 Oct 2015 16:00:56 -0400 Message-ID: References: <874mhvq3b2.fsf@mbork.pl> <8337xezpdc.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1444852989 27123 80.91.229.3 (14 Oct 2015 20:03:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Oct 2015 20:03:09 +0000 (UTC) Cc: Help Gnu Emacs mailing list To: Noam Postavsky Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 14 22:03:08 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZmSGQ-0000bi-9k for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Oct 2015 22:03:06 +0200 Original-Received: from localhost ([::1]:44300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmSGP-0004FO-Tq for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Oct 2015 16:03:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmSF2-0004BA-Tn for help-gnu-emacs@gnu.org; Wed, 14 Oct 2015 16:01:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmSEy-0003CD-Sb for help-gnu-emacs@gnu.org; Wed, 14 Oct 2015 16:01:40 -0400 Original-Received: from mail-ob0-x22d.google.com ([2607:f8b0:4003:c01::22d]:33682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmSEy-0003Bv-NN for help-gnu-emacs@gnu.org; Wed, 14 Oct 2015 16:01:36 -0400 Original-Received: by obbwb3 with SMTP id wb3so21894585obb.0 for ; Wed, 14 Oct 2015 13:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9zUlCmgh0SwdRa0qhnz0ByHLM5tXuuaBLBni+immvOA=; b=lAiQ0IDAl2afnTbdhod0wkFkTeaBHzLjroTMFMmBj4nUSlZqlwvfUIY4DzO9XwT86y fX4XvEC740Q1XqyuuFOzvwymCgujQi4GACv21O5y18vnmzKAJ0NunlS0mYIJqT/ZEixJ uMFTET+S9LsvzwDq4ufATkcKaK1EsG5adZPb9sqtUEFUQgoOWQPEKnXOcgOAzugRw5bJ aif5OHwQUblqqFhaLJTglOUgB+sNlvOw9M2+3XJjokoE/0h2wGcdPhHXJXm5BkTpuACQ asc1eotdKv6t6d7UZtQo631E16zEXPaasDomM4PurHfosmtft3WjRo2sjKuGgIH/ODrp NHmQ== X-Received: by 10.182.126.169 with SMTP id mz9mr3333581obb.63.1444852895955; Wed, 14 Oct 2015 13:01:35 -0700 (PDT) Original-Received: by 10.202.44.8 with HTTP; Wed, 14 Oct 2015 13:00:56 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22d X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107645 Archived-At: Thanks! That *was* the problem. Code: https://gist.github.com/kaushalmodi/ab487f63727381179f61 -- Kaushal Modi On Wed, Oct 14, 2015 at 2:19 PM, Noam Postavsky < npostavs@users.sourceforge.net> wrote: > Kaushal Modi gmail.com> writes: > > I ran the below wrapper progn block couple of times and I got > > different results each time. Oddly enough, I even got negative > > execution times. > > What am I doing wrong? > > `benchmark' is a function, you need to quote the code you pass to it, > otherwise you're measuring how long it takes to evaluate `2' (the result of > the progn block). > > > >