From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tim Meehan Newsgroups: gmane.lisp.guile.user Subject: Somehow I have got this "thunk" thing wrong. Date: Fri, 5 Mar 2021 18:05:20 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33587"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Mar 06 01:05:51 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIKS6-0008dI-9x for guile-user@m.gmane-mx.org; Sat, 06 Mar 2021 01:05:50 +0100 Original-Received: from localhost ([::1]:42620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIKS5-0005cF-8I for guile-user@m.gmane-mx.org; Fri, 05 Mar 2021 19:05:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIKRu-0005bv-Hd for guile-user@gnu.org; Fri, 05 Mar 2021 19:05:38 -0500 Original-Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:44120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIKRp-00024K-TQ for guile-user@gnu.org; Fri, 05 Mar 2021 19:05:38 -0500 Original-Received: by mail-qk1-x72f.google.com with SMTP id 130so3803648qkh.11 for ; Fri, 05 Mar 2021 16:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=uLhy7Svg6yOlzqx5vt/KPUa55M7+bhV2Hi3Lsmdu5nI=; b=iX8h9zH9TG66JU+tLQpQqF/pOtCVJaKdv9M1giK+Bto1IhLnfjuGaeFWtK+KOqBeoS 30lFwcdSdWRIM63kKQMwiYAp+cr69hezk8Lvy9DDpkVJcUSRlnMZ91TnS5lFfve0IyXm YPQAJcxk8CansVPWIWIukrUrAnPBwsvoYttUVesP4ThrXMPBGFmWM6bGtJLGUIVbhWuN NqVF6byE8lcYIXyMofLU8Wa7c0INXaBqSSt5d+imYSJf/j7au8WluHq9NoWNjWepgUN3 ot0qOAeKoIXLt648OZRmnyEtfW7ccLUmmb3to+U0O93UdEWpI7uDzc7iNapHc070ZFzJ UeJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=uLhy7Svg6yOlzqx5vt/KPUa55M7+bhV2Hi3Lsmdu5nI=; b=VY12kH2/YyO8sY/8E4c321Tpagx/4A32dgz4Ld4pPowJCIFQpiFj15vBKl16J84Qpg yW7Z69l2XMPDFWo1+qovTe4+ggbXlE9dUnoC/aXznEzkDDmbTk670N/Yt1N/7sYhW8Ya EzNcDrXcr5gvmYKDa3QXG7rxYYPk6RSqGU8ykTnzLxAM/2k3dJpDo5zJP00Ad9GXMaes Gf6w/is3j2jsguzq+PLa3zujct4qU2IOoAYLIRi/O7kMZe0JdRhF0w9l+j9DxyjBe9fF s4BY/xzhiIddedlxV1p0rT7MGsJVe37mOjSt+y8mqA7if/yLDZ2cAxRulni6oN/hgE9J pCEg== X-Gm-Message-State: AOAM531HtNgPXnUTr2G6OHCqLSqgAP4m10zq+w5Gn5wLfh06NREA03n2 nPZHT7V1jhCFLc0o42efd6760gvY2MXiH0v0vbK0rwC3AN4= X-Google-Smtp-Source: ABdhPJyrVemwbgpJpT+I3lnNEIJtv8Q0XT4bbUrb+21dMWc5yDnK3c/tJl/AyW6cLVEoCVn4nV0uuX4VC0MIOuq+9/I= X-Received: by 2002:a05:620a:954:: with SMTP id w20mr12047636qkw.57.1614989131629; Fri, 05 Mar 2021 16:05:31 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=btmeehan@gmail.com; helo=mail-qk1-x72f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17336 Archived-At: I wanted to store a thunk in a hashtable so that I could look up its key and then run it later. Something like this: #! /usr/bin/guile !# (use-modules (ice-9 hash-table)) (define stuff (alist->hash-table '((a . (lambda () (display "event a\n"))) (b . (lambda () (display "event b\n"))) (c . (lambda () (display "event c\n")))))) (define res (hash-ref stuff 'a)) (res) But when I run it: Wrong type to apply: (lambda () (display "event a\n"))