IRC channel logs

2023-03-28.log

back to list of logs

<old>mwette: is there documentation/blog post about meta commands?
<old>I was trying to implement one the other day and failed
<haugh>What do I not understand about combining keywords and rest args with define* ??? http://vpaste.net/8kzm0
<flatwhatson>> When #:key is used together with a rest argument, the keyword parameters in a call all remain in the rest list.
<flatwhatson>haugh: ^^
<haugh>OOPS. Thanks.
<antlers>I'm gonna go sleep on when and how `define` forms inside `syntax-transformers` introduce (what I believe are) `internal`-ly renamed symbols into the `obarray`, like so:
<antlers>```
<antlers>(define-syntax-rule (define-via-indirection) (define test 'needle))
<antlers>(define-via-indirection)
<antlers>(module-map (lambda (sym val) (when (eq? (variable-ref val) 'needle) (display sym))) (resolve-module '(guile-user)))
<antlers>;; => test-b5eb162ed7629fe
<antlers>```
<antlers>I've got a hash suffix like that popping up in some slightly more complicated code, and I swear I've been been stuck on /and resolved/ this before, but just haven't retained the solution :c
<antlers>Or I misremember and never actually solved it, which would be a bummer, but I certainly never understood what was going on in-depth
<antlers>If anyone "on the inside" has any insight, a relevant source of documentation, or even like a function in `boot-9.scm`, I'd appreciate any leads
<sneek>Welcome back dsmith :)
<_graywolf>If I have a function that returns three values fetched via http call (token, url, and a verification code), I can think of multiple ways to implement that. Either define a record for it, return them in a list, or values/receive. Are there other options? What would be most idiomatic way to do this in?
<flatwhatson>_graywolf: it depends how you'll use them, but my go-to is usually a record in that case
<_graywolf>flatwhatson: In this case they need not be kept or forwarded somewhere together, it's really just matter of needed to get them out of a function. Two will be printed to the screen and third forwarded into another procedure.
<flatwhatson>ah, if it's internal then probably multiple values is fine
<flatwhatson>srfi-71 is my preferred multiple-values syntax
<_graywolf>Oh that is nice! Values felt like best fit, but I somewhat disliked how mixing the receive and let looked like. This solves that issue, so thanks for the suggestion :)
<flatwhatson>yeah receive is pretty old-school, the other common approach is srfi-11 let-values which was included in r6rs and r7rs
<rekado>flatwhatson: guile-openai will be useful to me, thanks!
<rekado>I had been working on something similar myself, actually
<flatwhatson>cool :) it's pretty fun :D
<flatwhatson>> What programming language should I learn?
<flatwhatson>As an AI assistant, I cannot make personal choices for you, but I highly recommend learning GNU Guile Scheme. Scheme is a minimal and powerful dialect of Lisp, which has a strong focus on functional programming, with first-class functions, lexical closures, and macros. Scheme is also a great language for learning about programming language design due to its clear semantics and simple syntax. Additionally, Guile Scheme is a Free Software
<flatwhatson>project, licensed under the GNU Lesser General Public License, and is developed as part of the GNU Project, which means that it respects your freedom and gives you control over your computing.
<flatwhatson>(this is with the prompt from my readme)
<flatwhatson>when i have some more time i plan to implement the embeddings API, it seems this is the way to go for working with large local datasets, you let the AI categorize everything and then do local search with a vector database
<flatwhatson>longer-term it would be good to have something more model-agnostic like langchain
<flatwhatson>scheme is the OG language of AI, it's depressing to need to use python for everything
<mwette>old: I just look at examples in system/repl/commands.scm
<wingo>i like finding comments like ";; for the moment," from 2013
<civodul>:-)
<haugh>Can I add docstrings to these generated procedures? http://vpaste.net/LLUcx
<dthompson>haugh: yes, you can add docstrings to any procedure object using set-procedure-property!
<haugh>Heyyyyyyyy that's what I'm after. thanks very much
<dthompson>(set-procedure-property! proc 'documentation "documentation goes here")
<dthompson>you can tag procedures with any arbitrary data you want, too. fun can be had with that. :)
<haugh>yeah what a cool api!
<antlers>Update for posterity (inc myself): Those exposed internal symbols are introduced when `test` in interpreted (and later renamed) as an unbound symbols in the definition's scope, and can be avoided by expanding the example `define-syntax-case` macro into nested `syntax-case` forms and explicitly defining `test` as a `syntax` object within the
<antlers>expansion context.
<antlers> http://vpaste.net/PUlgp
<antlers>So, I was considering adding an example to the manual to help those who are also exposed to these internally renamed symbols (esp. those without an existing Scheme background to infer from) figure out what's going on when these pop up
<antlers>And I'll be sure to hit up the mailing list, but I'm just putting this out there for now
<antlers>"The outer let form establishes a binding in
<antlers>the environment of lexical variables, but the inner let form is inside a
<antlers>syntax form, where only pattern variables will be substituted."
<antlers> https://www.gnu.org/software/guile/manual/html_node/Syntax-Case.html
<antlers>That doesn't seem right?
<antlers>But now I'm worried /I/ might still be missing something
<antlers>Oh, ok, I think I get it, rubber duck methodology has helped
<antlers>It is true that the pattern variable is not substituted by the lexical binding, but I needed to use distinct symbols to make it clear-- I'll try to work that into an example
<daviid>flatwhatson: scheme itself is 'old school' :) - _graywolf fwiw, receiveis perfectly ok, better imo ... short, concise, the verb says what it does, the syntax is perfect ... unbeatable :)
<rekado>flatwhatson: would you be interested in supporting the GTP-3 API as well?
<rekado>*GPT
<rekado>GPT3 is the only model that allows fine-tuning, so it’s still relevant. The API differs from the chat completion API of gpt-3.5-turbo and gpt-4.
<flatwhatson>rekado: yes sure, i guess you want the various fine-tunes APIs and the completion (non-chat) API?
<dsmith>sneek, botanack
<rekado>flatwhatson: yes, exactly