<abralek>Hi, is there some scaffold tool for guile projects? ***apteryx is now known as Guest36614
***apteryx_ is now known as apteryx
<abralek>guile init super-project which would create all the needful like tests configs etc.. <str1ngs>abralek: I'm not aware or any scaffold. mostly it's recommended to uses autotools <RhodiumToad>hm. what are people doing in terms of installing guile2 and guile3 at the same time? <abralek>str1ngs: yes, I know about autoconf, but those files are usually almost identical, except the project name <abralek>I was looking at some projects like guile-ssh guile-json <abralek>it would be great to have something to generate Makefile.am configure.ac tests <str1ngs>RhodiumToad: guile supports muli version installs. you can use something like ./configure --program-suffix=2.2 to give program suffix <RhodiumToad>yes, but there are remaining conflicts; the info files are not changed (fixable by specifying a different --infodir), and there's the problem of aclocal/guile.m4 which conflicts between installs <str1ngs>RhodiumToad: the best option is to use --program-suffix=2.2 and each guile has it's own prefix. <str1ngs>this is assuming you are manually installing of course. <str1ngs>abralek: it's not hard all you need is configure.ac an Makefile.am. autoscan can create a skeleton configure.ac <abralek>str1ngs: autoscan.. I am not aware about that. Let me see <str1ngs>abralek: it won't do much on a new scheme project . but it will produce a configure.scan you can copy to configure.ac ***rekado_ is now known as rekado
***selimcan-i_sani is now known as selimcan
<rekado>I’m trying to make a GET request with a Range header <rekado>but the Range header seems to have no effect: <rekado>doing the same with wget does work, though <civodul>rekado: did you try to see if the Range header is actually serialized? <rekado>(I tried with an HTTP request and observed strace output) <rekado>I’ll ignore this for now and revisit later. <srandon111>guys how can i return multiple values from a function without returning a list? <srandon111>i was trying to read here, but it's quite impossible to understand <srandon111>i see no examples or explanation on how to do it in guile <jcowan>Multiple values are not a list, any more than multiple arguments are. You can arrange to get multiple arguments as a list, but that doesn't make them the same thing. <mwette>I believe values must be called in the context of call-with-values (or a procedure or macro that uses call-with-values). (call-with-values (lambda () ... (values 1 2 3 4)) (lambda (a b c d) ...) <mwette>oh, unless values has one argument -- then it may be OK. Guile ref manuals says otherwise behavior is undefined <manumanumanu>srandon111: to work with multiple values, the simplest things to use is either let-values or receive. For let-values, you have to import (srfi srfi-11), and for receive, (ice-9 receive) (but maybe (srfi srfi-8) works). In the repl, multiple values are displayed each on a new line <RhodiumToad>I actually like srfi-71, but it's less compatible because it redefines let <manumanumanu>I believe chickn has a very nice form for srfi-8 with only one argument: (receive (values 1 2 3)) => (receive _ (values 1 2 3) _) which expands to (call-with-values (lambda () (values 1 2 3)) (lambda _ _)). <manumanumanu>RhodiumToad: so do I, but I haven't gotten used to it being in guile yet :D <RhodiumToad>let-values is a bit too paren-heavy even by ordinary lisp standards <jcowan>RhodiumToad: Yes, iwbni it only let you have one binding, but it slavishly imitates let <mwette>I use let*-values but it is easy to get lost in the parens. In most cases I end up with call-with-values. I forgot about receive. <mwette>I think when starting out it's better to use the base Scheme syntax/procedures, in order to get a better understanding of the langauge. e.g., named let versus other iteration forms <jcowan>yes, receive is probably best if you have only one multiple-value-returning object <RhodiumToad>call-with-values is much too cumbersome for serious use <jcowan>One thing I miss from CL is multiple-value-call, which afaik cannot be emulated directly without reifying multiple values <jcowan>It's roughly similar to call-with-values, except that it can call many producers and return all the values taken together. <jcowan>it doesn't come up much, but when it does you really want it. <dsmith-work>The way multiple values are handled in Scheme seems.. "foreign". Just doesn't seem to match the elegance in the rest of the language. <jcowan>There's a mismatch between Scheme's true nature as a continuation-based imperative language, where multiple values are just multiple arguments passed to the continuation, and its normal use as a functional language where by definition functions return a single value. <jcowan>Another problem is that there is no way to name multiple values in the callee <jcowan>(multiple-lambda (a b c) (d e f) ...) <jcowan>such that the body automatically returns (values d e f), but you still have to assign them (ugh) <dsmith-work>Heh. Reminds me of that quote: "Q: Why dosn't lisp have reference arguments? A: Because C++ can't return multiple values." Or something like that. <jcowan>It makes sense, actually. Fortran (until fairly recently) had only reference arguments, and Algol 60 allowed the callee to specify each argument as by value or by name. <jcowan>Here's a classic call by name procedure (rewritten into C with CBN): <jcowan>void gps(double i, n, z, v) { for(i = 1, i <= n, i++) z = v } <jcowan>with well-chosen arguments, this can compute any computable function <jcowan>What do you mean "output arguments"? <dsmith-work>You pass the address of a variable to receive the retuned value. <dsmith-work>I looked, but I can't find the exact quote right now. Or who it was by. ***jackhill_ is now known as jackhill
<jcowan>But also for the callee to get the value from the caller. It's reference both ways. If you pass i+1 or 5 as an argument, a cell is allocated on the stack, the value is assigned to it, and a reference to the cell is passed. If the callee mutates the argument, there will be no visible effect. <marmulak>hey is comma notation (example: ,q instead of (quit)) some general feature of the language or are they just a few exceptional commands for guile <mwette>exceptional commands that just work at the command prompt, I believe <mwette>the comma notation IS part of Scheme in the context of quoting: <mwette>(let ((foo 123)) `(abc ,foo)) => (abc 123) <dsmith-work>Pretty sure they are only available at an iteractive repl. (could be wrong) <str1ngs>marmulak: you can define your own with 'define-meta-command <str1ngs>they only work in REPL as far as I know <marmulak>is there a function in guile to sort a list of strings alphabetically <marmulak>not sure what the manual means by "sort items less", like I tried (sort '(...) less) and it didn't like that <str1ngs>it means to use a predicate comparison there I think. <str1ngs>string< does a less comparison on strings <str1ngs>maybe a better term is less means use a less than comparison <marmulak>so where the manual says "less" they mean to enter the symbol < <str1ngs>right but you can also use > to reverse the list :) <marmulak>I have a list of package names for guix that I put in a manifest file, I just felt like sorting the list <marmulak>although I could have just not been a fool and made it alphabetical to begin with since I added things to it one by one <str1ngs>sometimes emacs tackles you. but it's a fun adventure :). One of the best things I've invested time in. <marmulak>I've recently become an advocate for nano <marmulak>a buddy of mine told me I had to learn emacs org-mode and that was kind of useful <str1ngs>org-mode and magit are great reasons to use emacs <marmulak>ok so I put a simple sort function whose result I want printed on screen in an .scm file and gave it as an argument to guile on the command line, and apparentily it compiled it o_O <marmulak>I was thinking something more like, run it and show the result <str1ngs>marmulak: you could treate the list as data and use 'write to sort and 'read to get the list back <marmulak>the program seems to run but I think I need to add i/o to it if I want it to print to stdout <str1ngs>but this is alot of work just to sort one list. when you can do this in a editor like emacs <marmulak>oh yeah let me try to evaluate it in emacs <selimcan>Verily I say unto you, Emacs is worth learning <marmulak>what is thait 'write and 'read that you speak of <marmulak>wait how can a function just do i/o like that, this is anarchy <marmulak>I feel like I might be able to use guile as language for writing shell scripts or something like that with unix commands <str1ngs>marmulak: this is not sanitized but you can just do guix package -m ./example.scm and it will sort and save user-land list. <str1ngs>including install. I still think this is overkill but should show you how to use 'read and 'write <str1ngs>err I did'nt add sorting but you can :) <marmulak>I'm using a manifest file that is just one line of (specifications->manifest... <marmulak>that I copied from the man page or something <marmulak>it's much more simple than this but it works <marmulak>I was also delighted to discover it works with "guix weather" as well <str1ngs>marmulak: right I use specifications->manifest with my lists sorted in emacs pretty simple <str1ngs>I added these read right to show how you can serialize a sorted list. <str1ngs>marmulak later I plan to use guix scripts so I can pass command arguements. say ./profile server ./profiles workstation. and will install the subset manifest based on aruements. <marmulak>I am looking at some example guile scripts and I noticed #! is proceded by a line iwth !#. Never seen anything like that before <guix-vits>marmulak: it's like #!/bin/bash, but for guile <marmulak>must it always be enclosed by !# or only when it's multi-line? <str1ngs>srandon111: make-general-tag is used to create a name procedure . see a-tag label-tag etc. <mwette>srandon111: (define para-f (make-general-tag 'para)) <mwette>(define para-f/attr (para-f ("foo" "123") ("bar" "456"))) generates a function to generate paragraphs with those attributes) <mwette>(para-f/attr "here is some text") => <para foo="123" bar="456">here is some text</para> <mwette>civodul: I'm using the private procedure call-with-output-file/atomic from (system base compile) via @@. If it would be generally useful to people maybe export it? (And possibly relocate it?) <mwette>marmulak: I sometimes use #!/bin/sh\n ...\n exec guile $0 \n !# ; it lets you set up environment that guile may need. <marmulak>thanks, I was following script examples in the manual and it gets pretty hairy with #!/usr/bin/env sh exec guile -l...... <civodul>mwette: i agree it would be more generally useful <civodul>there currently isn't a module for that kind of tool though <mwette>civodul: current location is fine with me